Skip to content

Create a new thread (ticket)

POST
/openapi/thread/create
curl --request POST \
--url https://open-api.replyco.com/openapi/thread/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '{ "subject": "Lamp arrived with a broken shade", "accountId": "3f1c2a9e-6b4d-4c8e-9f2a-1d5e7b3c9a06", "customerId": "5c8a1e3f-7d2b-4f9c-8e6a-3b1d9f5c7e24", "message": { "htmlBody": "<p>Hello, the lamp from order SO-10482 arrived with a broken shade.</p>", "attachments": [ { "fileName": "broken-shade.jpg", "data": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAE=" } ] } }'

Creates a new ticket/thread in the system.

The accountId must belong to a Custom Integration account. Tickets cannot be created through this endpoint on any other integration type, and the request is rejected with 400.

Required fields:

  • subject
  • accountId
  • customerId
  • message

Optional fields:

  • status
  • task
  • message.attachments
  • message.isDelayed with message.sendingDate
  • message.closeAfterSend, message.archiveAfterSend

Attachments:

Each attachment needs a fileName including its extension, plus one of:

  • data - the base64 encoded content of a new file. This is the normal way to upload.
  • url - a path returned by an earlier Replyco response, to re-use a file that is already stored. External addresses are not downloaded and will not produce a working attachment.

Tickets created here always belong to a Custom Integration, so the general limits apply: 10 MB per file and 25 MB per message, and executable file types are rejected. Size limits only apply to files sent as data.

Sample request:

POST /thread/create
{
  "subject": "Where is my order?",
  "accountId": "8a1b1d6c-5f1a-4c8e-9f2b-7d3e5a9c1b40",
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "message": {
    "htmlBody": "My order has not arrived yet.",
    "attachments": [
      {
        "fileName": "receipt.png",
        "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ..."
      }
    ]
  }
}

Thread creation request with all required details

object
subject

The subject/title of the ticket. This is the main heading that describes the ticket

string
nullable
accountId

The ID of the account/integration where this ticket should be created

string format: uuid
customerId

The ID of the customer who created this ticket or who the ticket is about

string format: uuid
status
integer format: int32
Allowed values: 0 - Open 1 - InProgress 2 - ActionRequired 3 - Resolved 4 - AwaitingCustomer 5 - Snoozed
message
object
threadId

The ID of the thread/ticket to add this message to. Required when adding a message to an existing ticket

string format: uuid
isDelayed

Whether this message should be scheduled for later sending instead of being sent immediately. Default is false

boolean
sendingDate

The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true

string format: date-time
nullable
htmlBody

The HTML content of the message. This can include formatting, links, and embedded images

string
nullable
closeAfterSend

Whether to automatically close the ticket after this message is sent. Default is false

boolean
archiveAfterSend

Whether to automatically archive the ticket after this message is sent. Default is false

boolean
attachments

List of file attachments to include with this message. Can be empty if no attachments are needed

Array<object>
nullable
object
url

Path of a file already stored by Replyco, exactly as returned by a previous API response. Provide either ‘url’ or ‘data’ for each attachment. A URL is stored as given and is never downloaded, so an external address will not produce a working attachment

string
nullable
fileName

Required. The name of the file including its extension (e.g., “invoice.pdf”, “image.jpg”). The extension decides whether the integration accepts the file, so it must be present

string
nullable
data

Base64 encoded content of a new file to upload. Provide either ‘data’ or ‘url’. Size and file type limits apply and depend on the integration the ticket belongs to

string format: byte
nullable
fileFormat
string
nullable
mimeType
string
nullable
task
object
userId

The ID of the user to assign this task to. If null, the task is unassigned

string format: uuid
nullable
status
integer format: int32
Allowed values: 0 - NotSet 1 - ActionRequired 2 - InProgress 3 - Resolved 4 - WaitingForCustomer
username

The username of the assigned user. Can be used as an alternative to UserId

string
nullable

Example

{
"subject": "Lamp arrived with a broken shade",
"accountId": "3f1c2a9e-6b4d-4c8e-9f2a-1d5e7b3c9a06",
"customerId": "5c8a1e3f-7d2b-4f9c-8e6a-3b1d9f5c7e24",
"message": {
"htmlBody": "<p>Hello, the lamp from order SO-10482 arrived with a broken shade.</p>",
"attachments": [
{
"fileName": "broken-shade.jpg",
"data": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAE="
}
]
}
}

Thread was created successfully

Invalid request - missing required fields, an account that is not a Custom Integration, or an attachment that is too large, of a blocked file type, or missing its file name. The response body carries the reason in its ‘error’ field

User is not authenticated or authorized

User does not have permission to create threads