Skip to main content
This guide walks you end-to-end against the staging environment (api-staging.kash.bot, Base Sepolia). Going live afterwards is the same flow against api.kash.bot.

1. Create a Kash account

If you don’t have one already, sign up at staging.kash.bot. The staging webapp is the human-facing front door; you’ll use it to create the account that owns your API keys.

2. Generate an API key

In the webapp:
  1. Go to Settings → API Keys.
  2. Click Create key.
  3. Give it a name (e.g. local dev) and select the scopes you need:
    • markets:read — read market detail & list (granted by default on every tier)
    • markets:quote — fetch on-chain price quotes
    • portfolio:read — read your own positions
    • trades:read — list and inspect your trades
    • trades:write — place trades and confirm high-value ones
    • webhooks:manage — list events, redeliver, rotate the webhook secret
  4. (Optional) Set an IP allowlist if you’ll always call from a known set of addresses.
  5. (Optional) Set a webhook_url if you want trade-lifecycle events POSTed to your endpoint.
The plaintext key is shown once. Capture it immediately:
The kash_test_ prefix marks staging keys; production keys use kash_live_.
Key issuance happens in the webapp’s Settings → API Keys page — the CLI can’t issue keys. Once you have one, store it in the CLI with kash auth set-key so every kash command picks it up. See the CLI guide.

3. Make your first request

You should get back a 200 OK with a page of markets. If you get 403 INSUFFICIENT_SCOPE, your key is missing markets:read. If you get 429, you’ve hit your tier’s rate limit — the response includes X-RateLimit-Reset and Retry-After.

4. Get a quote

The amount here is in atomic USDC (10000000 = 10 USDC). The response carries the expected tokensOut, the post-trade pool state, and an effectivePrice convenience number.

5. Place your first trade

Note: amount in the trade body is a decimal string of USDC ("10" = 10 USDC), distinct from the atomic-units amount used by the quote endpoint. You’ll get back a 201 Created:
The trade’s status field tracks the lifecycle: pending → validating → executing → completed (or failed/rejected).

6. Watch the trade complete

The simplest way is to poll:
You’ll see the status transition to completed with a txHash and tokensOut populated. The better way is to receive a webhook — see step 7.

7. Receive a webhook

If you set a webhook_url on the key in step 2, the trade.completed event was already POSTed to your endpoint. The body looks like:
The headers carry the signature so you can verify the request:
See Verifying webhook signatures for the verification recipe (one-line constant change from any Stripe library).

8. (Optional) Use the SDK

The TypeScript SDK gives you typed everything — including a one-line constructEvent for webhook verification:
Full SDK reference: TypeScript SDK.

What next?

Authentication

Scopes, IP allowlists, and key rotation.

Webhooks

Set up a verified, retried webhook endpoint.

Idempotency

Safely retry trade creation without duplicates.