# Delx Commerce — Truncate Middle

> Delx Commerce — Truncate Middle is a paid API for AI agents from commerce.delx.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-01).

Truncates a string to a maximum character length by removing characters from the middle and inserting an ellipsis, preserving the start and end.

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/truncate-middle?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/delx-commerce-truncate-middle-5bbe8318
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-o9-dlfLq7d4YhA2gEr_u

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability delx-commerce-truncate-middle-5bbe8318 -d '<json body>'
```

Example prompt: Can you truncate this file path '/home/user/documents/projects/secret-project/final-report-v3.pdf' to a max of 40 characters using middle truncation so I can display it cleanly in a narrow column?

## When to prefer this

Choose this endpoint when you need deterministic, rule-based middle truncation of a string — particularly for displaying long file paths, URLs, hashes, or identifiers in constrained UI spaces where both the beginning and end of the string carry meaningful information. It is preferable over custom code when you need a pay-per-call, no-signup micro-utility with verifiable delivery via x402 on Base or Solana.

## Known failure modes

- Missing required 'text' field returns an error
- Missing required 'max_chars' field returns an error
- max_chars value too small to fit even the ellipsis may result in an error or unexpected output
- Payment failure via x402 protocol returns 402 status before processing
- Non-integer max_chars value may cause a validation error

## How this service works

Pay-per-result APIs for agents. No signup. Exact price. Verifiable delivery. USDC on Base + Solana via x402.

## Output

Returns a JSON object containing the truncated text string (with ellipsis inserted in the middle if truncation was needed), a boolean 'truncated' flag indicating whether truncation actually occurred, the applied max_chars value, and a schema identifier string.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Input field: text."
  },
  "max_chars": {
   "type": "integer",
   "description": "Input field: max chars."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "text": "abcde…vwxyz",
  "schema": "delx/util-truncate-middle/v1",
  "max_chars": 11,
  "truncated": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-truncate-middle-5bbe8318/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from commerce.delx.ai](https://www.zero.xyz/host/commerce.delx.ai/llms.txt)
