# Call your first paid API

Five free trial calls per signed wallet, then pay per call in USDC on Base over x402.
No API key, no account, no signup form.

## 1. Pick an endpoint

    curl -s "https://minia2a.uk/api/services?limit=5"

Full spec: https://minia2a.uk/openapi.json (1,900+ operations) · MCP: POST /mcp ·
each catalog entry carries `inputSchema` and a ready-to-send `example`.

## 2. Ask what it costs

    curl -i "https://minia2a.uk/x402/math?expr=2%2B2"

Returns `402` plus a `PAYMENT-REQUIRED` header: base64 JSON with the amount, the token
(USDC on Base), the payee, and this endpoint's input example.

## 3. Pay and retry

    npm i @x402/fetch

`wrapFetchWithPaymentFromConfig(...)` pays the 402 and retries the request for you.
Raw path: sign an EIP-3009 `transferWithAuthorization` and retry with `X-PAYMENT`
(see https://minia2a.uk/x402-help).

## Trial calls, without paying

Sign a message with a wallet and send `X-Wallet-Signature`, `X-Trial-Timestamp` and
`X-Agent-ID` (your own random id). Five trial calls per wallet, shared across the catalog.

## When a call does not deliver

- A failed paid call is refunded; the response carries `X-Minia2a-Refund`.
- A `400` means your input was rejected. The body carries `retry_with` — a complete
  request (method, path, body) you can replay verbatim.

## Headers worth reading

- `X-Minia2a-Accepts` — field names this endpoint reads
- `X-Minia2a-Example` — a request body that works (percent-decoded = JSON)
- `retry_with` in a 4xx body — method, path, body to replay
- `Link: </api/services/<id>>; rel="service-desc"` — this endpoint's own description

## Know before you pay

- https://minia2a.uk/availability — per-endpoint delivery ledger, with sample sizes
- https://minia2a.uk/payability — platform-wide rates, with the method stated
