API Reference
API Keys
Create and manage API keys for authenticating requests. All API keys are prefixed with un_ for easy identification.
POST
/v1/api-keysCreate an API Key
Create a new API key. The full key is only returned once during creation.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Required | A descriptive name for the key |
cURL
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
201 Created
{
"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.
GET
/v1/api-keysList API Keys
Get a list of all API keys. Only shows key prefix for security.
cURL
curl https://www.unosend.co/api/v1/api-keys \
-H "Authorization: Bearer un_your_api_key"Response
200 OK
{
"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
}
]
}DELETE
/v1/api-keys/:idRevoke an API Key
Revoke an API key. Requests using this key will fail immediately.
cURL
curl -X DELETE https://www.unosend.co/api/v1/api-keys/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer un_your_api_key"Warning: This action cannot be undone. Any applications using this key will stop working.