Create an API Key
POST/v1/api-keys
Create a new API key. The full key is only returned once during creation.
Request Body
A descriptive name for the key
curl -X POST https://www.unosend.co/api/v1/api-keys \
-H "Authorization: Bearer un_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Server"
}'
Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production Server",
"key": "un_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"key_prefix": "un_live_xxxx",
"created_at": "2024-01-15T10:30:00.000Z"
}
Important: The full API key is only returned once during creation. Store it securely - it cannot be retrieved again.
List API Keys
GET/v1/api-keys
Get a list of all API keys. Only shows key prefix for security.
curl https://www.unosend.co/api/v1/api-keys \
-H "Authorization: Bearer un_your_api_key"
Response
{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production Server",
"key_prefix": "un_live_xxxx",
"created_at": "2024-01-15T10:30:00.000Z",
"last_used_at": "2024-01-20T14:30:00.000Z",
"revoked_at": null
}
]
}
Revoke an API Key
DELETE/v1/api-keys/:id
Revoke an API key. Requests using this key will fail immediately.
curl -X DELETE https://www.unosend.co/api/v1/api-keys/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer un_your_api_key"
This action cannot be undone. Any applications using this key will stop working.