/api/v1/ai-agents/external/messagesKey-protected external chatbot request.
Production chatbot clients outside admin-client.
Use the OkPo API to integrate AI agents, conversations, content generation, and secure external chatbot access.
X-Agent-Key and X-Agent-Secret./api/v1/ai-agents/external/messages.conversation_token in your integration./api/v1/ai-agents/external/messages/continue.X-Conversation-Token header with each next message./api/v1/ai-agents/external/messagesKey-protected external chatbot request.
Production chatbot clients outside admin-client.
/api/v1/ai-agents/external/messages/bulkSend up to 10 independent external chat turns in one request.
Batch integrations that need a result for each external user.
/api/v1/ai-agents/external/messages/continueSend message using X-Conversation-Token header (contains conversation/session context).
Continuous conversation turns without passing conversation_id/user_id.
/api/v1/ai-agents/external/inject-contextInject a topic and/or prompt into a (new or existing) conversation and trigger an immediate assistant reply.
Constrain the agent to a subject before user input, or seed a conversation programmatically.
/api/v1/ai-agents/external/inject-context-from-postInject context derived from a published public Post (title, description, tags, meta_data, transcript) and trigger an assistant reply.
Bridge a post (e.g., article or recording) into an AI conversation as grounding context.
/api/v1/ai-agents/external/conversationsCreate a new conversation for the agent resolved from the API key and return a conversation_token.
Pre-create a session before any message turns, or to control title/metadata up-front.
/api/v1/ai-agents/external/conversations/{conversationId}/messagesAppend a user message to an existing external conversation and receive the assistant reply.
Authoritative turn-by-turn flow when you already hold a conversation_id.
/api/v1/ai-agents/external/sourcesList all knowledge sources attached to the agent resolved from the API key.
Audit or display the agent's current knowledge base.
/api/v1/ai-agents/external/sourcesCreate source via external API key.
Programmatic knowledge ingestion.
/api/v1/ai-agents/external/sources/{sourceId}Delete source via external API key.
Knowledge cleanup.
/api/v1/ai-agents/external/sources/{sourceId}Update existing source via external API key.
Knowledge source maintenance.
/api/v1/ai-agents/external/webhooksCreate webhook subscription using API key auth.
External event automation setup.
/api/v1/ai-agents/external/webhooks/{webhookId}Delete webhook via API key auth.
Webhook decommissioning.
/api/v1/ai-agents/external/webhooks/{webhookId}/deliveries?limit=50List recent delivery attempts for a webhook.
Troubleshooting webhook failures.
/api/v1/ai-agents/external/webhooksList webhook subscriptions via API key auth.
Webhook management dashboards.
/api/v1/ai-agents/external/webhooks/{webhookId}/testTrigger webhook test delivery via API key auth.
Integration validation.
/api/v1/ai-agents/external/webhooks/{webhookId}Update webhook via API key auth.
Webhook reconfiguration.
Error code reference
Use these codes to quickly identify what failed and what to fix.
| Error code | What happened | What to do |
|---|---|---|
| AI_AGENT_NOT_FOUND | AI agent does not exist or is outside caller scope. | Check agent_id and account ownership. |
| AI_AGENT_FORBIDDEN | Caller lacks permission for the agent. | Use owner/admin credentials. |
| API_KEY_CONFLICT | API key conflicts with an existing one. | Use unique key name or rotate existing key. |
| API_KEY_CREATE_FAILED | Backend failed to create API key. | Retry; if persistent, check server logs. |
| WEBHOOK_VALIDATION_FAILED | Webhook payload/settings are invalid. | Fix URL, events, timeout values. |
| WEBHOOK_CREATE_FAILED | Webhook creation failed internally. | Retry and verify backend/database health. |
| WEBHOOK_NOT_FOUND | Webhook id not found for agent. | Verify webhook_id and agent_id. |
| WEBHOOK_TEST_FAILED | Webhook test delivery failed. | Ensure target URL is reachable and returns 2xx. |
| CONVERSATION_NOT_FOUND | Conversation id does not exist or mismatches agent. | Check conversation_id. |
| CONVERSATION_FORBIDDEN | Caller is not authorized on conversation. | Use conversation owner/admin token. |
| MESSAGE_VALIDATION_FAILED | Message payload failed validation. | Fix content length/shape. |
| MESSAGE_SEND_FAILED | Message send/generation failed. | Retry and check provider/model configuration. |
| EXTERNAL_AUTH_FAILED | External auth headers invalid. | Send valid X-Agent-Key and X-Agent-Secret. |
| EXTERNAL_MESSAGE_VALIDATION_FAILED | External message payload invalid. | Fix content/history/image_urls. |
| EXTERNAL_MESSAGE_SEND_FAILED | External send failed. | Retry and check backend/provider status. |
| PUBLIC_AGENT_NOT_FOUND | Public slug does not map to an agent. | Check slug value. |
| PUBLIC_AGENT_DISABLED | Agent exists but public mode is disabled. | Enable public visibility/publish state. |
| PUBLIC_MESSAGE_VALIDATION_FAILED | Public message payload invalid. | Fix content format/length. |
| PUBLIC_MESSAGE_SEND_FAILED | Public message generation failed. | Retry and inspect service logs. |
Event names
conversation.created, message.received, message.generated, recording.processed, disposition.decided, webhook.test.
Signing
Webhook deliveries are signed with your webhook signing secret (HMAC). Keep this secret server-side only and verify signatures before trusting payloads.
External auth
External endpoints require X-Agent-Key + X-Agent-Secret on every request.