Skip to main content

API Reference

The Control Zero API provides programmatic access to manage projects, policies, and audit logs.

Authentication

All API requests require authentication using an organization-level API token or a project-level API key.

Organization Token

Organization tokens have access to all projects within the organization. Use these for management operations like creating projects and managing policies.

curl -H "Authorization: Bearer YOUR_ORG_TOKEN" \
https://api.controlzero.dev/v1/projects

Project API Key

Project API keys are scoped to a single project. SDKs use these to download policy bundles and submit audit logs.

curl -H "Authorization: Bearer cz_live_your_api_key_here" \
https://api.controlzero.dev/v1/projects/proj_abc123/bundle

Base URL

All API endpoints are served from:

https://api.controlzero.dev/v1

Request Format

  • All request bodies must be JSON with Content-Type: application/json.
  • All responses are JSON.
  • Timestamps are in ISO 8601 format (UTC).

Response Format

Successful responses return the requested data:

{
"id": "proj_abc123",
"name": "production-agents",
"created_at": "2026-03-01T00:00:00Z"
}

Error responses include an error code and message:

{
"error": {
"code": "not_found",
"message": "Project not found"
}
}

HTTP Status Codes

CodeDescription
200Success
201Resource created
400Bad request -- invalid parameters
401Unauthorized -- missing or invalid authentication
403Forbidden -- insufficient permissions
404Not found
429Rate limited
500Internal server error

Required Headers

HeaderRequiredDescription
X-ControlZero-Agent-IDRequiredIdentifies the agent making the call. Requests without this header are rejected with 400.
X-API-KeyRequiredControl Zero API key (czlive_ or cztest_)
X-ControlZero-Identity-TokenRecommendedJWT token for user-level principal resolution
X-ControlZero-User-IDOptionalUser ID for identity context in policy evaluation
X-ControlZero-User-GroupOptionalUser group for RBAC policy evaluation

Rate Limiting

API requests are rate limited per organization:

  • Management endpoints: 100 requests per minute
  • Policy bundle downloads: 600 requests per minute
  • Audit log submission: 1000 requests per minute

Rate limit headers are included in every response:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1709251260

Endpoints

Projects

MethodPathDescription
GET/v1/projectsList all projects
POST/v1/projectsCreate a new project
GET/v1/projects/:idGet a project by ID
PATCH/v1/projects/:idUpdate a project
DELETE/v1/projects/:idDelete a project

Policies

MethodPathDescription
GET/v1/projects/:id/policiesList policies for a project
POST/v1/projects/:id/policiesCreate a new policy
GET/v1/projects/:id/policies/:policy_idGet a policy by ID
PUT/v1/projects/:id/policies/:policy_idUpdate a policy
DELETE/v1/projects/:id/policies/:policy_idDelete a policy
POST/v1/projects/:id/policies/:policy_id/publishPublish a policy

Policy Bundles

MethodPathDescription
GET/v1/projects/:id/bundleDownload the latest policy bundle
GET/v1/projects/:id/bundle/versionGet the current bundle version

API Keys

MethodPathDescription
GET/v1/projects/:id/keysList API keys for a project
POST/v1/projects/:id/keysCreate a new API key
DELETE/v1/projects/:id/keys/:key_idRevoke an API key

Secrets (Optional)

Secrets endpoints allow programmatic management of encrypted provider keys. See Secrets Management for details.

MethodPathDescription
GET/v1/projects/:id/secretsList secrets for a project (metadata only)
POST/v1/projects/:id/secretsStore a new encrypted secret
GET/v1/projects/:id/secrets/:secret_idGet secret metadata
DELETE/v1/projects/:id/secrets/:secret_idPermanently delete a secret
note

Secret values are encrypted before storage. The POST response includes the plaintext value exactly once. Subsequent GET requests return only metadata and a masked prefix.

Audit Logs

MethodPathDescription
GET/v1/projects/:id/audit-logsList audit log entries
POST/v1/projects/:id/audit-logsSubmit audit log entries (used by SDKs)

Health

MethodPathDescription
GET/v1/healthAPI health check

Pagination

List endpoints support cursor-based pagination:

curl "https://api.controlzero.dev/v1/projects/proj_abc123/audit-logs?limit=50&cursor=eyJpZCI6MTAwfQ"
ParameterTypeDefaultDescription
limitint50Number of results per page (max 100).
cursorstring--Cursor from a previous response for the next page.

Paginated responses include a next_cursor field:

{
"data": [...],
"next_cursor": "eyJpZCI6MTUwfQ",
"has_more": true
}

SDKs

For most use cases, we recommend using the official SDKs instead of calling the API directly:

The SDKs handle authentication, policy bundle caching, and audit log submission automatically.

Note: Bundle signature verification is enforced as of SDK version 0.3.0. Ensure you are using an SDK version that includes this feature.