Create a new thread (ticket)
const url = 'https://open-api.replyco.com/openapi/thread/create';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'}, body: '{ "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=" } ] } }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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..."
}
]
}
}
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Thread creation request with all required details
object
The subject/title of the ticket. This is the main heading that describes the ticket
The ID of the account/integration where this ticket should be created
The ID of the customer who created this ticket or who the ticket is about
object
The ID of the thread/ticket to add this message to. Required when adding a message to an existing ticket
Whether this message should be scheduled for later sending instead of being sent immediately. Default is false
The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true
The HTML content of the message. This can include formatting, links, and embedded images
Whether to automatically close the ticket after this message is sent. Default is false
Whether to automatically archive the ticket after this message is sent. Default is false
List of file attachments to include with this message. Can be empty if no attachments are needed
object
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
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
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
object
The ID of the user to assign this task to. If null, the task is unassigned
The username of the assigned user. Can be used as an alternative to UserId
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=" } ] }}object
The subject/title of the ticket. This is the main heading that describes the ticket
The ID of the account/integration where this ticket should be created
The ID of the customer who created this ticket or who the ticket is about
object
The ID of the thread/ticket to add this message to. Required when adding a message to an existing ticket
Whether this message should be scheduled for later sending instead of being sent immediately. Default is false
The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true
The HTML content of the message. This can include formatting, links, and embedded images
Whether to automatically close the ticket after this message is sent. Default is false
Whether to automatically archive the ticket after this message is sent. Default is false
List of file attachments to include with this message. Can be empty if no attachments are needed
object
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
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
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
object
The ID of the user to assign this task to. If null, the task is unassigned
The username of the assigned user. Can be used as an alternative to UserId
object
The subject/title of the ticket. This is the main heading that describes the ticket
The ID of the account/integration where this ticket should be created
The ID of the customer who created this ticket or who the ticket is about
object
The ID of the thread/ticket to add this message to. Required when adding a message to an existing ticket
Whether this message should be scheduled for later sending instead of being sent immediately. Default is false
The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true
The HTML content of the message. This can include formatting, links, and embedded images
Whether to automatically close the ticket after this message is sent. Default is false
Whether to automatically archive the ticket after this message is sent. Default is false
List of file attachments to include with this message. Can be empty if no attachments are needed
object
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
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
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
object
The ID of the user to assign this task to. If null, the task is unassigned
The username of the assigned user. Can be used as an alternative to UserId
object
The subject/title of the ticket. This is the main heading that describes the ticket
The ID of the account/integration where this ticket should be created
The ID of the customer who created this ticket or who the ticket is about
object
The ID of the thread/ticket to add this message to. Required when adding a message to an existing ticket
Whether this message should be scheduled for later sending instead of being sent immediately. Default is false
The scheduled date and time when this message should be sent. Only applicable when IsDelayed is true
The HTML content of the message. This can include formatting, links, and embedded images
Whether to automatically close the ticket after this message is sent. Default is false
Whether to automatically archive the ticket after this message is sent. Default is false
List of file attachments to include with this message. Can be empty if no attachments are needed
object
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
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
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
object
The ID of the user to assign this task to. If null, the task is unassigned
The username of the assigned user. Can be used as an alternative to UserId
Responses
Section titled “Responses”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