Use the API

Send the key as Authorization: Bearer <key> and Content-Type: application/json on every request. The key tells Codi which workspace you are. Developers, Documentation has each endpoint with examples.

EndpointWhat it does
GET /api/v1/agentsLists agents. GET, PATCH and DELETE on /api/v1/agents/:agentId read, change and delete one, and POST /api/v1/agents creates one.
POST /api/v1/conversationsStarts a conversation with its first message. It returns the reply if it's ready within 30 seconds, otherwise 202. Add externalId, externalUserId or metadata to tie it to your own records, and source to label where it came from.
POST /api/v1/conversations/messagesSends a message and returns the reply if it's ready within 30 seconds. Otherwise you get 202: fetch the reply with List messages, or set a webhookUrl to have it sent to you.
POST /api/v1/conversations/:id/messages.streamStreams the reply as it's written, as server-sent events.
GET /api/v1/conversations/:id/messagesLists a conversation's messages, 6 per page, each cut to 500 characters. Add /:messageId for one message in full.
DELETE /api/v1/memoriesDeletes what agents remember about one of your end users.

Sending messages needs an active plan, and stops with 402 once the workspace reaches its monthly spend limit. For spoken replies and voice notes, see Voice through the API.

Need some help? Email support

Something not working? See troubleshooting