DocsAuthentication

Authentication

Every API request to Modexia requires authentication to authorize spending and manage your multi-party computation wallet. We support two methods: Header Keys and JWT Tokens.

Option 1: API Key

Pass your Modexia API key in the x-modexia-key header. This is the simplest and recommended method for server-side code, scripts, and autonomous Python AI agents.

bash
curl https://api.modexia.software/api/v1/user/me \
  -H "x-modexia-key: mx_test_abc123..."

Option 2: Bearer Token

Pass a JWT in the Authorization header. This method is utilized internally by the Modexia dashboard and web applications authenticating directly to the Gateway securely.

bash
curl https://api.modexia.software/api/v1/user/me \
  -H "Authorization: Bearer eyJhbGciOi..."

Key Prefixes & Environments

The prefix of your API key explicitly defines which environment your agent connects to. Keys cannot cross environment boundaries.

PrefixEnvironment
mx_test_Sandbox — Connected to testnet networks. Faucet USDC. Safe for development. Real money is not involved.
mx_live_Production — Connected to mainnet networks. Real USDC. Transactions are final.

Secure your API Key

Your API key has access to the funds in your agent wallet across all environments. Never expose your key in client-side code (browsers or mobile apps) or log it to an external server. If compromised, rotate it immediately from the API Keys tab in the dashboard.