POST/api/v1/mcp/api-keys
Create a new MCP API key
Issue a new MCP API key. The plaintext value (`key_plaintext`) is included in the 201 response body and shown to the user once. It is HMAC-SHA256 hashed server-side with a secret pepper before persistence; the plaintext is never logged, mailed, or stored anywhere else. Tier enforcement: - free → 403 (cannot create MCP keys) - founding/pro → up to 5 active keys, 1000 req/min - performance → up to 10 active keys, 10000 req/min - team → up to 20 active keys, 10000 req/min
Authentication
This endpoint requires the X-API-Key header or a valid Clerk JWT. Accepted schemes: APIKeyHeader, HTTPBearer.
See Authentication for details.
Request body
Required. Format: application/json, schema: MCPApiKeyCreateRequest
Responses
| Status | Description | Schema |
|---|---|---|
201 | Key created. Full secret returned ONCE - never retrievable again. | MCPApiKeyCreatedResponse |
401 | Missing or invalid authentication. | - |
403 | Current tier does not allow MCP API keys (upgrade required). | - |
409 | Per-tier active key limit reached. Revoke an existing key first. | - |
422 | Validation Error | HTTPValidationError |
503 | MCP_API_KEY_PEPPER environment variable not configured. | - |
See the standard error codes documented in the Error codes.
Code samples
Three ready-to-paste implementations. Replace $TRINITY_API_KEY with your API key (generated from the dashboard under Profile → API keys).
cURL
curl -X POST \
'https://api.trinityinsights.io/api/v1/mcp/api-keys' \
-H 'X-API-Key: $TRINITY_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'Python
import os
import requests
BASE = "https://api.trinityinsights.io"
headers = {
"X-API-Key": os.environ["TRINITY_API_KEY"],
}
response = requests.post(f"{BASE}/api/v1/mcp/api-keys", headers=headers, json={}, timeout=10)
response.raise_for_status()
data = response.json()JavaScript
const apiKey = process.env.TRINITY_API_KEY;
const response = await fetch(
"https://api.trinityinsights.io/api/v1/mcp/api-keys",
{
method: "POST",
headers: {
"X-API-Key": apiKey,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
},
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();Institutional disclaimer
Trinity Insights is an educational and analytical tool. Values returned by this endpoint do not constitute investment advice. Trinity Insights is not a Crypto-Asset Service Provider (CASP) registered under MiCA Regulation (EU) 2023/1114. See the full disclaimer.