Skip to main content

API Keys

Endpoints for requesting, verifying, and managing API keys.

Request Verification Code

Request a verification code to be sent to your email.
email
string
required
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
}
FieldTypeDescription
messagestringConfirmation message
expires_inintegerSeconds until code expires

Verify Code and Get Key

Submit the verification code to receive your API key.
email
string
required
Email address used in the request
code
string
required
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"
}
FieldTypeDescription
api_keystringYour API key (only shown once)
key_idstringKey identifier for reference
created_atstringISO 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
}
FieldTypeDescription
key_idstringKey identifier
emailstringEmail associated with key
created_atstringWhen key was created
attestations_todayintegerAttestations created today
rate_limitintegerDaily 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