Skip to main content

API keys

API keys authenticate your requests to the Context API. You can create and manage them directly from the app.

Getting an API key

  1. Go to testnet.context.markets
  2. Navigate to Profile → Settings
  3. Create a new API key
Your key will be shown once — copy it and store it securely.

Key concepts

API keys are not tied to wallets

An API key is an authentication credential for the API, separate from your trading wallet. You can use the same API key with any private key for signing orders. This means you can:
  • Rotate your signing wallet without getting a new API key
  • Use multiple wallets with a single API key
  • Share API access across different bots or scripts, each with their own signer

Market creation permission

By default, API keys can read market data and place orders. To create markets, your key needs the can_create_markets permission enabled by an admin. To request market creation access, reach out to @context on X.

Usage

Pass your API key as a Bearer token in the Authorization header:
Authorization: Bearer your-api-key
Or configure it in the SDK:
import { ContextClient } from "@contextwtf/sdk"

const ctx = new ContextClient({
  apiKey: process.env.CONTEXT_API_KEY!,
  signer: { privateKey: process.env.PRIVATE_KEY! as `0x${string}` },
})
Never commit API keys to source control. Use environment variables or a secrets manager.

Next steps