Skip to content

Test and expected result

Example IDs and text are placeholders. Create a conversation using a real conversationUserId, then use the returned id in the message URL. The bundled OpenAPI spec documents 201 for both operations; the message response includes id, message, conversationId, senderRole, source, and createdAt. A 403 indicates an invalid key; 429 indicates a rate limit; 500 indicates a processing error. Check the operation schema before retrying. Keep API keys in your backend and generate them in raia CX.

Developer Hub · API

raia API — Developer Guide

The raia REST API lets you create users, start conversations, send messages, manage agents and knowledge, and pull usage data from your own applications. This guide walks through the common workflows and includes a bundled endpoint reference; the live spec lists the complete set of current operations.

Interactive guide

Full API explorer

Browse the bundled endpoints, schemas and code samples, and try live requests with your own key.

Open guide

Swagger

Swagger UI

The published reference served by the platform; check it for current operations.

Open Swagger

Spec

OpenAPI JSON

Generate typed clients in any language from the raw spec.

View openapi.json
01

Base URLs

Every path below is relative to a regional base URL. Use the region your agent runs in — keys are not shared across regions.

RegionBase URL
United Stateshttps://api.raia2.com
Europehttps://api-eu.raia2.com
02

Authentication

The API uses secret keys sent as request headers — not bearer tokens. Which header you send determines what you are allowed to do.

HeaderScopeTypical use
Agent-Secret-KeyA single agentConversations, messages, prompts, agent files, usage and limits for that agent.
Organization-Secret-KeyOne organizationCreate and configure agents, functions, packs, API keys, live chat and platform users.
http
Agent-Secret-Key: {your-agent-secret-key}

Keep keys server-side

Secret keys grant full access within their scope. Never ship them in browser or mobile code — call the API from your own backend, and rotate keys from raia CX if one is ever exposed.
03

Quick start

The most common flow is three calls: create (or find) a user, open a conversation, then send messages to it.

1. Create a user — POST /external/users

json
{
  "email": "jane@example.com",
  "firstName": "Jane",
  "lastName": "Doe"
}

2. Create a conversation

Example: replace the sample conversationUserId with an existing conversation user ID. These requests create real conversations and messages.

bash
curl -X POST https://api.raia2.com/external/conversations \
  -H "Agent-Secret-Key: $RAIA_AGENT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "conversationUserId": "5f7b1b3b-3b3b-4b3b-3b3b-3b3b3b3b3b3b" }'

3. Send a message and read the reply

bash
curl -X POST https://api.raia2.com/external/conversations/{id}/messages \
  -H "Agent-Secret-Key: $RAIA_AGENT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "How do I reset my password?",
    "context": "User is on the login page."
  }'

Synchronous or async

POST .../messages waits for the agent’s answer. For long-running work, call POST .../messages/async and poll GET .../messages/{questionMessageId}/response-on. The same pattern exists for prompts.
04

Endpoint reference

Use this snapshot of 97 Agent/Organization operations to choose a resource and inspect its contract. It is based on the official OpenAPI reference, with privileged platform operations outside this customer scope. Open the published specification for later changes.

Use these examples in a trusted development terminal or on your backend. Set RAIA_AGENT_SECRET_KEY for agent reads and RAIA_ORGANIZATION_SECRET_KEY for organization requests. Keep the keys out of browser and mobile code. Send the named secret-key header shown in each example. Set each ID variable to the returned record ID before its detail request. Example responses in the explorer illustrate the schema; they are not live results.

Find an agent knowledge file

Use Agent-Secret-Key to locate a file belonging to your agent. Start at zero-based page=0; pageSize accepts 1–100 files. The example sorts newest first using orderBy=createdAt and orderDirection=DESC. Read data, currentPage and hasNextPage; increment the page and continue only while hasNextPage is true.

bash
curl --request GET "https://api.raia2.com/external/agent-files/by-api-key/paginated?page=0&pageSize=10&orderBy=createdAt&orderDirection=DESC" \
  --header "Agent-Secret-Key: $RAIA_AGENT_SECRET_KEY"

