---
title: "Upload conversations"
method: POST
path: "/api/agent-conversation-uploads"
tags: ["agent_conversation_uploads"]
---

# Upload conversations

`POST /api/agent-conversation-uploads`

## Request

- Base URL: `https://beta.getsales.io/unibox/v1`
- URL: `https://beta.getsales.io/unibox/v1/api/agent-conversation-uploads`
- Auth: HTTP bearer and API key in header `Team-SID`

Upload conversations into the Golden set: threads with their messages, paired into dialogues by the set's rules (the lead's message, then a reply of ours; a reply a day after our own unanswered one is a follow-up), names as placeholders. They wait on the record: nothing joins before apply_agent_conversation_upload. The app uploads a CSV or JSON file here. 422 upload_no_threads, upload_nothing_paired, upload_too_many_threads, upload_too_many_messages.

Contract:
- MCP tool `upload_agent_conversations`, registry package `mcp.unibox/agent_conversation_uploads`, mount `unibox.agent-memory`.
- Operation `create`, response envelope `create`.
- Flags: none.

## Request body

- UploadAgentConversationsRequest: Request body of `upload_agent_conversations`.
  - `agent_sid` string: The AI SDR it is kept for (ub_ag_…, block 10, 2026-10-30); left out, the team's default agent.
  - `threads` object[], required: The conversations, each with its messages. The app uploads a CSV or a JSON file instead (multipart file, 5 MB at most): the same record comes back.
    - `id` string: The thread's key in the file; thread-N when absent.
    - `lead` string, nullable: The lead's name: it becomes {lead} in the pairs.
    - `company` string, nullable: The lead's company: it becomes {lead_company}.
    - `channel` 'linkedin' | 'email', nullable: linkedin or email, when known.
    - `sender` string, nullable: The name of the person who wrote our messages: it becomes {sender}.
    - `messages` object[], required: The thread's messages, in time order (or dated).
      - `who` string, required: lead, them, in, inbound, contact or prospect for the lead's message; anything else (us, me, a name) for ours.
      - `when` string, nullable: When it went, ISO 8601 or any date the reader parses; the messages are sorted by it when every one has it.
      - `text` string, required: The message as written. A message with no words is skipped.

## Response `200`

`create` success envelope.

- UploadAgentConversationsResponse
  - `success` true, required
  - `operation` 'create', required
  - `item` object, required
    - `sid` string, required: Conversations upload sid (ub_cu_…).
    - `team_sid` string, required: Owning team (ts_tm_…, external - gs.service.id).
    - `agent_sid` string, required: The team's agent (ub_ag_…).
    - `status` 'found' | 'applied' | 'discarded', required: found (the dialogues wait for the OK), applied (the kept ones are rows of the Golden set), discarded (closed with nothing kept).
    - `created_by` object, required: Who uploaded it.
      - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
      - `actor_sid` string, nullable, required
      - `team_sid` string, required
      - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
      - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
      - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
      - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
      - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
      - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
    - `file` object, nullable, required: The file it came in as (the bytes are not kept); null when the threads came in the request's body.
      - `name` string, required: The file's name as uploaded.
      - `format` 'csv' | 'json', required: csv or json.
      - `bytes` integer, required: Its size; 5 MB at most.
    - `counts` object, required: What was read.
      - `threads` integer, required: The threads read.
      - `messages` integer, required: The messages with words.
      - `pairs` integer, required: The dialogues paired, 500 at most.
      - `skipped` integer, required: Our messages that paired with nothing (an opener, a continuation the same day) and the pairs over the cap.
    - `pairs` object[], required: The dialogues found, each with its id, the lead and the company, what they wrote, what was answered and when.
      - `id` integer, required: The pair's id within the upload, from 1: what apply names.
      - `thread` string, required: The thread the pair was read from, as the file named it.
      - `lead` string, nullable, required: The lead's name as the file gave it; null when it gave none.
      - `company` string, nullable, required: The lead's company as the file gave it.
      - `channel` 'linkedin' | 'email', nullable, required: The channel the file named for the thread; null when none.
      - `kind` 'reply' | 'followup', required: reply: our reply to the lead's message; followup: our message a day or more after our own unanswered one.
      - `before` string, nullable, required: Our message before the lead's, names as placeholders; null on a follow-up.
      - `theirs` string, required: What the lead wrote (the situation), names as placeholders ({lead}, {lead_company}, {sender}).
      - `ours` string, required: The reply of ours that followed (the answer), names as placeholders.
      - `at` string, nullable, required: ISO 8601 UTC of our reply, when the file dated it.
      - `answer_hash` string, required: sha256 of the answer, lower-cased with whitespace folded: the key a kept row is found by.
    - `applied` object, nullable, required: What apply did; null until applied.
      - `kept` integer, required: The dialogues written as golden rows.
      - `twins` integer, required: The picked dialogues whose answer the set held already: counted on their row, not written twice.
      - `example_sids` string[], required: The rows written (ub_eg_…).
    - `applied_by` object, nullable, required: Who kept the dialogues; null until applied.
      - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
      - `actor_sid` string, nullable, required
      - `team_sid` string, required
      - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
      - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
      - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
      - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
      - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
      - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
    - `applied_at` string, nullable, required: ISO 8601 UTC when the dialogues were kept; null until then.
    - `created_at` string, required: ISO 8601 UTC.
    - `updated_at` string, required: ISO 8601 UTC.
  - `already_exists` boolean, required
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-unibox/revisions/8f1bc317897f?raw)
