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

GET /api/v1/api-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:
ScopeDescription
compute:readList and view Droplets
compute:writeCreate, update, delete Droplets
apps:readList and view Apps
apps:writeDeploy, update, delete Apps
databases:readList and view Databases
databases:writeCreate, update, delete Databases
storage:readList volumes and buckets
storage:writeCreate, modify, delete storage
admin:readView admin settings
admin:writeModify admin settings
A token with no scopes has full access (equivalent to an admin token).