Set RAIA_FILE_ID to a returned data[].id, not vectorStoreFileId, then read that file. The response is metadata and upload status, not raw file text. Inspect vectorStoreUploadStatus: processing means upload in progress, done means upload complete, failed signals failure, and null means not uploaded. To check retrieval quality, ask a known-answer question and compare the answer with your source; file metadata alone does not prove an answer.

bash
curl --request GET "https://api.raia2.com/external/agent-files/${RAIA_FILE_ID}" \
  --header "Agent-Secret-Key: $RAIA_AGENT_SECRET_KEY"

Inspect a prompt execution

An execution is a recorded run of an agent request. Use Organization-Secret-Key to investigate a failed request; this example lists failed prompt executions, newest first. Filter source with conversation, prompt or mcp, and status with RUNNING, COMPLETED or FAILED. The reference also lists agent, request-ID and date filters; rootOnly defaults to true. Omit page and pageSize in your first request: their numbering, defaults and bounds are not specified for execution history.

bash
curl --request GET "https://api.raia2.com/external/agent-prompt-executions?source=prompt&status=FAILED&orderBy=startedAt&orderDirection=DESC" \
  --header "Organization-Secret-Key: $RAIA_ORGANIZATION_SECRET_KEY"

Read data for the execution records and the page metadata for the returned result set. Set RAIA_EXECUTION_ID to a returned data[].id, then read that record. Check status and response; for a failure, inspect errorCode and errorMessage. Use traceId and parentExecutionId to relate records. These requests read history without starting or retrying a run. Check the destination separately when you need to confirm an external action succeeded.

bash
curl --request GET "https://api.raia2.com/external/agent-prompt-executions/${RAIA_EXECUTION_ID}" \
  --header "Organization-Secret-Key: $RAIA_ORGANIZATION_SECRET_KEY"

Review your organization’s default model

Use Organization-Secret-Key and status=active to see your organization's active model access records. Each record connects a model to your organization and has its own id. The response is an array with id, modelId, modelName, status, isDefault, createdAt and updatedAt. Without status, the list includes active and archived access records whose global model is active. Before changing the default, save the current default record's id so you can switch back. Set RAIA_MODEL_ACCESS_ID to your chosen active record's id, not modelId or modelName.

bash
curl --request GET "https://api.raia2.com/external/organizations/llm-models?status=active" \
  --header "Organization-Secret-Key: $RAIA_ORGANIZATION_SECRET_KEY"
Optional: the following request changes your organization's default model. Skip it if you only need to inspect the available models. Use the active access-record ID you selected above and send no request body.
bash
curl --request PUT "https://api.raia2.com/external/organizations/llm-models/${RAIA_MODEL_ACCESS_ID}/default" \
  --header "Organization-Secret-Key: $RAIA_ORGANIZATION_SECRET_KEY"

HTTP 200 returns the selected access record. Check that isDefault is true, then reread the list with the preceding GET request. For HTTP 400, check that the selected record is active. For 404, check the access-record ID and organization key. To switch back, repeat the PUT request with the saved prior access-record ID if it is still active. The specification does not describe how existing agents inherit this setting.

Users8 endpoints

MethodPathDescriptionKey
POST/external/usersCreate a conversation user Agent
GET/external/users/searchFind user by contact information Agent
GET/external/users/{id}Get conversation user by ID Agent
DELETE/external/users/{id}Delete conversation user by ID Agent
GET/external/users/{id}/limitsGet conversation user limits by ID Agent
POST/external/users/{id}/limitsCreate conversation user limits by ID Agent
PUT/external/users/{id}/limitsUpdate conversation user limits by ID Agent
DELETE/external/users/{id}/limitsDelete conversation user limits by ID Agent

Conversations15 endpoints

