← Back to guidesGUIDE · TICKETING

Add comments and files to a ticket

Ticketing10 minIntermediate

Ticket comments and ticket documents are separate sub-resources in the API. Comments use JSON, while file uploads use multipart form data. This guide covers the common read and write operations for both.

Endpoints used in this guide

GET/api/v1/tickets/{id}/commentsList comments for a ticket.
POST/api/v1/tickets/{id}/commentsAdd a comment to a ticket.
GET/api/v1/tickets/{id}/documentsList files attached to a ticket.
POST/api/v1/tickets/{id}/documentsUpload a file using multipart form data.
GET/api/v1/tickets/{id}/documents/{documentId}Download a single ticket file.

Create a comment

The main required field is comment_text. The schema also supports is_internal, is_resolution, and time_spent when you need them.

curl
curl -X POST "https://algapsa.com/api/v1/tickets/$TICKET_ID/comments" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ALGA_API_KEY" \
  -d '{
    "comment_text": "We reproduced the issue and are collecting logs now.",
    "is_internal": false
  }'

Suppress notifications

By default, posting a comment notifies the ticket contacts and assigned technicians. To skip those notifications for a single operation, add either or both silent-update flags to the request body:

  • suppressContactNotifications — suppresses customer-facing email and portal notifications.
  • suppressInternalNotifications — additionally suppresses agent, watcher, in-app, and push notifications. Only valid when suppressContactNotifications is also true.
curl
curl -X POST "https://algapsa.com/api/v1/tickets/$TICKET_ID/comments" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ALGA_API_KEY" \
  -d '{
    "comment_text": "Internal escalation note — do not notify customer.",
    "is_internal": true,
    "suppressContactNotifications": true,
    "suppressInternalNotifications": true
  }'

Silent updates still produce audit records, activity entries, workflow triggers, and webhook deliveries. The same flags apply to all other ticket mutation endpoints too — see the Tickets API reference for the full list.

List existing comments

curl
curl -X GET "https://algapsa.com/api/v1/tickets/$TICKET_ID/comments" \
  -H "X-API-Key: $ALGA_API_KEY"

Upload a file to the ticket

File uploads use multipart/form-data. The controller expects a file field named file.

curl
curl -X POST "https://algapsa.com/api/v1/tickets/$TICKET_ID/documents" \
  -H "X-API-Key: $ALGA_API_KEY" \
  -F "file=@./incident-screenshot.png"
TypeScript
const formData = new FormData();
formData.append('file', fileInput.files![0]);

const response = await fetch(
  'https://algapsa.com/api/v1/tickets/' + ticketId + '/documents',
  {
    method: 'POST',
    headers: {
      'X-API-Key': process.env.ALGA_API_KEY!,
    },
    body: formData,
  },
);

const result = await response.json();
if (!response.ok) {
  throw new Error(result.error?.message ?? 'Upload failed');
}

List and download files

curl
curl -X GET "https://algapsa.com/api/v1/tickets/$TICKET_ID/documents" \
  -H "X-API-Key: $ALGA_API_KEY"

curl -X GET "https://algapsa.com/api/v1/tickets/$TICKET_ID/documents/$DOCUMENT_ID" \
  -H "X-API-Key: $ALGA_API_KEY" \
  -o downloaded-file.bin

Good defaults

  • Use public comments for customer-visible updates and internal comments for technician notes.
  • Keep uploads behind explicit user actions so you can show progress and handle failures cleanly.
  • Persist the returned comment IDs and document IDs if your integration needs later updates or cleanup.