Test and expected result
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 guideSwagger
Swagger UI
The published reference served by the platform; check it for current operations.
Open SwaggerSpec
OpenAPI JSON
Generate typed clients in any language from the raw spec.
View openapi.jsonBase URLs
Every path below is relative to a regional base URL. Use the region your agent runs in — keys are not shared across regions.
| Region | Base URL |
|---|---|
| United States | https://api.raia2.com |
| Europe | https://api-eu.raia2.com |
Authentication
The API uses secret keys sent as request headers — not bearer tokens. Which header you send determines what you are allowed to do.
| Header | Scope | Typical use |
|---|---|---|
Agent-Secret-Key | A single agent | Conversations, messages, prompts, agent files, usage and limits for that agent. |
Organization-Secret-Key | One organization | Create and configure agents, functions, packs, API keys, live chat and platform users. |
Agent-Secret-Key: {your-agent-secret-key}Keep keys server-side
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
{
"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.
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
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.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.
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.
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.
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.
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.
curl --request GET "https://api.raia2.com/external/organizations/llm-models?status=active" \
--header "Organization-Secret-Key: $RAIA_ORGANIZATION_SECRET_KEY"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
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/users | Create a conversation user | Agent |
GET | /external/users/search | Find 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}/limits | Get conversation user limits by ID | Agent |
POST | /external/users/{id}/limits | Create conversation user limits by ID | Agent |
PUT | /external/users/{id}/limits | Update conversation user limits by ID | Agent |
DELETE | /external/users/{id}/limits | Delete conversation user limits by ID | Agent |
Conversations15 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
GET | /external/conversations | Get conversations | Agent |
POST | /external/conversations | Create a new conversation | Agent |
DELETE | /external/conversations | Delete all user conversations in current agent | Agent |
GET | /external/conversations/states | Get conversation states | Agent |
GET | /external/conversations/{id} | Get conversation by ID | Agent |
PUT | /external/conversations/{id} | Update conversation | Agent |
POST | /external/conversations/start | Start a new conversation | Agent |
GET | /external/conversations/{id}/messages | Get conversation messages | Agent |
POST | /external/conversations/{id}/messages | Send a message to an agent | Agent |
POST | /external/conversations/{id}/messages/async | Send a message to an agent (async) | Agent |
GET | /external/conversations/{id}/messages/{questionMessageId}/response-on | Get response on | Agent |
PUT | /external/conversations/{id}/mode | Update conversation mode | Agent |
POST | /external/conversations/{id}/send-manual-message | Send a manual message to a user | Agent |
POST | /external/conversations/{id}/message-files/upload-url | Create signed upload URL for conversation message file | Agent |
GET | /external/conversations/{id}/message-files/{fileId}/signed-url | Get signed download URL for conversation message file | Agent |
Prompts4 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/prompts | Process a prompt request | Agent |
POST | /external/prompts/async | Create a prompt request | Agent |
GET | /external/prompts/{id}/response-on | Get a response on prompt request | Agent |
POST | /external/prompts/upload-url | Create signed upload URL for prompt file | Agent |
Agents12 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
GET | /external/agents/{id}/users | Get agent users by agent ID and Organization API key | Organization |
GET | /external/agents/{id}/platform-users | Get agent platform users by agent ID and Organization API key | Organization |
GET | /external/agents/users | Get agent users by Agent API key | Agent |
GET | /external/agents/admin-users | Get agent admin users by Agent API key | Agent |
GET | /external/agents/by-api-key | Get agent by API key | Agent |
GET | /external/agents/statistic | Get agent statistic by API key | Agent |
POST | /external/agents/webhooks | Create agent webhook | Agent |
GET | /external/agents/limits | Get agent limits by Agent API key | Agent |
POST | /external/agents/limits | Create agent limits by Agent API key | Agent |
PUT | /external/agents/limits | Update agent limits by Agent API key | Agent |
DELETE | /external/agents/limits | Delete agent limits by Agent API key | Agent |
GET | /external/agents/usage | Get agent usage by Agent API key | Agent |
Agent-files9 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/agent-files/upload | Upload agent file | Agent |
GET | /external/agent-files/by-api-key | Get agent files by API key | Agent |
DELETE | /external/agent-files | Delete agent files by IDs | Agent |
DELETE | /external/agent-files/{id}/delete | Delete agent file by ID | Agent |
DELETE | /external/agent-files/{id}/delete-from-vector-store | Delete agent file from vector store by ID | Agent |
PUT | /external/agent-files/{id}/add-to-vector-store | Add agent file to vector store by ID | Agent |
PUT | /external/agent-files/{id}/add-to-vector-store/async | Add agent file to vector store asynchronously by ID | Agent |
GET | /external/agent-files/by-api-key/paginated | Get paginated agent files by API key | Agent |
GET | /external/agent-files/{id} | Get agent file by ID | Agent |
Conversation Message Feedbacks1 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/conversation-message-feedbacks | Create or update conversation message feedback | Agent |
Resource Usage Logs1 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/resource-usage | Add new resource usage log. | Agent |
Organization API Key47 endpoints
| Method | Path | Description | Key |
|---|---|---|---|
POST | /external/agents | Create 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}/scraping | List scraping configurations | Organization |
POST | /external/agent-scraps/{id}/scraping | Create 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}/run | Trigger manual crawl | Organization |
POST | /external/agent-scraps/{id}/scraping/{scrapingId}/cancel | Cancel 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}/rotate | Rotate agent API key | Organization |
GET | /external/agent-functions/{id}/functions | List agent functions | Organization |
POST | /external/agent-functions/{id}/functions | Create 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-url | Create agent image upload URL | Organization |
GET | /external/agent-roles/by-api-key | Get agent roles by organization API key | Organization |
POST | /external/organizations/by-organization-api-key | Create organization via organization API key | Organization |
GET | /external/platform-users | Get all platform users for the current organization. | Organization |
GET | /external/platform-users/agents | Get 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/packs | Create a pack via organization API key | Organization |
GET | /external/packs | List 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-url | Create a pack document upload URL via organization API key | Organization |
POST | /external/packs/{id}/documents | Attach 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/functions | Create a function via organization API key | Organization |
GET | /external/functions | List 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-executions | Get agent prompt executions | Organization |
GET | /external/agent-prompt-executions/{id} | Get an agent prompt execution | Organization |
GET | /external/organizations/llm-models | Get accessible models for the current organization | Organization |
PUT | /external/organizations/llm-models/{id}/default | Set the default model for the current organization | Organization |
Rate limits
| Operation type | Limit |
|---|---|
| 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.
Errors
| Status | Meaning | What to do |
|---|---|---|
| 400 | Bad request — missing or invalid fields, or the record already exists. | Check the payload against the schema in the interactive guide. |
| 403 | Invalid API key or secret key. | Confirm you sent the right header for the right region. |
| 404 | Entity not found. | Verify the ID, and that it belongs to the authenticated agent. |
| 429 | Rate limit exceeded. | Back off and retry. |
| 500 | Unexpected server error. | Retry after a short delay; contact support if it persists. |
Frequently asked questions
Where do I get an Agent Secret Key?
How do I keep conversation history?
Can I attach files?
Can I hand a conversation to a human?