Skip to main content
When a request fails, PolyAI APIs return a structured JSON error response. This page documents the HTTP status codes, error response format, and platform-specific error codes you may encounter.

Error response format

All API errors return a JSON body with the following structure:
{
  "error": {
    "code": "SCHEMA_VALIDATION_FAILED",
    "id": 1,
    "message": "Request body failed schema validation.",
    "correlation_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}
FieldTypeDescription
codestringMachine-readable error code in UPPER_SNAKE_CASE.
idintegerNumeric error identifier.
messagestringHuman-readable description of the error.
correlation_idstringUnique request identifier from the X-Polyai-Correlation-Id header. Include this when contacting support.

Standard HTTP status codes

These standard codes apply across all PolyAI APIs.
StatusMeaningWhen it occurs
400Bad requestThe request body or query parameters failed validation.
401UnauthorizedMissing, expired, or invalid API key or token.
403ForbiddenYou do not have permission for the requested action.
404Not foundThe requested resource does not exist.
405Method not allowedThe HTTP method is not supported for this endpoint.
408Request timeoutThe request exceeded the server timeout.
409ConflictA resource with the same identifier already exists.
410GoneThe resource has been permanently deleted.
412Precondition failedA required precondition was not met (for example, deploying to live before pre-release).
415Unsupported media typeThe uploaded file type is not supported.
422Unprocessable entityThe request is well-formed but contains semantic errors.
429Too many requestsRate limit exceeded. Retry after the period indicated in the response headers.
500Internal server errorAn unexpected error occurred on the server.
501Not implementedThe requested functionality is not yet available.
502Bad gatewayAn upstream service returned an error or timed out.
503Service unavailableThe service is temporarily unavailable.

Platform error codes

PolyAI APIs return domain-specific error codes alongside HTTP status codes. These help you identify the exact cause of a failure.

Authentication and authorization

CodeIDHTTPDescription
AUTH_USER_NOT_FOUND3001404User not found in the auth system.
AUTH_USER_UNAUTHORISED3002401Invalid credentials or expired session.
AUTH_USER_INVALID_TOKEN3003401Token is malformed, expired, or revoked.
USER_ACCESS_FORBIDDEN2403User lacks permission for the requested action.
EXTERNAL_USER_FORBIDDEN3403External user privilege level is too low.
ACCOUNT_INSUFFICIENT_PERMISSIONS1003403User lacks permissions for this account operation.

Conversations

CodeIDHTTPDescription
CONVERSATIONS_NOT_FOUND5001404Conversation ID does not exist.
CONVERSATIONS_VALIDATION_FAILED5002400Conversation request body failed validation.
CONVERSATIONS_RECORDING_NOT_FOUND5003404Audio recording not found for this conversation.
GET_CONVERSATIONS_FILTER_PARSE_ERROR400Filter expression syntax is invalid.
GET_CONVERSATIONS_INVALID_SORT_PARAMETER400Sort field is not in the allowed set.

Chat

CodeIDHTTPDescription
CHAT_DRAFT_NOT_EXIST4001400The draft you are attempting to chat with does not exist.
CHAT_TIMEOUT4002400Chat session exceeded the timeout limit.
CHAT_DRAFT_DEPLOYMENT_FAILED4003500Draft auto-deploy failed before the chat could start.
ChatConversationEnded410You sent a message to a conversation that has already ended.

Deployments

CodeIDHTTPDescription
DEPLOYMENT_NOT_FOUND6001404Deployment ID does not exist.
DEPLOYMENTS_ALREADY_PUBLISHED6009409Draft is already published to the target environment.
DEPLOYMENTS_ENVIRONMENT_ALREADY_PUBLISHED6002200Environment already has this version (idempotent).
DEPLOYMENTS_VALIDATION_FAILED6007400Request body validation failed.
DEPLOYMENTS_INVALID_ENVIRONMENT6008400Invalid or missing environment query parameter.
ErrPreReleaseNotReady412You must deploy to pre-release before promoting to live.

Flows

CodeIDHTTPDescription
FLOW_NOT_FOUND8001404Flow ID does not exist.
FLOWS_NAME_ALREADY_EXISTS8003409A flow with this name already exists.
FLOWS_FUNCTION_NAME_ALREADY_EXISTS8004409A function with this name already exists in the flow.
FLOWS_RESERVED_PARAMETER_NAME8005400You used a reserved parameter name.
FLOWS_RESERVED_FUNCTION_NAME8006400You used a reserved function name.

Functions

CodeIDHTTPDescription
FUNCTION_NOT_FOUND9001404Function ID does not exist.
FUNCTIONS_DEPLOYMENT_HAS_ERRORS9004400Function code contains errors that prevent deployment.
FUNCTION_EXECUTION_FAILED9006400Function encountered a runtime execution error.
FUNCTION_FAILED_TO_PARSE9007400Function source code has parse errors.
FUNCTION_NAME_ALREADY_EXISTS9009409A function with this name already exists.
FUNCTIONS_RESERVED_NAME9010400You used a system-reserved function name.

Knowledge base

CodeIDHTTPDescription
KNOWLEDGE_BASE_TOPIC_ALREADY_EXISTS11001409A topic with this name already exists.
KNOWLEDGE_BASE_IMPORT_NO_CSV_FOUND11002400No CSV file found in the import request.
KNOWLEDGE_BASE_IMPORT_INVALID_TYPE11003415The uploaded file type is not supported.
KNOWLEDGE_BASE_IMPORT_MISSING_COLUMNS11004400Required columns are missing from the CSV import.
KNOWLEDGE_BASE_TOPICS_INVALID11005400Topic data failed validation.
KNOWLEDGE_BASE_RICH_TEXT_INVALID11006400Rich text markup is malformed or references a missing entity.

Phone numbers and connectors

CodeIDHTTPDescription
PHONE_NUMBERS_NOT_FOUND14006404Phone number does not exist.
PHONE_NUMBERS_ALREADY_EXISTS14007409Phone number has already been imported.
PHONE_NUMBERS_INVALID_PHONE_NUMBER_FORMAT14003400Number is not in valid E.164 format.
PHONE_NUMBERS_CONNECTOR_DOES_NOT_EXIST14005404Referenced connector not found.
CONNECTORS_NOT_FOUND14100404Connector ID does not exist.
CONNECTORS_VALIDATION_FAILED14101400Connector request body failed validation.

Variants

CodeIDHTTPDescription
VARIANTS_BAD_ATTRIBUTES_ERROR26001400Attribute values do not match the expected schema.
VARIANTS_DUPLICATE_NAME_ERROR26002409A variant with this name already exists.
VARIANTS_REMOVE_DEFAULT_ERROR26003400You cannot remove the default variant.
VariantsImportInvalidDelimiter400CSV delimiter not recognized.
VariantImportMissingColumnsHttp400CSV is missing required columns.
VariantImportDuplicateColumnsHttp400CSV has duplicate column headers.

Real-time configuration

CodeIDHTTPDescription
REAL_TIME_CONFIG_FORBIDDEN_ACCESS29001403Not authorized to access real-time configs.
REAL_TIME_CONFIG_INVALID_FOR_SCHEMA29002400Config values fail JSON Schema validation.
REAL_TIME_CONFIG_INVALID_SCHEMA29004400JSON Schema definition is invalid.
REAL_TIME_CONFIG_UNKNOWN_CLIENT_ENVIRONMENT29006400Client environment is not one of sandbox, pre-release, or live.

Accounts and projects

CodeIDHTTPDescription
ACCOUNT_NOT_FOUND1002404Account ID does not exist.
ACCOUNT_CREATE_INVALID_ID1004400Account ID contains non-alphanumeric characters or is too similar to an existing ID.
ACCOUNT_CREATE_EXISTING_ID1006409Account ID is already taken.
PROJECT_NOT_FOUND15001404Project ID does not exist.
PROJECT_ID_ALREADY_EXISTS15005409Project ID is already taken.
PROJECT_ID_INVALID15006400Project ID does not meet format requirements.

SMS

CodeIDHTTPDescription
SMS_TEMPLATE_NOT_FOUND20001404SMS template ID does not exist.

Test suite

CodeIDHTTPDescription
MissingTestCasesHttp422One or more test case IDs were not found.
NoTestCasesHttp422No test cases exist for this project.

WebSocket close codes

If you are using the WebRTC Gateway or webchat WebSocket connections, you may encounter these close codes:
CodeMeaningWhen it occurs
1000Normal closureConnection closed cleanly.
1006Abnormal closureConnection dropped unexpectedly (for example, network failure).
408Pong timeoutServer did not receive a pong response within the configured timeout.

Troubleshooting

Include the correlation ID in support requests

Every API response includes an X-Polyai-Correlation-Id header. When contacting PolyAI support, include this value so the team can trace the request through the system.

Common patterns

SymptomLikely causeResolution
401 on every requestAPI key missing or malformedVerify the x-api-key header is present and correctly formatted.
403 after key rotationOld key revokedConfirm you are using the new key.
404 for a known resourceWrong regionVerify the base URL matches your account region.
409 on createDuplicate identifierUse a different name or ID, or check for existing resources.
422 on importSchema mismatchVerify CSV columns match the expected format. Check the error data field for column details.

API getting started

Authentication, base URLs, and API versioning.

Conversations API

Retrieve conversation data and transcripts.
Last modified on April 20, 2026