Authentication
The API uses bearer tokens. Tokens are scoped, expire and can be limited to a network.
Using a token
Send the token in the Authorization header on every request. There is no cookie or session authentication on the API.
curl -s https://api.ansiblecloud.io/v1/account \
-H "Authorization: Bearer $ACLOUD_TOKEN"
{
"id": "acct_01H8Y2Q7X9M4T0RKA6BZNV3WPE",
"name": "your-company",
"plan": "runbooks-team",
"created_at": "2025-09-02T15:21:07Z"
}
A token looks like acl_k3f9d2hx_.... The first part is a fixed prefix so that secret scanners can recognize it. The eight characters after it are a public identifier that appears in the console and in audit events. The rest is the secret. We store only a hash, so we cannot show it to you again.
Scopes
| Scope | Allows |
|---|---|
servers:read | List and read servers, sites, plans and SSH keys |
servers:write | Create and delete servers, run power actions, open the console, manage SSH keys |
runbooks:read | List runbooks, read jobs and job events |
runbooks:launch | Launch and cancel jobs |
images:write | Build and delete images (read access comes with servers:read) |
inventories:write | Sync and modify inventories |
tokens:admin | List, create and revoke tokens |
billing:read | Read usage and invoices |
A call that needs a scope the token does not have returns 403:
{
"error": {
"code": "insufficient_scope",
"message": "This token needs the runbooks:launch scope.",
"required_scope": "runbooks:launch",
"request_id": "req_01JC7V4D5K8ZQ2N9X0WMT3AB6R"
}
}
Expiry
Every token expires. The default is 90 days and the maximum is 365. Expired tokens return 401 with "code": "token_expired". The CLI prints a warning when a token has under 14 days left.
Network restrictions
Add allowed_cidrs when you create a token, and requests from other addresses are rejected with 403 and "code": "address_not_allowed". Use this for CI runners and for anything that runs from a fixed place.
$ acloud token create --name ci-deploy \
--scope servers:read --scope runbooks:launch \
--expires 90d --allow-cidr 203.0.113.0/24
Creating tokens
Tokens are created in the console, with acloud token create or with the API. Creating a token requires tokens:admin, and a token cannot grant scopes that it does not itself have.
curl -s -X POST https://api.ansiblecloud.io/v1/tokens \
-H "Authorization: Bearer $ACLOUD_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"ci-deploy","scopes":["servers:read","runbooks:launch"],"expires_in_days":90,"allowed_cidrs":["203.0.113.0/24"]}'
{
"id": "tok_01JC7R8M2QX4N0T6B9WVKA3DEH",
"name": "ci-deploy",
"scopes": ["servers:read", "runbooks:launch"],
"allowed_cidrs": ["203.0.113.0/24"],
"created_at": "2026-08-20T14:03:55Z",
"expires_at": "2026-11-18T14:03:55Z",
"secret": "acl_k3f9d2hx_9Zq4WmT1pLr7aVbN0cE5uYgS8oXjH6dK"
}
The secret field appears only in this response.
Rotating tokens
- Create the new token with the same scopes.
- Deploy it.
- Look at
last_used_atandlast_used_ipon the old token (GET /v1/tokens) to confirm that nothing is still using it. - Revoke the old token with
DELETE /v1/tokens/{id}oracloud token revoke.
Retired tokens
Legacy unscoped tokens (created before October 2026) stopped working on November 16, 2026. They return 401 with "code": "token_retired". Create a scoped token to replace them.
Verifying webhooks
Webhook requests carry an X-Acloud-Signature header of the form t=<unix timestamp>,v1=<hex digest>. The digest is an HMAC-SHA256 of the string <timestamp>.<raw request body> using the webhook's signing secret. Reject requests whose timestamp is more than five minutes old.
import hashlib, hmac, time
def verify(secret: bytes, header: str, body: bytes) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > 300:
return False
signed = parts["t"].encode() + b"." + body
expected = hmac.new(secret, signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])