---
title: "Create conversation"
method: POST
path: "/s2s/contacts/{userId}/conversations"
tags: ["S2S Contacts"]
---

# Create conversation

`POST /s2s/contacts/{userId}/conversations`

Open a conversation for a contact, authored as the contact. Pass
workflowId to start a workflow, or agentId to engage an AI agent.
The contact is created on the fly if it does not exist yet.

## Path parameters

- `userId` string, required

## Request body

- S2SCreateConversationBody
  - `title` string
  - `message` string, required — The customer's first message.
  - `attributes` RecordStringUnknown — Construct a type with a set of properties K of type T
  - `source` string — Free-form source tag, e.g. "abb-mobile".
  - `tags` string[]
  - `attachments` S2SAttachmentInput[]
    - `url` string, required
    - `name` string
    - `contentType` string
  - `workflowId` string — Start this workflow immediately (wf_… or bare id). Mutually exclusive with agentId.
  - `agentId` string — Engage this AI agent directly. Mutually exclusive with workflowId.

## Response `201`

Created

- S2SConversation
  - `id` string, required
  - `number` number, double
  - `title` string
  - `type` string
  - `status` string
  - `closed` boolean, required
  - `archived` boolean, required
  - `unread` boolean, required
  - `workflowActive` boolean, required
  - `workflowId` string
  - `assignee` S2SAuthor
    - `type` 'contact' | 'agent' | 'bot' | 'system', required
    - `id` string
    - `name` string
    - `avatar` string
  - `attributes` RecordStringUnknown — Construct a type with a set of properties K of type T
  - `contact` object
    - `userId` string
  - `latestMessage` S2SMessage
    - `id` string, required
    - `conversationId` string, required
    - `text` string
    - `author` S2SAuthor, required
      - `type` 'contact' | 'agent' | 'bot' | 'system', required
      - `id` string
      - `name` string
      - `avatar` string
    - `attachments` S2SAttachment[], required
      - `url` string, required
      - `name` string
      - `contentType` string
    - `replyToMessageId` string
    - `rating` string
    - `unread` boolean, required
    - `createdAt` string, date-time, required
  - `createdAt` string, date-time
  - `lastActivityAt` string, date-time

---

[API](https://skmtc.net/gleap/apis/gleap-server.md) · [All operations](https://skmtc.net/gleap/apis/gleap-server/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gleap/gleap-server/revisions/93af2e90fb6a/schema)
