The two credentials
There is a third secret in play that is not a Brickken credential: your private key. It never leaves your machine and is never sent to the API. It signs the x402 payment authorization and, in
client-signed mode, the blockchain transaction itself.
Which credential works where
Sending both does not help you. If
x-api-key is present it is validated and the whole x402 path is skipped, so no payment is taken — which also means no relayed execution. To pay with x402, omit the key entirely.
Using an API key
Send it as a header on every request:tech@brickken.com.
Your signer address must be whitelisted
An API key alone is not enough to write. The wallet you pass assignerAddress must be whitelisted by Brickken before any prepare-transactions call will accept it. Ask for the whitelist in the same request as the key — the form has a field for it.
Once that wallet performs a newTokenization, it becomes the tokenizer for the resulting token. Only the tokenizer can mint it, distribute its dividends, or manage its investor whitelist.
Sandbox and production keys are separate
Sandbox and production are separate deployments with separate databases. An API key issued for one does not work on the other.
Plans and credits
Every key belongs to a plan, and the plan grants a separate credit balance for each write method — not one shared pool.
Metered methods:
newTokenization, whitelist, mintToken, burnToken, transferTo, transferFrom, approve, dividendDistribution, newSto, newInvest, claimTokens, closeOffer, and patch-token-docs. When a balance runs out, the call fails with Out of credits for <method>.
The BKN faucet has a separate fixed balance: 10 lifetime claims per API key, for every plan. Faucet claims never consume mintToken credits. When this balance is spent, the call fails with Out of credits for faucet. The alternative x402 path costs 0.01 USDC and does not use the API-key balance.
Per-tier request throttles and quotas are configured on the usage plan attached to your key and are not published here. Ask
tech@brickken.com for the limits on your tier.Your key is scoped to the tokens it created
A key may only act on token symbols whose tokenizer email matches anewTokenization performed under that same key. Anything else returns Unauthorized token symbol. This affects get-stos, get-sto-by-id, get-investor-info, get-whitelist-status, get-allowance, and get-token-info.
The payment tokens HAI, BKN, USDC, USDt, and USDT are exempt and readable by any key.
Rate limits
Rate limiting applies toPOST /prepare-transactions only.
Exceeding a limit returns
429 with Retry-After: 60.
Not every endpoint enforces a key the same way
Authentication is applied per endpoint rather than globally, and the behaviour is not uniform. Three examples from sandbox:
Treat both
400 and 401 as “you need a key here”, and do not assume a read is public because a neighbouring one is.
Using x402 payment
x402 lets a client pay per call in USDC instead of holding an account. It is the only way to usebrickken-relayed execution, where Brickken signs and broadcasts the blockchain transaction and pays the native gas.
1
Choose the execution mode
brickken-relayed makes prepare free and charges the full operation at send; client-signed and client-broadcast split the operation charge between prepare and send. The Agentic pricing reference shows the matrix.2
Prepare — quote depends on the mode
Call a facade such as
POST /x402/agent/register, or POST /prepare-transactions with an eligible method. Relayed preparation needs no credential. A client-controlled prepare without an API key receives a 402 challenge and must complete the x402 payment handshake. The response returns txId, transactions, and an x402Requirements preview.3
Send — get the challenge
Call
POST /send-transactions. The API answers 402 Payment Required with a PAYMENT-REQUIRED header describing the exact chain, asset, transfer method, amount, recipient, and timeout.4
Sign the payment locally
Sign the payment authorization with the payer’s private key. The key stays on your machine.
5
Retry with the payment
Repeat the send with the payment header attached.
6
Read the settlement
Brickken verifies the payment, runs the operation, and returns the settlement in the
PAYMENT-RESPONSE header.Header names
The API accepts four spellings of the payment header —X-PAYMENT, X-Payment, x-payment, and payment-signature. Use whichever your HTTP client produces.
Browser clients can read the handshake: both PAYMENT-REQUIRED and PAYMENT-RESPONSE are listed in Access-Control-Expose-Headers.
The payment is reserved, then settled
Your payment is reserved when you pay, the operation runs, and only then is it settled. If the operation reverts, errors, or its authorization expires before confirmation, the reservation is released instead of charged. Polling a relayed operation withGET /get-transaction-status needs no credential. A status: "pending" means it was broadcast but not yet confirmed — do not pay or resubmit the same txId.
Payment asset
On Base Sepolia the x402 payment asset is Circle USDC:USDC, version 2, 300-second authorization window). The signed authorization carries the transfer, so no separate ERC-20 approve transaction is required. A live sandbox quote looks like this:
Per surface
Brickken.fromEnv(process.env) reads the same variables and the same aliases, with one deliberate exception: it does not read BRICKKEN_PRIVATE_KEY. Turning a key into a signer is an explicit choice in the SDK — see SDK authentication.
Using the Dapp API from the SDK, the CLI, and MCP
The Dapp API is not only reachable over plain HTTP. This is what each client can actually do with an API key today.SDK — full Dapp API access with an API key
The SDK is the client to use when your own code holds the credential. An API key alone reaches every Dapp read and write, typed, with the credential rules enforced locally before a request leaves your process.client-signed, so they also need a signer and a whitelisted signerAddress. See SDK for the full surface.
MCP — full Dapp API access with an API key
The hosted MCP server is the client to use when you want an AI agent to drive the Dapp API. Configure it with an API key and nothing else, and every Dapp tool works: the existing Dapp reads and prepare-based writes,create_kyc_link, and the three agent getters (get_agents, get_agent_info, get_agent_transactions).
x-api-key to every outbound request when one is configured, and it only falls back to the x402 handshake when the key is absent. So a session is either API-key mode or x402 mode, never both — set "apiKey": "" to force x402.
See MCP for the connection details and the full tool list.
CLI — Dapp API, KYC, faucet, and supported reads
The CLI sends
x-api-key for Dapp API transaction methods, Dapp API JSON endpoints, KYC, the Sandbox/Forge BKN faucet, and, when configured, agent getters and RAMS reads/typed-data fetches. Use brickken tx prepare --method <method> for Dapp tokenization, STO, and security-token transactions, and brickken dapp get or brickken dapp request for JSON endpoints.Relayed sends still require x402, and multipart endpoints such as /patch-token-docs remain REST-only.Error reference
These are authentication and quota errors. For request validation, preflight failures, and raw
on-chain revert data, see Troubleshooting.
Security rules
- Never transmit a private key or seed phrase to any Brickken endpoint.
- Keep API keys out of source control, tickets, screenshots, and chat. Use environment variables or a secret store.
- Use sandbox keys for development. A production key can move real value.
- Verify
chainId,signerAddress, the token address, and every recipient before signing — on-chain actions and x402 payments are non-refundable. - Read the amount, asset, and chain from
PAYMENT-REQUIREDrather than hardcoding them. - Rotate a key by requesting a replacement from
tech@brickken.comand retiring the old one.
Request an API key
Start here if you do not have a key yet.
Quickstart
Make your first call on any surface.