Skip to main content

Upload Conversations Through the API

Send call recordings and chats to Ender Turing in one HTTPS request each, with a developer API token. This article is automatically maintained (upload-conversations-api).

Overview

Your phone system, chat platform, help desk, or any other system can send conversations to Ender Turing directly. Each conversation is one HTTPS request that carries a developer API token. There is no separate sign-in step.

  • Recordings are sent as audio files. Ender Turing reads the call details from the file name and transcribes the call.

  • Chats are sent as JSON with the participants and the messages. Email and ticket threads use the same format, with one message per email or comment.

Ender Turing then analyzes the conversation, and it appears on the All Conversations page like any other.

Use this when a system or a partner uploads conversations automatically. To upload a few by hand, use Upload in the web interface instead.

How It Works

Before You Start

You need two things from your Ender Turing administrator:

  • Your Ender Turing address, for example company.enderturing.com.

  • A developer API token. It starts with et_api_. The administrator creates it on the Developer API tokens tab, as described in API Access. The predefined Session API role can upload conversations. A custom role needs the permission to create conversations.

Keep the token secret, like a password. Store it in a secrets manager, not in code, and never put it in a URL, a log, or a ticket. If it leaks, ask your administrator to revoke it: the old token stops working at once.

Every request needs two headers:

  • Authorization: Bearer <your token>;

  • a User-Agent that starts with EnderTuringSDK/ and names your tool, for example EnderTuringSDK/my-dialer/1.0. Without it, the Ender Turing cloud firewall may block the request.

Uploading a Recording

Send one POST request per recording to:

https://company.enderturing.com/api/v1/recognizer/audio-file

The body is multipart/form-data with one field named file that holds the recording, with an audio content type set on that field.

Example with curl:

curl -X POST "https://company.enderturing.com/api/v1/recognizer/audio-file" \
  -H "Authorization: Bearer <your token>" \
  -H "User-Agent: EnderTuringSDK/<your app name>/1.0" \
  -F "file=@20261203_1015_101_0501234567_IN_0.wav;type=audio/wav"

Example with Python and the requests library:

import requestsname = "20261203_1015_101_0501234567_IN_0.wav"
with open(name, "rb") as f:
    response = requests.post(
        "https://company.enderturing.com/api/v1/recognizer/audio-file",
        headers={
            "Authorization": "Bearer <your token>",
            "User-Agent": "EnderTuringSDK/<your app name>/1.0",
        },
        files={"file": (name, f, "audio/wav")},
        timeout=300,
    )
print(response.status_code, response.text)

Both examples set the content type of the file field (type=audio/wav and "audio/wav"). Without it the upload fails.

Language

You do not need to send a language. Ender Turing uses the language configured for your account.

If your account processes recordings in more than one language, add ?language=<code> to the address, with the language code your administrator gives you. The code must match a language your account has speech recognition for.

File Rules

Extension

Content type to send

.wav

audio/wav

.mp3

audio/mpeg

.opus

audio/ogg

.m4a

audio/mp4

  • Send stereo recordings with the agent and the customer on separate channels.

  • Name each file in the format Ender Turing reads, so the date, time, agent, customer number, direction, and agent channel are filled in for you. The format is described under Filename Format in Upload. It also lets Ender Turing spot a file it already received, which makes retries safe. To test your names, see Checking a File Name below.

  • Files under about 1 KB are too small for speech recognition. They create a conversation without a transcript.

Checking a File Name

When you set up the integration, check once that Ender Turing reads the file names your system produces. Send one example name, without the file, with the same two headers, to:

GET https://company.enderturing.com/api/v1/recognizer/filename-parser?filename=<file name>

Example with curl:

curl -G "https://company.enderturing.com/api/v1/recognizer/filename-parser" \
  -H "Authorization: Bearer <your token>" \
  -H "User-Agent: EnderTuringSDK/<your app name>/1.0" \
  --data-urlencode "filename=20261203_1015_101_0501234567_IN_0.wav"

The check uses the same rules as the upload and saves nothing. You do not need it before each upload: check again only when your system's file naming changes.

  • If the answer lists details such as start_dt, direction, agent_phone_number, and caller_id, a recording with that name gets those details, and retrying it is safe.

  • If the answer is null, Ender Turing reads nothing from the name. The recording is still accepted, but without those details, and a retry can create a second conversation.

Uploading a Chat

Send one POST request per chat, with a JSON body, to:

https://company.enderturing.com/api/v1/sessions/chats

A short example with curl:

