How can we help?

Attaching Files to Tickets Using the LiveAgent API

How to Attach Files to Tickets via API

This article explains how to attach files to tickets using the LiveAgent API. File attachments can be included in ticket messages and notes created through the API.

Overview

Attaching files to tickets via API is a two-step process:

  1. Upload the file to the system using the file upload endpoint
  2. Reference the uploaded file when creating a ticket message or note

Step 1: Upload the File

First, you need to upload your file to the LiveAgent system. You can use either of the following endpoints:

Option A: API v1 File Upload

Use the POST /api/files endpoint to upload a file. For detailed information, see the Complete API reference for file upload.

Option B: API v3 File Upload

Alternatively, you can use the POST /files endpoint in API v3. For detailed information, see the API v3 documentation for file upload.

Important: Both endpoints work for uploading files, but you must use API v1 for creating ticket messages with attachments (see Step 2 below).

Step 2: Create a Ticket Message with the File Attachment

After uploading the file, the API response will contain a fileid parameter. This is a unique identifier generated by the system for your uploaded file.

Use this fileid in the attachments parameter when creating a new ticket message or note via the POST /api/conversations/[conversationid]/messages endpoint in API v1.

For detailed information on creating messages with attachments, see the Complete API reference for creating conversation messages.

Important Notes

  • File uploads can be performed using either API v1 or API v3
  • Ticket messages with attachments must be created using API v1 only
  • Always use the fileid returned from the file upload response when attaching files to messages
  • The conversationid parameter is required when creating messages with attachments

Summary

To attach files to tickets via API:

  1. Upload your file using POST /api/files (API v1) or POST /files (API v3)
  2. Extract the fileid from the response
  3. Create a ticket message using POST /api/conversations/[conversationid]/messages (API v1) with the fileid in the attachments parameter