MethodPathDescriptionKey
GET/external/conversationsGet conversations Agent
POST/external/conversationsCreate a new conversation Agent
DELETE/external/conversationsDelete all user conversations in current agent Agent
GET/external/conversations/statesGet conversation states Agent
GET/external/conversations/{id}Get conversation by ID Agent
PUT/external/conversations/{id}Update conversation Agent
POST/external/conversations/startStart a new conversation Agent
GET/external/conversations/{id}/messagesGet conversation messages Agent
POST/external/conversations/{id}/messagesSend a message to an agent Agent
POST/external/conversations/{id}/messages/asyncSend a message to an agent (async) Agent
GET/external/conversations/{id}/messages/{questionMessageId}/response-onGet response on Agent
PUT/external/conversations/{id}/modeUpdate conversation mode Agent
POST/external/conversations/{id}/send-manual-messageSend a manual message to a user Agent
POST/external/conversations/{id}/message-files/upload-urlCreate signed upload URL for conversation message file Agent
GET/external/conversations/{id}/message-files/{fileId}/signed-urlGet signed download URL for conversation message file Agent

Prompts4 endpoints

MethodPathDescriptionKey
POST/external/promptsProcess a prompt request Agent
POST/external/prompts/asyncCreate a prompt request Agent
GET/external/prompts/{id}/response-onGet a response on prompt request Agent
POST/external/prompts/upload-urlCreate signed upload URL for prompt file Agent

Agents12 endpoints

MethodPathDescriptionKey
GET/external/agents/{id}/usersGet agent users by agent ID and Organization API key Organization
GET/external/agents/{id}/platform-usersGet agent platform users by agent ID and Organization API key Organization
GET/external/agents/usersGet agent users by Agent API key Agent
GET/external/agents/admin-usersGet agent admin users by Agent API key Agent
GET/external/agents/by-api-keyGet agent by API key Agent
GET/external/agents/statisticGet agent statistic by API key Agent
POST/external/agents/webhooksCreate agent webhook Agent
GET/external/agents/limitsGet agent limits by Agent API key Agent
POST/external/agents/limitsCreate agent limits by Agent API key Agent
PUT/external/agents/limitsUpdate agent limits by Agent API key Agent
DELETE/external/agents/limitsDelete agent limits by Agent API key Agent
GET/external/agents/usageGet agent usage by Agent API key Agent

Agent-files9 endpoints

MethodPathDescriptionKey
POST/external/agent-files/uploadUpload agent file Agent
GET/external/agent-files/by-api-keyGet agent files by API key Agent
DELETE/external/agent-filesDelete agent files by IDs Agent
DELETE/external/agent-files/{id}/deleteDelete agent file by ID Agent
DELETE/external/agent-files/{id}/delete-from-vector-storeDelete agent file from vector store by ID Agent
PUT/external/agent-files/{id}/add-to-vector-storeAdd agent file to vector store by ID Agent
PUT/external/agent-files/{id}/add-to-vector-store/asyncAdd agent file to vector store asynchronously by ID Agent
GET/external/agent-files/by-api-key/paginatedGet paginated agent files by API key Agent
GET/external/agent-files/{id}Get agent file by ID Agent

Conversation Message Feedbacks1 endpoints

MethodPathDescriptionKey
POST/external/conversation-message-feedbacksCreate or update conversation message feedback Agent

Resource Usage Logs1 endpoints

MethodPathDescriptionKey
POST/external/resource-usageAdd new resource usage log. Agent

Organization API Key47 endpoints

