API Reference
Complete reference for the Carabid API.
Overview
All API requests are made over HTTPS. The base URL for all endpoints is:
Responses are always JSON. Request bodies must be JSON with Content-Type: application/json.
Authentication
Protected endpoints require an API key. Pass it in one of two ways:
Authorization: Bearer sk_your_api_key
GET /api/v1/hello?api_key=sk_your_api_key
API keys start with sk_ and are generated on registration. You can create and manage keys from your dashboard.
429 Too Many Requests.
Errors
Errors return a JSON object with an error field describing the problem.
{
"error": "Invalid API key."
}
Auth
Creates a new user account. Returns an API key automatically — no separate key creation step required.
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Valid email address | |
| password | string | required | Min. 8 characters |
curl -X POST https://api.carabid.ai/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"yourpassword"}'
{
"message": "Account created.",
"api_key": "sk_a1b2c3..."
}
Returns a session token used to manage API keys. Pass it as Authorization: Bearer <token> on key management requests.
| Name | Type | Required | Description |
|---|---|---|---|
| string | required | Account email | |
| password | string | required | Account password |
curl -X POST https://api.carabid.ai/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"you@example.com","password":"yourpassword"}'
{
"token": "eyJ...",
"email": "you@example.com"
}
Returns all API keys for the authenticated user.
/auth/logincurl https://api.carabid.ai/auth/keys \
-H "Authorization: Bearer <session_token>"
{
"keys": [
{
"id": 1,
"name": "default",
"key": "sk_a1b2c3...",
"created_at": "2026-03-25 03:00:00",
"last_used": "2026-03-25 04:00:00"
}
]
}
Creates a new API key for the authenticated user. Maximum 10 keys per account.
/auth/login| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Label for the key. Defaults to "default" |
curl -X POST https://api.carabid.ai/auth/keys \
-H "Authorization: Bearer <session_token>" \
-H "Content-Type: application/json" \
-d '{"name":"production"}'
{
"key": "sk_a1b2c3...",
"name": "production"
}
Permanently deletes an API key. Any requests using this key will immediately return 401.
/auth/login| Name | Type | Description |
|---|---|---|
| id | integer | Key ID from GET /auth/keys |
curl -X DELETE https://api.carabid.ai/auth/keys/1 \
-H "Authorization: Bearer <session_token>"
{ "message": "Key deleted." }
Test
A simple endpoint to verify your API key is working.
| Name | Type | Required | Description |
|---|---|---|---|
| arg | string | optional | Value appended to the response message |
curl "https://api.carabid.ai/api/v1/hello?arg=world" \
-H "Authorization: Bearer sk_your_key"
{ "message": "Hello World: world" }
Policies
{ "policies": [ { "id": 1, "name": "GDPR", "created_at": "...", "extraction_count": 2, "last_extracted": "..." } ] }
{ "policy": { "id": 1, "name": "...", "text": "..." }, "extractions": [ ... ] }
{ "name": "GDPR", "text": "Full policy document text..." }
{ "id": 1, "name": "GDPR" }
curl -X POST https://api.carabid.ai/api/v1/policies \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"name":"GDPR","text":"The data subject shall have the right..."}'
{ "name": "GDPR v2", "text": "Updated policy text..." }
{ "message": "Policy deleted." }
{ "openai_api_key": "sk-...", "organization": "Acme Corp" }
{ "extraction_id": 5, "organization": "Acme Corp", "circuit_count": 3, "circuits": [ ... ] }
curl -X POST https://api.carabid.ai/api/v1/policies/1/extract \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"openai_api_key":"sk-openai-...","organization":"Acme Corp"}'
{ "id": 5, "organization": "...", "circuit_count": 3, "circuits": [ ... ] }
Data Tagging
{ "extraction_id": 5, "data_text": "User foo@example.com requested access to /admin...", "openai_api_key": "sk-..." }
{
"organization": "Acme Corp",
"predicate_count": 8,
"tags": [ { "predicate": "is_authorized_user", "value": false }, ... ],
"circuit_results": [ { "action": "access_data", "is_safe": false, "violated_rules": ["G(access_data -> is_authorized_user)"], "safety_score": 0.0 }, ... ]
}
curl -X POST https://api.carabid.ai/api/v1/tag \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"extraction_id":5,"data_text":"User accessed admin panel without MFA","openai_api_key":"sk-openai-..."}'
Runs the full ShieldAgent pipeline against the policy circuits from a saved extraction. Returns ALLOW or BLOCK along with any violated LTL rules and an explanation.
{
"extraction_id": 5,
"tool": "send_email",
"args": { "to": "ceo@example.com", "body": "Confidential report attached." },
"goal_summary": "The agent is summarizing Q3 earnings and sending a report to stakeholders.",
"openai_api_key": "sk-...",
"prior_actions": [],
"session_id": "session-abc"
}
{
"organization": "Acme Corp",
"tool": "send_email",
"decision": "ALLOW",
"explanation": "The action complies with all policy predicates.",
"violated_rules": [],
"modified_args": null
}
{
"organization": "Acme Corp",
"tool": "send_email",
"decision": "BLOCK",
"explanation": "The action violates data exfiltration rules: email recipient is external and content is marked confidential.",
"violated_rules": ["G(send_email -> is_authorized_recipient)", "F(confidential_data -> !external_recipient)"],
"modified_args": null
}
curl -X POST https://api.carabid.ai/api/v1/verify \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{
"extraction_id": 5,
"tool": "send_email",
"args": {"to":"external@company.com","body":"Attached: confidential report"},
"goal_summary": "Agent summarizing and distributing Q3 earnings.",
"openai_api_key": "sk-openai-..."
}'