Provision customer spaces
Create or reuse a Clero space and install approved agent templates from your backend.
Connect partner backends, provision customer workspaces, install agent templates, and send messages into Clero automation agents with stable server-side credentials.
Base URL
v1https://clero.so/api/v1Overview
The public API is designed for backend-to-backend integrations. Keep tokens on your server, use stable external identifiers for retries, and let Clero handle agent runtime work inside each space.
Create or reuse a Clero space and install approved agent templates from your backend.
Discover spaces and agents, then create API chat sources for selected automation agents.
Thread messages by session_id, dedupe by external_message_id, then poll or receive replies.
Quick start
Most partner integrations follow the same path: authenticate, locate or provision a workspace, connect an API chat source, then send messages with a durable session key.
Generate a token in the organization admin surface and scope it to the minimum permissions required.
Authorization: Bearer <PARTNER_TOKEN>List spaces for existing customers or use external_space_id to create/reuse a customer workspace.
GET /automation/spaces/ or POST /automation/agent-templates/provision-space/Create or reuse the source that accepts messages for a specific agent.
POST /automation/spaces/<SPACE_ID>/agents/<AGENT_ID>/api-chat/Use source_id, session_id, and external_message_id so conversations thread correctly and retries stay safe.
POST /integrations/api-chat/message/Authentication
Send partner tokens in the Authorization header. Scope each token to the permissions the integration actually needs, then restrict it with IP allowlists when production egress IPs are stable.
Partner token values are shown once during creation. Store them in your backend secret manager and never expose them to browser clients.
Grant only the scopes needed for the integration, such as spaces.read, agents.read, cron_jobs.write, or API chat setup/runtime scopes.
An empty allowed_ip_cidrs list allows any caller IP. In production, restrict tokens to known partner egress IPs or CIDR ranges when possible.
Public API calls require at least $1 USD in organization pay-as-you-go balance. Low-balance calls return 402 and are not processed.
Use the same header on read, write, setup, and runtime calls.
curl -sS "https://clero.so/api/v1/automation/spaces/" \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Accept: application/json"Resources
Use this map to understand the surface area quickly. The OpenAPI files remain the source of truth for exact request and response schemas.
Create customer workspaces, list accessible spaces, and install approved agent templates.
/automation/spaces/List spaces available to the partner token.
/automation/agent-templates/provision-space/Create or reuse a space and install agent templates.
Discover existing agents inside a space before creating runtime integrations.
/automation/spaces/<SPACE_ID>/agents/List space-scoped agents and their public integration metadata.
/automation/spaces/<SPACE_ID>/agents/<AGENT_ID>/api-chat/Create or reuse an API chat source for an existing agent.
Send messages into Clero and retrieve assistant output after processing completes.
/integrations/api-chat/message/Register an inbound message for a source and session.
/integrations/api-chat/history/Poll session history and assistant replies after a message cursor.
Upload documents or file attachments, then reference returned identifiers from agent workflows.
/automation/documents/Upload or create document resources for automation workflows.
/automation/file-attachments/Upload file attachments through multipart requests.
Schedule recurring work for a selected agent and retain returned job ids for support.
/automation/partner-cron-jobs/Create a scheduled automation job for an existing agent.
/automation/partner-cron-jobs/Review scheduled jobs available to the partner token.
Runtime
API chat registers inbound messages immediately. Assistant replies are delivered later through polling or configured webhooks, which keeps request latency predictable.
The message endpoint acknowledges registration and returns the internal message id.
The source routing mode decides whether the message enters an agent inbox or launches an independent session workflow.
Poll history with after_message_id or use configured webhooks to receive completed assistant messages.
Use source_id plus session_id to preserve conversation context.
curl -sS "https://clero.so/api/v1/integrations/api-chat/message/" \
-X POST \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"source_id": "<API_CHAT_SOURCE_ID>",
"session_id": "customer-123",
"text": "Can you check the latest booking details?",
"external_message_id": "msg-123",
"response_mode": "accepted"
}'Examples
These snippets use placeholder values by design. Keep real partner tokens, API chat tokens, and customer identifiers out of browser code.
Discover existing Clero spaces available to this organization token.
curl -sS "https://clero.so/api/v1/automation/spaces/" \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Accept: application/json"Discover existing agents inside a selected Clero space.
curl -sS "https://clero.so/api/v1/automation/spaces/<SPACE_ID>/agents/" \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Accept: application/json"Create the API chat source used to send messages to an existing agent.
curl -sS "https://clero.so/api/v1/automation/spaces/<SPACE_ID>/agents/<AGENT_ID>/api-chat/" \
-X POST \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer API Chat",
"reply_capable": true,
"routing_mode": "agent_inbox"
}'Create or reuse a space, then install one or more approved agent templates.
curl -sS "https://clero.so/api/v1/automation/agent-templates/provision-space/" \
-X POST \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"external_space_id": "customer-123",
"space": {
"name": "Customer workspace",
"description": "Workspace created by partner backend",
"is_org_wide": true
},
"agents": [
{
"template_id": "<TEMPLATE_ID>",
"name": "Customer agent",
"auto_create_api_chat": true,
"api_chat_routing_mode": "agent_inbox"
}
]
}'Schedule recurring work on an existing agent.
curl -sS "https://clero.so/api/v1/automation/partner-cron-jobs/" \
-X POST \
-H "Authorization: Bearer <PARTNER_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "<AGENT_ID>",
"name": "Daily partner sync",
"instructions": "Review new documents and summarize open risks.",
"schedule": {
"type": "cron",
"data": {
"minute": "0",
"hour": "9",
"day_of_week": "1-5"
},
"timezone": "UTC"
}
}'Reliability
The integration should be safe to retry where the API exposes an external identifier. Store Clero identifiers returned by successful calls and use backoff for retryable failures.
Space provisioning
external_space_id
Pass the same external_space_id for retries so repeated requests reuse the existing customer workspace.
API chat messages
external_message_id
Use a stable external_message_id per source/session message. Retrying the same id returns the existing message instead of creating a duplicate.
Polling history
after_message_id
Use the internal message_id returned by the API as a cursor when polling for new assistant replies.
Rate limits
429 / Retry-After
Respect Retry-After when present. Otherwise use exponential backoff and avoid repeated non-idempotent creation calls.
Minimum balance
402 / organization_balance_too_low
Top up the organization balance before retrying. Low-balance API calls are rejected before messages, sessions, files, or jobs are processed.
Cron job creation
returned cron job id
Store the returned job id. Do not blindly retry cron job creation unless your backend adds its own dedupe guard.
Reference
Use the Markdown guide for humans, the llms files for AI coding agents, and OpenAPI for schema validation or SDK generation.
Human-readable endpoint guide for the latest public API version.
Small index file for agents that need to discover API docs quickly.
Complete plain-text API reference optimized for AI coding agents.
Machine-readable schema for SDK generators and validators.
YAML schema for review, import, and local tooling.
Q&A
Practical answers for production backends, message threading, and credential handling.
Use external_space_id when creating or reusing a space with agent templates. Retrying with the same external_space_id reuses the existing space instead of creating another customer workspace.
Use external_message_id when sending API chat messages. Retrying the same external_message_id in the same API chat session returns the existing message with created=false.
Creating API chat for an existing agent is safe to repeat. Clero reuses the auto-managed API chat source for that agent instead of creating duplicate sources.
Cron job creation is not an idempotent POST today. Store the returned cron job id and avoid blind retries unless your backend guards the request.
No. For public API usage, create or reuse an API chat source for the agent, then send messages to /integrations/api-chat/message/.
This keeps runtime messaging consistent across inbox mode, workflow mode, history polling, webhooks, and file attachments.
Use agent_inbox when the agent should behave like one inbox worker and can process multiple related messages in the same thread.
Use session_workflow when every API chat message should start an independent workflow run through an auto-managed trigger.
Store your own external_space_id, Clero space_id, agent_id, API chat source_id, cron job id, and the internal message_id returned by API chat.
Keep external_message_id in your own request log so failed network calls can be retried without creating duplicate chat messages.
Treat API chat tokens and partner tokens as backend secrets. Never expose them in browser code.
Retry network errors and 5xx responses with the same idempotency identifiers. For 429 responses, respect Retry-After when it is present and use exponential backoff.
Do not retry non-idempotent creation calls repeatedly unless your backend has its own dedupe key or stores the result from the first successful request.
Public API calls are rejected with 402 and code organization_balance_too_low.
Top up the organization balance before retrying; do not keep retrying low-balance 402 responses.
Yes. Use /docs/api/latest/llms.txt for discovery, /docs/api/latest/llms-full.txt for the full plain-text guide, and /docs/api/latest/openapi.json for schemas.
The public page and docs intentionally use the PARTNER_TOKEN placeholder and do not require a logged-in Clero session.
An empty IP allowlist means the token can be used from any caller IP. A non-empty allowlist restricts that token to the configured public egress IPs or CIDR ranges.
For production partner backends, configure allowed_ip_cidrs when the partner has stable outbound IPs.