Skip to main content
The Buildmarkets API uses API key authentication. Every request must include a valid key pair. This page explains how authentication works, how to generate and manage keys, and security best practices.

How authentication works

Every Buildmarkets API request requires two HTTP headers:
Both values are required on every request. There is no session token or cookie mechanism — each request is independently authenticated. Example request:
The same key pair can alternatively be sent as HTTP Basic auth — Authorization: Basic base64(api_key:api_secret):
Note: Authorization: Bearer <token> is reserved for user-facing OAuth/JWT flows (e.g., the CLI’s device login). Passing an API key as a Bearer token is not supported.

Token types

Two kinds of credential can authenticate a request. Both travel in the same X-API-Key / X-API-Secret headers — they differ in what they can reach. An account token is bound to one accountId at the authentication layer: the API scopes every request to that account automatically, so the token cannot read or act on any other account even if it asks. See Account-scoped tokens for how to issue one.

API key scopes

When generating an API key, you assign it one or more scopes that control which endpoints it can access. This follows the principle of least privilege.
Important: “Assign only the scopes your application needs. A compromised key with narrow scopes limits your exposure.”
This table covers the scopes used by the endpoints documented here. Additional scopes exist for managed accounts, fee billing, KYC/KYB, reporting, and compliance — contact support@buildmarkets.ai if your integration needs them.

Requesting API keys

Via email request

Buildmarkets API keys are provisioned and distributed via email. To request a new API key pair:
  1. Send an email request to the Buildmarkets team at support@buildmarkets.ai or contact your designated Relationship Manager.
  2. In your request, include the following details:
    • Environment: Whether you need keys for sandbox (testing) or production (live).
    • Scopes: The specific permission scopes your integration requires (see API key scopes).
    • Label: A descriptive label for the key pair (e.g., sandbox-backend or prod-trading-engine).
  3. Key requests are processed in regular batches. Once generated, your API key pair will be securely transmitted to your registered technical contact via encrypted email.

Via the API

You can also generate keys programmatically using an existing key that has the admin:keys scope:
Response:
Security note: “The api_secret is only returned once at creation time. Store it immediately in a secrets manager (e.g., AWS Secrets Manager, HashiCorp Vault). It cannot be retrieved again — if lost, revoke the key and generate a new one.”

Listing API keys

Retrieve all keys associated with your partner account:
The response lists key metadata (ID, label, scopes, creation date) but never includes the secret value.

Revoking API keys

Revoke a key that is no longer needed or may be compromised:
Returns 204 No Content on success. Revoked keys are immediately invalidated — any in-flight requests using the revoked key will fail with 401 Unauthorized.

Account-scoped tokens

An account token (tappacct_*) can only act on the single account it was issued for. Use one when a credential has to live somewhere you do not fully control — a mobile app, a browser client, or an MCP client connecting as the account role. All three endpoints require the admin:keys scope on the partner key making the call. The account must already be ACTIVE — mint the token after KYC completes, not at account-creation time.

Issuing a token

POST /v1/accounts/{accountId}/keys
Response (201 Created):
Security note: The secret is returned exactly once. It cannot be retrieved afterwards — if it is lost, revoke the token and issue a new one.

Listing tokens

GET /v1/accounts/{accountId}/keys Accepts limit and offset query parameters. Returns metadata only — token_id, key_prefix, label, scopes, status (active / revoked / expired), expires_at, last_used_at, created_at, revoked_at — plus a pagination object. The secret is never included.

Revoking a token

DELETE /v1/accounts/{accountId}/keys/{tokenId}
Revocation takes effect immediately — any further request using that token fails with 401 Unauthorized.

Using a token with the MCP

The Brokerage MCP authenticates its account role with exactly this kind of token. Mint one covering the tools you intend to expose:
Then pass the returned key and secret to your MCP client as the account role:
A token missing a scope simply means the matching tools are unavailable to that client — narrow the scopes array to narrow what the assistant can do.

Security best practices

Error responses

See Error Codes for the full list of API error responses.