curl -X POST "https://company.enderturing.com/api/v1/sessions/chats" \
  -H "Authorization: Bearer <your token>" \
  -H "User-Agent: EnderTuringSDK/<your app name>/1.0" \
  -H "Content-Type: application/json" \
  -d '{
    "language_code": "en",
    "direction": "in",
    "participants": [
      {"role": "customer", "phone": "3807212345678", "full_name": "John Doe"},
      {"role": "agent", "phone": "101", "full_name": "Anna Smith"}
    ],
    "messages": [
      {"msg_from": "3807212345678", "dt": "2026-12-03T11:03:00", "text": "My card is blocked."},
      {"msg_from": "101", "dt": "2026-12-03T11:04:10", "text": "I can help. Let me check your account."}
    ],
    "metadata": {"chat_system_id": "chat-000123"}
  }'

What the fields mean:

Field

Required

Meaning

participants

Yes

Everyone in the chat. Each has a role (customer, agent, bot, or system) and a phone, which identifies them in the messages. Include one customer and at least one agent or bot.

messages

Yes

The messages in time order. Each has msg_from (the sender's phone), dt (the time, in your team's local time), and text.

language_code

No

The chat's language, for example en or pl.

direction

No

in (inbound, the default), out (outbound), or internal.

start_dt, end_dt

No

When the chat started and ended, in your team's local time. Left out, they are taken from the first and last message.

categories

No

Topic names to put on the chat. Topics that do not exist yet are created.

metadata

No

Details from your system, such as chat_system_id, queue_name, campaign_name, or crm_statuses.

  • Each message's msg_from must match the phone of one of the participants.

  • Send every time as your team's local clock time, with no Z and no offset such as +02:00. Ender Turing does not convert time zones: it drops the zone and keeps the clock time as sent. For example, a chat at 11:03 in Warsaw is sent as 2026-12-03T11:03:00.

  • A chat that no agent joined, for example one the customer left early, still needs a participant with the bot role. Ender Turing then files it under its shared chatbot agent.

  • Agents are matched to Ender Turing agents by phone. An agent with a new phone is added automatically. A chat whose agent is switched off in Ender Turing is not saved (see the answers below).

  • Send your own ID for the chat in metadata.chat_system_id. You can then find the chat later by that ID, as described under Finding a Conversation by an ID From Another System in API Access.

  • The full list of fields and a complete example are in the API reference: ask a person with access to open API Documentation in the Help menu and look up POST /api/v1/sessions/chats.

What the Answer Means

Answer

Meaning

What to do

200 with session_id

Accepted. Processing has started. A 200 without session_id was not accepted: check the rows below.

Nothing.

200 with "status": "duplicate"

Recordings only: a file with this name was already uploaded. Ender Turing checks this only for names it can read (see Checking a File Name). The answer carries the existing session_id.

Nothing. Do not send it again.

401

The token is missing, wrong, expired, or revoked.

Check the Authorization header, then ask your administrator for a new token.

403

The token's role does not allow uploads.

Ask your administrator to check the token's roles.

415

Recordings only: the file type, extension, or content type is not supported.

Fix the file or its content type, then send it again.

422 with inactive_agent

Recordings only: the agent in the file name is switched off in Ender Turing.

Do not retry. Tell your administrator if the agent should be active.

200 with "status": "skipped_inactive_agent"

Chats only: the agent with that phone is switched off in Ender Turing. The chat was not saved.

Do not retry. Keep the chat and tell your administrator. Send it again after the agent is switched on.

422 with a list of fields

The request is missing a required field or has a wrong value. For recordings, this usually means the file field is not named file. The answer names the field.

Fix the request, then send it again.

5xx, a timeout, or no answer

A temporary problem.

Retry later, as described below.

An HTML page instead of JSON

The cloud firewall stopped the request.

Check the User-Agent header. If it is correct, contact Ender Turing support with the Ray ID shown on the page.

Retries and Good Practice

  • Recordings: retrying is safe only for names Ender Turing can read. For those, it recognizes a file it already accepted and answers duplicate. Names it cannot read, such as recording.wav, are not checked, so a retry after a timeout can create a second conversation for the same call.

  • Chats: Ender Turing does not check for duplicates. Every request creates a new chat. After a timeout or no answer, do not send the chat again right away: it may already be saved, and it shows up in search only after processing finishes. Processing usually takes 1 to 10 seconds, and longer when the system is busy. Wait a few minutes, look for the chat by its chat_system_id, and send it again only if it is still not there.

  • Wait longer between retries, for example 1, 5, and 15 minutes, then alert someone.

  • Keep each recording or chat until you get a 200 answer with a session_id or "status": "duplicate" for it.

  • Send conversations one after another, not many at the same time.

  • Allow time for large files. The answer to a recording upload comes only after the whole file is stored, so use a timeout of a few minutes.

Did this answer your question?