Service accounts
Service accounts API methods, requests, and responses for RawTree Cloud and RawTree BYOC.
Service accounts
All service-account methods require an organization administrator. Deletion requires a first-party session.
Create identities for automated workloads. A service account is not a credential. Assign an API key or federation rule to its ID to authenticate as that account.
GET /v1/organizations/{organization_id}/service-accounts
List service accounts. Requires an organization administrator..
Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.
Request:
# List service accounts. Requires an organization administrator.
curl -X GET "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/service-accounts" \
-H "Authorization: Bearer $RAWTREE_USER_TOKEN"Expected response: HTTP 200.
[
{
"id": "11111111-1111-4111-8111-111111111111",
"organization_id": "22222222-2222-4222-8222-222222222222",
"name": "event-worker",
"description": null,
"role": "member"
}
]Errors: 401, 403. See API errors.
POST /v1/organizations/{organization_id}/service-accounts
Create a service account. The name cannot be changed after creation..
Use a user session or user OAuth token with full_access. API keys and workload tokens cannot use this method.
Parameters:
| Field | Location | Type | Required | Notes |
|---|---|---|---|---|
name | body | string | Yes | Lowercase letters and digits separated by single hyphens; 1–128 characters. |
description | body | string or null | No | Optional description, up to 2000 UTF-8 bytes. |
role | body | ServiceAccountRole | No | — |
Request:
# Create a service account. The name cannot be changed after creation.
curl -X POST "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/service-accounts" \
-H "Authorization: Bearer $RAWTREE_USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "event-worker",
"role": "member"
}'Expected response: HTTP 200.
{
"id": "11111111-1111-4111-8111-111111111111",
"organization_id": "22222222-2222-4222-8222-222222222222",
"name": "event-worker",
"description": null,
"role": "member"
}Errors: 401, 403. See API errors.
DELETE /v1/organizations/{organization_id}/service-accounts/{id}
Delete a service account from this organization..
Use a first-party user session. User OAuth, API keys, and workload tokens cannot delete a service account.
Request:
# Delete a service account from this organization.
curl -X DELETE "https://api.rawtree.com/v1/organizations/22222222-2222-4222-8222-222222222222/service-accounts/11111111-1111-4111-8111-111111111111" \
-H "Authorization: Bearer $RAWTREE_SESSION_TOKEN"Expected response: HTTP 200.
nullErrors: 401, 403. See API errors.