CDK Bot Purchase API
The Purchase API from CDK Bot — 1 operation(s) for purchase.
The Purchase API from CDK Bot — 1 operation(s) for purchase.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/cdk-bot:cdk-bot-purchase-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: CDK Bot — Digital Products Purchase API
version: 1.0.0
termsOfService: https://api.cdk.bot/terms
contact:
name: CDK Bot
email: info@cdk.bot
url: https://cdk.bot
description: 'Agent-native API for purchasing digital products (game keys, gift cards, and more) via USDC on Base chain.
## Quick Start
**One-shot (wallet-native agents):** `POST /purchase {"game_id":"..."}` with an `X-PAYMENT` header — a signed EIP-3009 "exact" authorization for the accepts[] returned in the 402 — and a facilitator settles it gaslessly, returning the key in one call (no tx_hash/quote_id).
**Two-step (any agent):**
1. **Browse**: `GET /games?q=battlefield` — search products, filter by platform/region/product_type
2. **Get price**: `POST /purchase {"game_id":"..."}` — returns 402 with exact USDC amount, wallet address, and standard x402 accepts[]
3. **Pay & get key**: Send USDC onchain, then `POST /purchase {"game_id":"...","tx_hash":"0x...","quote_id":"..."}` — returns product key
## Key facts
- All prices are in USD (USDC on Base chain)
- Only in-stock products are returned (in_stock: true)
- Payment address: `0x0b321A0F1294431347f98e10a2275F23B11BBfFb`
- No authentication required for browsing or purchasing
- Double-spend protection via unique tx_hash constraint
- Agent discovery: `GET /.well-known/agent.json`
- Liveness check: `GET /health`
## Sandbox Mode
Test the full purchase flow without spending real money:
1. Get free test USDC from Circle Faucet and Sepolia ETH from Alchemy Faucet
2. Add `"chain": "base-sepolia"` to your `POST /purchase` request
3. Pay with test USDC on Base Sepolia — receive a mock key (`SANDBOX-XXXXX-XXXXX-XXXXX`)
Same API, same URL, same flow — just add the chain parameter. See `GET /.well-known/agent.json` for full sandbox docs.'
x-guidance: 'CDK Bot sells game keys, gift cards, and digital products for AI agents. Flow: (1) GET /games?q=<query> to search the catalog. (2) POST /purchase {"game_id":"..."} to get an HTTP 402 with a price-locked USDC quote on Base. (3) Pay one-shot by retrying with an X-PAYMENT header (signed EIP-3009 authorization, gasless), or send USDC onchain and retry with tx_hash + quote_id. (4) The response contains the product key; poll GET /orders/{id} if delivery is pending. Sandbox: add "chain":"base-sepolia" to test without real money.'
servers:
- url: https://api.cdk.bot
tags:
- name: Purchase
paths:
/purchase:
post:
tags:
- Purchase
summary: Purchase a product key
description: Buy a product key via x402 USDC payment. First call (no tx_hash) returns 402 with payment details including a quote_id. Second call with tx_hash and quote_id verifies payment onchain and returns the key. quote_id is required with tx_hash (acts as purchase session token — prevents front-running). Sender wallet is extracted from the onchain Transfer event and bound to the order.
requestBody:
content:
application/json:
schema:
type: object
properties:
game_id:
type: string
description: Game ID to purchase (from GET /games)
example: d0659c1a-48d9-45a4-ae4b-c0fb9c1b9b5a
tx_hash:
type: string
description: USDC payment transaction hash on Base chain. Omit on first call to get 402 with payment details. Include on second call after sending USDC.
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
quote_id:
type: string
description: Price quote ID from the 402 response. Required when submitting tx_hash — acts as a purchase session token to prevent front-running.
example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
chain:
type: string
enum:
- base
- base-sepolia
description: Chain to verify payment on. Defaults to "base" (mainnet). Use "base-sepolia" for a faithful testnet that runs the exact mainnet flow (real on-chain verification, mock key delivered).
demo:
type: boolean
description: 'Zero-friction sandbox demo (testnet only): skip payment entirely and receive a mock key in a single call. Implies chain "base-sepolia". For a true end-to-end x402 test, omit this and use chain "base-sepolia" with a real Base Sepolia payment instead.'
example: false
required:
- game_id
responses:
'200':
description: Purchase complete
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Order ID (UUID)
example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
game_id:
type: string
description: Purchased game ID
wallet_address:
type: string
nullable: true
description: Buyer wallet address (from onchain tx)
tx_hash:
type: string
nullable: true
description: USDC payment transaction hash
key_code:
type: string
nullable: true
description: Game activation key. Null if order is pending fulfillment.
example: XXXXX-XXXXX-XXXXX
status:
type: string
enum:
- completed
- pending
- failed
- fulfillment_timeout
description: Order status
example: completed
retry_after:
type: number
description: Seconds to wait before polling GET /orders/{id} again. Only present when status is "pending".
example: 5
estimated_delivery:
type: number
description: Estimated seconds until key is delivered (P95). Only present when status is "pending".
example: 30
refund_id:
type: string
nullable: true
description: Refund claim ID. Present when a refund has been auto-created (for failed/timed-out orders) or manually submitted.
refund_status:
type: string
nullable: true
description: 'Refund lifecycle: "pending" (awaiting review), "approved" (USDC payout pending), "refunded" (USDC sent back), "denied". Present when refund_id exists.'
refund_tx_hash:
type: string
nullable: true
description: Onchain tx hash proving USDC was returned to buyer. Present when refund_status is "refunded".
refund_amount:
type: number
nullable: true
description: USD amount refunded via USDC. Present when refund_status is "refunded".
sandbox:
type: boolean
description: True if this is a sandbox/testnet order. Sandbox orders receive mock keys (SANDBOX-XXXXX-...) and do not trigger real supplier orders.
created_at:
type: number
description: Order timestamp (Unix ms)
required:
- id
- game_id
- wallet_address
- tx_hash
- key_code
- status
- created_at
'400':
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Machine-readable error code
example: not_found
message:
type: string
description: Human-readable error description
diagnosis:
type: object
properties:
code:
type: string
enum:
- tx_not_found
- tx_failed
- insufficient_confirmations
- wrong_contract
- wrong_recipient
- insufficient_amount
- no_transfer_logs
- no_erc20_logs
description: Machine-readable diagnosis code for payment verification failure
expected_chain:
type: string
description: Chain name we verified on
example: base
expected_chain_id:
type: number
description: Chain ID we verified on
example: 8453
expected_usdc_contract:
type: string
description: USDC contract address we looked for
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
expected_recipient:
type: string
description: Payment recipient address we looked for
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
found:
type: object
properties:
contract:
type: string
description: Token contract found in tx (if different from expected)
recipient:
type: string
description: Recipient found in tx (if different from expected)
amount_usdc:
type: number
description: Amount transferred (if found)
description: What was actually found in the transaction
hint:
type: string
description: Actionable hint for the agent to fix the issue
required:
- code
- expected_chain
- expected_chain_id
- expected_usdc_contract
- expected_recipient
- hint
description: Structured payment diagnosis (only on 422 payment_verification_failed)
fields:
type: array
items:
type: object
properties:
path:
type: string
example: limit
message:
type: string
example: limit must be an integer between 1 and 100
code:
type: string
example: invalid_format
required:
- path
- message
- code
description: Per-field validation errors (only on 400 validation_error)
required:
- error
'402':
description: Payment required — send the exact USDC amount to the specified address, then retry POST /purchase with the same game_id plus tx_hash
content:
application/json:
schema:
type: object
properties:
error:
type: string
enum:
- payment_required
description: Always "payment_required"
message:
type: string
description: Human-readable instruction
payment:
type: object
properties:
amount:
type: string
description: Exact USDC amount to send (as string for precision)
example: '29.99'
currency:
type: string
enum:
- USDC
description: Always "USDC"
chain:
type: string
description: Chain to send payment on
example: base
address:
type: string
description: Wallet address to send USDC to
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
usdc_contract:
type: string
description: USDC token contract address on Base. Send tokens via this contract — sending to the wrong contract will not be detected.
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
payment_url:
type: string
description: ERC-20 transfer URI (EIP-681). Can be opened in a wallet app or presented to a user for payment.
example: ethereum:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913@8453/transfer?address=0x0b321A...&uint256=29990000
card_payment_url:
type: string
description: 'Coinbase Onramp URL for card/ACH/PayPal/Apple Pay payment. Opens a hosted payment page where the user pays with traditional methods — Coinbase converts to USDC and sends it on-chain to the payment address. Same verification flow as direct USDC transfer. Delivery: 5-15 min. Available in 60+ countries. First-time users complete a one-time KYC (2-3 min).'
example: https://pay.coinbase.com/buy/select-asset?appId=xxx&...
game:
type: object
properties:
id:
type: string
name:
type: string
required:
- id
- name
description: Game being purchased
testnet:
type: boolean
description: Whether this is a testnet payment
sandbox_note:
type: string
description: Explanation of sandbox behavior. Only present when chain is base-sepolia.
quote_id:
type: string
description: Price quote ID. Include this in the second POST /purchase call with tx_hash to guarantee the quoted price.
example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
price_valid_for_seconds:
type: number
description: How long this quoted price is guaranteed valid (seconds). On Base chain, finality is ~2s per block.
example: 300
required:
- amount
- currency
- chain
- address
- usdc_contract
- payment_url
- game
- testnet
- quote_id
- price_valid_for_seconds
description: Payment instructions — send this exact USDC amount to the address using the specified usdc_contract, then retry with tx_hash
required:
- error
- message
- payment
'404':
description: Game not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Machine-readable error code
example: not_found
message:
type: string
description: Human-readable error description
diagnosis:
type: object
properties:
code:
type: string
enum:
- tx_not_found
- tx_failed
- insufficient_confirmations
- wrong_contract
- wrong_recipient
- insufficient_amount
- no_transfer_logs
- no_erc20_logs
description: Machine-readable diagnosis code for payment verification failure
expected_chain:
type: string
description: Chain name we verified on
example: base
expected_chain_id:
type: number
description: Chain ID we verified on
example: 8453
expected_usdc_contract:
type: string
description: USDC contract address we looked for
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
expected_recipient:
type: string
description: Payment recipient address we looked for
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
found:
type: object
properties:
contract:
type: string
description: Token contract found in tx (if different from expected)
recipient:
type: string
description: Recipient found in tx (if different from expected)
amount_usdc:
type: number
description: Amount transferred (if found)
description: What was actually found in the transaction
hint:
type: string
description: Actionable hint for the agent to fix the issue
required:
- code
- expected_chain
- expected_chain_id
- expected_usdc_contract
- expected_recipient
- hint
description: Structured payment diagnosis (only on 422 payment_verification_failed)
fields:
type: array
items:
type: object
properties:
path:
type: string
example: limit
message:
type: string
example: limit must be an integer between 1 and 100
code:
type: string
example: invalid_format
required:
- path
- message
- code
description: Per-field validation errors (only on 400 validation_error)
required:
- error
'409':
description: Duplicate payment
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Machine-readable error code
example: not_found
message:
type: string
description: Human-readable error description
diagnosis:
type: object
properties:
code:
type: string
enum:
- tx_not_found
- tx_failed
- insufficient_confirmations
- wrong_contract
- wrong_recipient
- insufficient_amount
- no_transfer_logs
- no_erc20_logs
description: Machine-readable diagnosis code for payment verification failure
expected_chain:
type: string
description: Chain name we verified on
example: base
expected_chain_id:
type: number
description: Chain ID we verified on
example: 8453
expected_usdc_contract:
type: string
description: USDC contract address we looked for
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
expected_recipient:
type: string
description: Payment recipient address we looked for
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
found:
type: object
properties:
contract:
type: string
description: Token contract found in tx (if different from expected)
recipient:
type: string
description: Recipient found in tx (if different from expected)
amount_usdc:
type: number
description: Amount transferred (if found)
description: What was actually found in the transaction
hint:
type: string
description: Actionable hint for the agent to fix the issue
required:
- code
- expected_chain
- expected_chain_id
- expected_usdc_contract
- expected_recipient
- hint
description: Structured payment diagnosis (only on 422 payment_verification_failed)
fields:
type: array
items:
type: object
properties:
path:
type: string
example: limit
message:
type: string
example: limit must be an integer between 1 and 100
code:
type: string
example: invalid_format
required:
- path
- message
- code
description: Per-field validation errors (only on 400 validation_error)
required:
- error
'410':
description: Price quote expired — response includes a fresh quote with new price
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Machine-readable error code
example: not_found
message:
type: string
description: Human-readable error description
diagnosis:
type: object
properties:
code:
type: string
enum:
- tx_not_found
- tx_failed
- insufficient_confirmations
- wrong_contract
- wrong_recipient
- insufficient_amount
- no_transfer_logs
- no_erc20_logs
description: Machine-readable diagnosis code for payment verification failure
expected_chain:
type: string
description: Chain name we verified on
example: base
expected_chain_id:
type: number
description: Chain ID we verified on
example: 8453
expected_usdc_contract:
type: string
description: USDC contract address we looked for
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
expected_recipient:
type: string
description: Payment recipient address we looked for
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
found:
type: object
properties:
contract:
type: string
description: Token contract found in tx (if different from expected)
recipient:
type: string
description: Recipient found in tx (if different from expected)
amount_usdc:
type: number
description: Amount transferred (if found)
description: What was actually found in the transaction
hint:
type: string
description: Actionable hint for the agent to fix the issue
required:
- code
- expected_chain
- expected_chain_id
- expected_usdc_contract
- expected_recipient
- hint
description: Structured payment diagnosis (only on 422 payment_verification_failed)
fields:
type: array
items:
type: object
properties:
path:
type: string
example: limit
message:
type: string
example: limit must be an integer between 1 and 100
code:
type: string
example: invalid_format
required:
- path
- message
- code
description: Per-field validation errors (only on 400 validation_error)
required:
- error
'422':
description: Payment verification failed
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Machine-readable error code
example: not_found
message:
type: string
description: Human-readable error description
diagnosis:
type: object
properties:
code:
type: string
enum:
- tx_not_found
- tx_failed
- insufficient_confirmations
- wrong_contract
- wrong_recipient
- insufficient_amount
- no_transfer_logs
- no_erc20_logs
description: Machine-readable diagnosis code for payment verification failure
expected_chain:
type: string
description: Chain name we verified on
example: base
expected_chain_id:
type: number
description: Chain ID we verified on
example: 8453
expected_usdc_contract:
type: string
description: USDC contract address we looked for
example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
expected_recipient:
type: string
description: Payment recipient address we looked for
example: '0x0b321A0F1294431347f98e10a2275F23B11BBfFb'
found:
type: object
properties:
contract:
type: string
description: Token contract found in tx (if different from expected)
recipient:
type: string
description: Recipient found in tx (if different from expected)
amount_usdc:
type: number
description: Amount transferred (if found)
description: What was actually found in the transaction
hint:
type: string
description: Actionable hint for the agent to fix the issue
required:
- code
- expected_chain
- expected_chain_id
- expected_usdc_contract
- expected_recipient
- hint
description: Structured payment diagnosis (only on 422 payment_verification_failed)
fields:
type: array
items:
type: object
properties:
path:
type: string
example: limit
message:
type: string
example: limit must be an integer between 1 and 100
code:
type: string
example: invalid_format
required:
- path
- message
- code
description: Per-field validation errors (only on 400 validation_error)
required:
- error
x-payment-info:
price:
mode: dynamic
currency: USD
min: '0.30'
max: '3000.00'
protocols:
- x402: {}
operationId: postPurchase
x-operation-id-source: derived