# Delx Commerce — String Truncation API

> Delx Commerce — String Truncation API 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 specified maximum character length, optionally appending a custom ellipsis, and returns the result with metadata about the operation.

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/string-trunc?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-string-truncation-api-b13f1f8a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_D0ZOQJoiHLO21wqO6loK6

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-string-truncation-api-b13f1f8a -d '<json body>'
```

Example prompt: Can you truncate this text to 10 characters and add '…' at the end: 'Hello, this is a long string that needs clipping'?

## When to prefer this

Choose this endpoint when you need a simple, deterministic, pay-per-use string truncation with no API key or signup required — especially suited for AI agents that need to enforce character limits on dynamic content at runtime. Useful when truncation logic must be consistent, auditable, and verifiably executed rather than handled client-side.

## Known failure modes

- Missing required 'text' field returns validation error
- Invalid 'max_chars' type (non-integer) causes request rejection
- Payment failure via x402 if USDC balance is insufficient
- Very large text inputs may hit platform size limits
- Empty string input returns ok:true with truncated:false and result as empty string

## 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 with: ok (boolean success flag), result (the truncated string), schema identifier (delx/util-string-trunc/v1), max_chars (the limit applied), truncated (boolean indicating whether truncation occurred), and original_chars (original character count of the input text).

## Request schema (JSON Schema)

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

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "result": "abcdefghi…",
  "schema": "delx/util-string-trunc/v1",
  "max_chars": 10,
  "truncated": true,
  "original_chars": 26
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/delx-commerce-string-truncation-api-b13f1f8a/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)
