API Keys
Endpoints for requesting, verifying, and managing API keys.
Request Verification Code
Request a verification code to be sent to your email.
Email address to send verification code to
curl -X POST https://api.treeship.dev/v1/keys/request \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com"}'
Response
{
"message": "Verification code sent to you@example.com",
"expires_in": 600
}
| Field | Type | Description |
|---|
message | string | Confirmation message |
expires_in | integer | Seconds until code expires |
Verify Code and Get Key
Submit the verification code to receive your API key.
Email address used in the request
6-digit verification code from email
curl -X POST https://api.treeship.dev/v1/keys/verify \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "code": "123456"}'
Response
{
"api_key": "ts_live_a1b2c3d4e5f6g7h8i9j0...",
"key_id": "key_abc123def456",
"created_at": "2026-02-23T10:00:00.000Z"
}
| Field | Type | Description |
|---|
api_key | string | Your API key (only shown once) |
key_id | string | Key identifier for reference |
created_at | string | ISO 8601 timestamp |
The API key is only returned once. Save it immediately.
Get Key Info
Get information about your current API key.
Authentication: Required
curl https://api.treeship.dev/v1/keys/info \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"key_id": "key_abc123def456",
"email": "you@example.com",
"created_at": "2026-02-23T10:00:00.000Z",
"attestations_today": 42,
"rate_limit": 1000
}
| Field | Type | Description |
|---|
key_id | string | Key identifier |
email | string | Email associated with key |
created_at | string | When key was created |
attestations_today | integer | Attestations created today |
rate_limit | integer | Daily attestation limit |
Revoke Key
Permanently revoke an API key. This cannot be undone.
Authentication: Required
curl -X DELETE https://api.treeship.dev/v1/keys \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"message": "API key revoked successfully"
}
Revoked keys cannot be reactivated. You’ll need to create a new key.
Error Responses
Invalid Verification Code
{
"detail": "Invalid or expired verification code"
}
Status: 400
Code Expired
{
"detail": "Verification code has expired. Request a new one."
}
Status: 400
Invalid API Key
{
"detail": "Invalid API key"
}
Status: 401