Integrations · Direct

Set up Direct

Create a key, lock it to your servers, and call any API from your backend. Give each agent or tenant its own budget so one runaway loop can't drain your balance.

1

Create a server key

Top up in Console → Billing, then create a key in Console → API Keys. Keys start with pk- and are shown once. Store it as a secret, for example PIKEWAY_API_KEY, in your server's environment or secret manager.

Send it as Authorization: Bearer pk-…. The X-API-Key header is accepted too.

2

Lock the key down

Open the key in Console → API Keys and set the restrictions that fit where it runs. Restrictions are checked by the gateway before anything is charged.

LimitUSD
Maximum this key can ever spend. Once reached, paid calls return 402 api key spend limit reached. You can raise it, remove it, or reset the spent amount at any time.
IP allowlistIP / CIDR
Up to 100 IPs or CIDR ranges (IPv4 or IPv6). Calls from anywhere else get 403 client IP not allowed for this API key. Use it for every server key with a stable egress IP.
Siteshostnames
Turns the key into a browser key that only works from pages on your domains. Only for front-end use; see Browser keys.
Never ship an unrestricted server key in a web page, mobile app or public repo. Anyone holding it can spend your balance. If a key leaks, revoke or rotate it immediately.
3

Call an API from your backend

Find an endpoint with /v1/discover and check its inputs and price with /v1/inspect (both free), then run it. /v1/run builds the upstream request from structured input and returns a run object.

POST/v1/run
bash
curl -X POST https://gw.pikeway.ai/v1/run \
  -H "Authorization: Bearer $PIKEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1842-price" \
  -d '{
    "provider": "birdeye",
    "endpoint": "/defi/price",
    "input": { "address": "So11111111111111111111111111111111111111112" }
  }'
Response
HTTP/1.1 200 OK
X-Pikeway-Call-Id: 0192f6b0-5e2a-7d40-b1c3-8f9e2a4d6c11
X-Pikeway-Cost: 0.001

{
  "runId": "0192f6b0-5e2a-7d40-b1c3-8f9e2a4d6c11",
  "provider": "birdeye",
  "endpoint": "/defi/price",
  "method": "GET",
  "status": "COMPLETED",
  "output": { "data": { "value": 171.42 }, "success": true },
  "providerResponse": { "httpStatus": 200, "contentType": "application/json", "cache": "" },
  "cost": { "value": 0.001, "currency": "USD" },
  "durationMs": 312
}

Prefer to send the provider's own request shape? Use the raw gateway instead. Full parameters are in the /v1/run and gateway references.

bash
# Same call through the raw gateway: your request is forwarded as-is
curl "https://gw.pikeway.ai/gw/birdeye/defi/price?address=So11111111111111111111111111111111111111112" \
  -H "Authorization: Bearer $PIKEWAY_API_KEY"
4

Give each agent or tenant its own budget

In Console → Team, issue an agent key for each agent, worker or customer. Each has its own budget (up to $100,000) and spends from your balance. The console shows each key's spend and call count for the last 30 days and when it was last used, and you can revoke one without touching the others.

  • One key per agent means a stuck retry loop stops at its budget, not at your balance.
  • One key per tenant gives you per-customer spend without building metering.
  • Name keys after the agent or tenant: the name shows up in your logs and usage views.
5

Watch spend and handle errors

Any key can read its account balance and, if it has a limit, its own remaining budget. Check it before long jobs or alert on it.

GET/v1/wallet/balance
bash
curl https://gw.pikeway.ai/v1/wallet/balance -H "Authorization: Bearer $PIKEWAY_API_KEY"
Response
{
  "balance":   { "value": 48.21, "currency": "USD" },
  "earnings":  { "value": 0, "currency": "USD" },
  "keyBudget": { "limit": 20, "used": 3.47, "remaining": 16.53, "currency": "USD" },
  "spendable": { "value": 16.53, "currency": "USD" }
}
StatusMessageWhat to do
401invalid or revoked API keyThe key was revoked, expired or mistyped. Load the current key.
402insufficient balanceTop up, or enable auto top-up in Console → Billing.
402api key spend limit reachedThis key hit its limit. Raise it, or let the agent stop.
403client IP not allowed for this API keyThe call came from an IP outside the allowlist.
429rate limit exceededBack off and retry.

None of these are charged. When you retry a paid call after a timeout, send the same Idempotency-Key header so the call is never charged twice. See Errors for the full list.

6

Rotate keys without downtime

Rotate a key from Console → API Keys. The new key copies every setting and the spend so far; the old key keeps working for a grace period (24 hours by default, up to 7 days, or 0 to cut it off immediately) while you deploy the new one.

Security checklist

  • Keys live only on servers, in a secret manager or environment variables, never in source control.
  • Every key has a limit; server keys also have an IP allowlist.
  • Separate keys per environment (dev, staging, prod) and per agent.
  • Rate-limit your own users before their requests reach Pikeway: you pay for what they trigger.
More on balances, per-call pricing and billing headers: Keys, balance & billing.