MethodPathDescriptionKey
POST/external/agentsCreate agent via organization API key Organization
GET/external/agents/{id}Get agent by ID via organization API key Organization
PUT/external/agents/{id}Update agent via organization API key Organization
GET/external/agent-scraps/{id}/scrapingList scraping configurations Organization
POST/external/agent-scraps/{id}/scrapingCreate scraping configuration Organization
GET/external/agent-scraps/{id}/scraping/{scrapingId}Get scraping configuration Organization
PUT/external/agent-scraps/{id}/scraping/{scrapingId}Update scraping configuration Organization
DELETE/external/agent-scraps/{id}/scraping/{scrapingId}Delete scraping configuration Organization
POST/external/agent-scraps/{id}/scraping/{scrapingId}/runTrigger manual crawl Organization
POST/external/agent-scraps/{id}/scraping/{scrapingId}/cancelCancel in-progress crawl Organization
POST/external/agent-api-keys/{id}Create agent API key Organization
GET/external/agent-api-keys/{id}List agent API keys Organization
GET/external/agent-api-keys/{id}/api-key/{keyId}Get agent API key Organization
DELETE/external/agent-api-keys/{id}/api-key/{keyId}Revoke agent API key Organization
POST/external/agent-api-keys/{id}/api-key/{keyId}/rotateRotate agent API key Organization
GET/external/agent-functions/{id}/functionsList agent functions Organization
POST/external/agent-functions/{id}/functionsCreate agent function Organization
GET/external/agent-functions/{id}/functions/{functionId}Get agent function Organization
PUT/external/agent-functions/{id}/functions/{functionId}Update agent function Organization
DELETE/external/agent-functions/{id}/functions/{functionId}Delete agent function Organization
GET/external/live-chat-skill/{agentId}Get live chat configuration Organization
PUT/external/live-chat-skill/{agentId}Update live chat configuration Organization
POST/external/live-chat-skill/images/upload-urlCreate agent image upload URL Organization
GET/external/agent-roles/by-api-keyGet agent roles by organization API key Organization
POST/external/organizations/by-organization-api-keyCreate organization via organization API key Organization
GET/external/platform-usersGet all platform users for the current organization. Organization
GET/external/platform-users/agentsGet agents by platform user via organization API key Organization
PATCH/external/platform-users/{userId}Update a platform user role or status via organization API key Organization
POST/external/packsCreate a pack via organization API key Organization
GET/external/packsList packs via organization API key Organization
GET/external/packs/{id}Get a pack via organization API key Organization
PUT/external/packs/{id}Update a pack via organization API key Organization
DELETE/external/packs/{id}Delete a pack via organization API key Organization
POST/external/packs/documents/upload-urlCreate a pack document upload URL via organization API key Organization
POST/external/packs/{id}/documentsAttach a document to a pack via organization API key Organization
DELETE/external/packs/{id}/documents/{fileId}Remove a document from a pack via organization API key Organization
POST/external/packs/{id}/link/{agentId}Link a pack to an agent Organization
DELETE/external/packs/{id}/link/{agentId}Unlink a pack from an agent Organization
POST/external/functionsCreate a function via organization API key Organization
GET/external/functionsList functions via organization API key Organization
GET/external/functions/{id}Get a function via organization API key Organization
PATCH/external/functions/{id}Update a function via organization API key Organization
DELETE/external/functions/{id}Delete a function via organization API key Organization
GET/external/agent-prompt-executionsGet agent prompt executions Organization
GET/external/agent-prompt-executions/{id}Get an agent prompt execution Organization
GET/external/organizations/llm-modelsGet accessible models for the current organization Organization
PUT/external/organizations/llm-models/{id}/defaultSet the default model for the current organization Organization
05

Rate limits

Operation typeLimit
System operations (users, lookups, configuration)1,000 requests per 60 seconds, per organization
AI-backed operations (messages, prompts, conversations)300 requests per 60 seconds, per organization

Exceeding a limit returns 429 Too Many Requests. Retry with exponential backoff and queue non-urgent traffic.

06

Errors

StatusMeaningWhat to do
400Bad request — missing or invalid fields, or the record already exists.Check the payload against the schema in the interactive guide.
403Invalid API key or secret key.Confirm you sent the right header for the right region.
404Entity not found.Verify the ID, and that it belongs to the authenticated agent.
429Rate limit exceeded.Back off and retry.
500Unexpected server error.Retry after a short delay; contact support if it persists.
07

Frequently asked questions

Where do I get an Agent Secret Key?

In raia CX, open the agent, enable the API Skill and generate a key. Organization keys are issued at the organization level and can create, rotate and revoke agent keys programmatically.

How do I keep conversation history?

Create a conversation once and reuse its ID for every message, so the agent continues the same conversation. To read history back, fetch the transcript with GET /external/conversations/{id}/messages, which returns the conversation's saved messages array. GET /external/conversations/{id} returns conversation details and metadata instead, with no messages property.

Can I attach files?

Yes. Request a signed upload URL, upload the file directly to it, then reference the returned file in the message or prompt payload. Agent knowledge files use the agent-files endpoints instead.

Can I hand a conversation to a human?

Yes — update the conversation mode, then post replies with the send-manual-message endpoint so a human agent responds inside the same thread.