Partner API

Programmatic, read-only access to your account — fetch your provisioned keys, usage & spend stats, and transactions.

Interactive reference: Swagger UI · OpenAPI spec

Authentication

Create a token in Settings → API Tokens, then send it as a bearer header. Tokens are account-scoped — every endpoint returns only your data.

bash
curl https://apiswaps.com/api/v1/partner/keys -H "Authorization: Bearer sk-as-YOUR_TOKEN"
Treat the token like a password — it can read your keys, including the plaintext provider key values, and it can rotate, revoke and order keys. Revoke and recreate it if it leaks.

Endpoints

Base URL https://apiswaps.com. Every endpoint requires the bearer header above. Errors are { error: CODE, message }.

GET /api/v1/partner/keys

Your active provider keys, including the plaintext key value (handy right after a rotation). Query: brand (google · aws · azure), label — optional filters. Returns { keys: [...] } with keyId, brand, label, status, key, issuedAt, expiresAt, rotatedFromId; 404 if you have no active keys.

POST /api/v1/partner/keys

Order a new key — the same as Get a key in the dashboard: $10 is charged from your balance, the key is created pending and issued within hours; poll GET until it appears. Body: { brand, label?, idempotencyKey? }. Returns 201 { keyId, status: "pending", chargedUsd }; 402 INSUFFICIENT_BALANCE, 400 UNKNOWN_BRAND. Repeating a request with the same idempotencyKey returns the existing key without charging again.

POST /api/v1/partner/keys/{keyId}/rotate

Google keys only. Creates a new key in the same Google project and returns it in the response (key); the old key keeps working for a 48 hour grace period, then it is deleted at Google. Nothing is charged. Returns { keyId, key, brand, label, issuedAt, replaces: { keyId, graceUntil } }; 409 ROTATION_NOT_SUPPORTED for AWS / Azure keys — revoke and order a new one instead; 502 PROVIDER_ERROR if Google refused (nothing changed, retry later).

DELETE /api/v1/partner/keys/{keyId}

Revoke a key. A pending request is cancelled and the $10 refunded. An issued Google key is disabled at Google immediately and becomes retired; other brands are retired on our side and we disable the provider key by hand. Issued keys are never refunded. Returns { keyId, status, refunded, providerDisabled }; 409 NOT_REVOCABLE for cancelled / retired keys.

GET /api/v1/partner/stats

Aggregated usage & spend for a period. Query: from, to (YYYY-MM-DD, inclusive; defaults to the current month). Returns balance, period, spend, and breakdowns byKey / bySku / byDay.

GET /api/v1/partner/transactions

Your transaction ledger, newest first. Query: limit (1–200, default 50), offset, from, to. Returns { data: [...], total, limit, offset }.

Try it

bash
curl "https://apiswaps.com/api/v1/partner/stats?from=2026-06-01" -H "Authorization: Bearer sk-as-YOUR_TOKEN"# rotate a Google key (new key in the response, old one valid for 48h)curl -X POST https://apiswaps.com/api/v1/partner/keys/KEY_ID/rotate -H "Authorization: Bearer sk-as-YOUR_TOKEN"# revoke a keycurl -X DELETE https://apiswaps.com/api/v1/partner/keys/KEY_ID -H "Authorization: Bearer sk-as-YOUR_TOKEN"# order a new key ($10 from your balance)curl -X POST https://apiswaps.com/api/v1/partner/keys -H "Authorization: Bearer sk-as-YOUR_TOKEN" -H "Content-Type: application/json" -d '{"brand":"google","label":"prod"}'

Run every endpoint live in the interactive API reference.