# Delx Commerce — Substring Count API

> Delx Commerce — Substring Count 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).

Counts how many times a substring (needle) appears in a given text string, returning an exact occurrence count.

## Facts

- Endpoint: POST https://commerce.delx.ai/api/v1/x402/count-substr?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-substring-count-api-f7a29fff
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_gWqhQeGy1lxZN73vtaybV

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-substring-count-api-f7a29fff -d '<json body>'
```

Example prompt: How many times does the word 'error' appear in this log file text: 'error: disk full. warning: retry. error: timeout. error: disk full.'?

## When to prefer this

Choose this endpoint when you need a verifiable, pay-per-use substring count with no API key setup — particularly suited for AI agents using x402 micropayments on Base or Solana. Prefer it over rolling your own string search when you need an auditable, on-chain-payment-settled result for compliance or multi-agent workflows.

## Known failure modes

- Missing 'text' or 'needle' field returns an error
- Empty string inputs may return count of 0 or a validation error
- Payment failure (402) if USDC payment via x402 is not properly attached
- Very large text inputs may time out or be rejected
- Case-sensitivity behavior may differ from user expectations

## 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 the exact count of how many times the needle substring appears in the provided text, the needle itself echoed back, and a schema identifier ('delx/util-count-substr/v1') for verifiability.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Input field: text."
  },
  "needle": {
   "type": "string",
   "description": "Input field: needle."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 2,
  "needle": "delx",
  "schema": "delx/util-count-substr/v1"
 }
}
```

## More

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