Authentication
Uncloud uses bearer token authentication for API access. Create API tokens from the dashboard or API, then include them in your requests.
Using Tokens
Include the token in the Authorization header:
curl -H "Authorization: Bearer dkc_your_token_here" \
http://localhost:8080/api/v1/droplets
Create a Token
curl -X POST http://localhost:8080/api/v1/api-tokens \
-H "Content-Type: application/json" \
-d '{
"name": "my-deploy-token",
"scopes": ["apps:read", "apps:write"]
}'
Response:
{
"id": "tok_a1b2c3d4",
"name": "my-deploy-token",
"token": "dkc_live_abc123...",
"scopes": ["apps:read", "apps:write"],
"created_at": "2024-01-15T10:30:00Z"
}
The token field is only returned once at creation time. Store it securely — it cannot be retrieved again.
List Tokens
Response:
[
{
"id": "tok_a1b2c3d4",
"name": "my-deploy-token",
"scopes": ["apps:read", "apps:write"],
"last_used_at": "2024-01-20T15:00:00Z",
"created_at": "2024-01-15T10:30:00Z"
}
]
Revoke a Token
DELETE /api/v1/api-tokens/{id}
The token is immediately invalidated and cannot be used for further requests.
Token Scopes
Scopes restrict what a token can do:
| Scope | Description |
|---|
compute:read | List and view Droplets |
compute:write | Create, update, delete Droplets |
apps:read | List and view Apps |
apps:write | Deploy, update, delete Apps |
databases:read | List and view Databases |
databases:write | Create, update, delete Databases |
storage:read | List volumes and buckets |
storage:write | Create, modify, delete storage |
admin:read | View admin settings |
admin:write | Modify admin settings |
A token with no scopes has full access (equivalent to an admin token).