Plain HTTP
Call the Abazi REST API from any language with curl or any HTTP client, using the agent credential as a Bearer token and an Idempotency-Key on every purchase.
Every MCP tool has a REST operation behind it. An agent that does not speak MCP calls these with any HTTP client: a Bearer token on every request, JSON in and out, and an Idempotency-Key on every purchase. To call the six tools themselves without an MCP client, send them as JSON-RPC requests instead.
Before you start
| You need | Why |
|---|---|
An agent credential (agk_test_...) | Created in the Console under Agents > New agent. Shown once. Replace YOUR_AGENT_KEY with it. See Get an agent credential. |
| A signed mandate for that agent | Without one every purchase is denied with MANDATE_MISSING. |
| API base URL | https://api.52-28-238-205.sslip.io |
The operations
| Operation | Request | MCP tool |
|---|---|---|
| Search the catalog | GETSearch services | search_catalog |
| Buy | POSTCreate payment intent | request_purchase |
| Follow a purchase | GETGet payment intent | get_purchase_status |
| Own budget and limits | GETGet spending status | get_spending_status |
| Signed receipt | GETGet receipt | get_receipt |
Authentication is Authorization: Bearer agk_test_..., the agentKey scheme in the API reference.
Verify
Search the catalog. Searching spends nothing.
curl -s 'https://api.52-28-238-205.sslip.io/v1/services?q=forecast&limit=5' \
-H 'Authorization: Bearer YOUR_AGENT_KEY'{
"services": [
{
"service_id": "svc_...",
"name": "Weather forecast",
"description": "Daily forecast for one city",
"price_base_units": "50000",
"asset": "USDC",
"rail": "x402",
"accepted_networks": ["solana:...", "eip155:..."],
"merchant": { "name": "Forecast Co", "tier": "VERIFIED" },
"tier": "VERIFIED"
}
],
"next_cursor": null
}Prices are in base units: 50000 USDC base units is 0.05 USDC.
First purchase
curl -s https://api.52-28-238-205.sslip.io/v1/payment-intents \
-H 'Authorization: Bearer YOUR_AGENT_KEY' \
-H 'Idempotency-Key: task-42-step-1' \
-H 'Content-Type: application/json' \
-d '{"service_id":"svc_...","task_id":"task-42","input":{"city":"Tbilisi"}}'| Body field | Meaning |
|---|---|
service_id or url | What to buy: a catalog service, or a paid URL. Exactly one. |
task_id | Your agent's task, for grouping and audit. |
input | Passed to the merchant, for example the city for a forecast. |
purpose | Up to 500 characters, shown to the approver and screened by Shield. |
wait_seconds | How long the call waits for settlement, 0 to 60. Default 20. |
Idempotency-Key is required, in the header or as idempotency_key in the body. The same key with the same body returns the same purchase, so a retry after a dropped connection never pays twice.
ALLOW
HTTP 200 with status paid:
{
"status": "paid",
"intent_id": "pi_...",
"payment_status": "confirmed",
"fulfillment_status": "delivered",
"decision": "ALLOW",
"reason_code": "WITHIN_POLICY",
"receipt_id": "rcpt_...",
"amount_base_units": "50000",
"asset": "USDC",
"rail": "x402",
"merchant": { "name": "Forecast Co", "tier": "VERIFIED" },
"resource": { "content_type": "application/json", "body": "..." }
}If the payment is still settling, status is submitted with poll_after_ms of 2000. Follow it, with YOUR_INTENT_ID replaced by the intent_id from the response above:
curl -s https://api.52-28-238-205.sslip.io/v1/payment-intents/YOUR_INTENT_ID -H 'Authorization: Bearer YOUR_AGENT_KEY'REQUIRE_APPROVAL
HTTP 200 with status awaiting_approval, a reason_code such as ABOVE_AUTO_THRESHOLD or FIRST_PURCHASE, approval_expires_at and poll_after_ms of 5000. Abazi sends the approval link to the owner's approvers. Poll GET /v1/payment-intents/{intent_id} until status is paid or denied (APPROVAL_REJECTED, APPROVAL_EXPIRED). The link expires after 10 minutes.
DENY
HTTP 403 with the standard error body:
{
"code": "POLICY_DENIED",
"reason_code": "HARD_CAP_EXCEEDED",
"message": "...",
"details": { "intent_id": "pi_...", "retryable": false, "next_action": "...", "scope": "..." },
"request_id": "req_..."
}Follow details.next_action. For NO_FUNDED_CHAIN, details.candidates lists each network that was considered and why it did not qualify. Never retry a denial with a new key.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
401 AGENT_CREDENTIAL_INVALID | The credential is wrong, rotated or revoked (AGENT_CREDENTIAL_INVALID). Stop and get a new one. |
400 VALIDATION_ERROR, "Idempotency-Key header is required" | Add the header, or idempotency_key in the body. |
403 FORBIDDEN, "Agent credential required" | The request used an API key (sk_test_...). Purchases need the agent's own credential. |
status stays awaiting_approval | A person has not decided yet. Keep polling the same intent. |
409 IDEMPOTENCY_CONFLICT | The same key was sent with a different body. Use a new key for a different purchase. See Idempotency. |
Next steps
Python SDK
Search the catalog, buy, follow a purchase and verify its receipt from Python with the uapg_client package, a thin wrapper over the Abazi REST API.
TypeScript
Generate a typed TypeScript client for Abazi from its OpenAPI contract with openapi-typescript and openapi-fetch, then search, buy and follow a purchase with checked paths and bodies.