API Keys Management

Create and manage multiple API keys

Create and manage multiple API keys for different environments and use cases.

List All API Keys

GET /v1/account/api-keys/

Response

{
  "api_keys": [
    {
      "id": 1,
      "name": "Production Key",
      "key_type": "production",
      "key_prefix": "ml_prod_abc1",
      "is_active": true,
      "is_primary": true,
      "created_at": "2024-01-15T10:00:00Z",
      "last_used": "2025-01-15T14:30:00Z"
    },
    {
      "id": 2,
      "name": "Development Key",
      "key_type": "sandbox",
      "key_prefix": "ml_sand_xyz7",
      "is_active": true,
      "is_primary": false,
      "created_at": "2024-02-01T09:00:00Z",
      "last_used": "2025-01-14T11:20:00Z"
    }
  ]
}

Create New API Key

POST /v1/account/api-keys/

Request Body

{
  "name": "Staging Environment",
  "key_type": "sandbox"
}

Example

curl -X POST "https://api.missinglettr.com/v1/account/api-keys/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "CI/CD Pipeline",
    "key_type": "production"
  }'

Response

{
  "id": 3,
  "name": "CI/CD Pipeline",
  "key_type": "production",
  "api_key": "ml_prod_full_key_shown_once_here",
  "message": "Save this key securely. It will not be shown again."
}

Important: The full API key is only shown once during creation. Store it securely. You cannot retrieve it later.

Update API Key

PATCH /v1/account/api-keys/{id}/

Request Body

{
  "name": "Updated Key Name",
  "is_active": false
}

Example: Deactivate a Key

curl -X PATCH "https://api.missinglettr.com/v1/account/api-keys/2/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_active": false}'

Delete API Key

DELETE /v1/account/api-keys/{id}/

Example

curl -X DELETE "https://api.missinglettr.com/v1/account/api-keys/2/" \
  -H "Authorization: Bearer YOUR_API_KEY"

Cannot Delete Primary: You cannot delete your primary API key. Create a new key, set it as primary, then delete the old one.

Key Types

  • production: Full access to all resources (use in production)
  • sandbox: Limited access, test mode (use in development)

Best Practices

  • Use separate keys for production, staging, and development
  • Rotate keys periodically for security
  • Deactivate keys instead of deleting when troubleshooting
  • Monitor last_used to identify unused keys