Skip to content

CSAT API

API endpoints for the CSAT module. All endpoints require JWT authentication and are prefixed with /csat.

Authentication

All endpoints require a valid JWT token:

Authorization: Bearer <token>

Role-based access is enforced per endpoint (see the Auth column).

Endpoints

MethodPathDescriptionAuth
GET/csatList ratings with filters and paginationmenu-csat
GET/csat/{id}Get full details for a single ratingmenu-csat
GET/csat/ticket/{ticketId}Get rating details by ticket IDmenu-csat or company-request-view
POST/csat/commentsAdd admin follow-up commentcsat-add-comments
PUT/csat/commentsUpdate admin follow-up commentcsat-update-comments
GET/csat/agents/listList available agents for filteringmenu-csat

GET /csat

Returns a paginated, filterable list of CSAT ratings for the DataTable component.

Query Parameters

ParamTypeRequiredDescription
startnumberNoPagination offset (default: 0)
lengthnumberNoItems per page (default: 100)
sortBystringNoSort column: reference, rating, companyId, ratingDate, source
sortTypestringNoSort direction: ASC or DESC
reportbooleanNoIf true, returns streaming chunked response for export
localeIdanyNoLocale filter (resolved by middleware)
companyIdstringNoComma-separated company IDs
sourcestringNoComma-separated source types: ticket, carrier, shop
sourcePlatformstringNoComma-separated platforms: platform, whatsapp
ratingstringNoFilter by rating value
scorestringNoComma-separated star scores: 1, 2, 3, 4, 5
startDatestringNoDate range start (YYYY-MM-DD)
endDatestringNoDate range end (YYYY-MM-DD)
agentsstringNoComma-separated agent IDs
carrierstringNoComma-separated carrier names

Response (200)

json
{
  "data": [
    {
      "rating_id": 1234,
      "rating": 4,
      "comment": "Good service, fast delivery",
      "source_platform": "platform",
      "rating_date": "2026-04-10T14:30:00Z",
      "source": "ticket",
      "reference_id": 5678,
      "company_id": 100,
      "company_name": "Acme Corp",
      "country": "MX",
      "country_img": "https://s3.../mx.svg",
      "ticket_type": "overweight",
      "ticket_type_description": "Overweight",
      "ticketsStatusDescription": "Accepted",
      "ticketsStatusColor": "#28a745",
      "carrier": "FedEx",
      "carrier_name": "FedEx",
      "logo": "https://s3.../FedEx.svg",
      "follow_up_comments": null,
      "follow_up_created_by": null
    }
  ],
  "draw": 50,
  "recordsTotal": 1250,
  "recordsFiltered": 1250
}

Report Mode

When report=true, the response uses Transfer-Encoding: chunked streaming. The backend iterates through all matching ratings in batches (1000 per chunk) and writes each batch as a JSON array to the stream.

GET /csat/{id}

Returns full details for a single rating, including resolution agent and resolution time.

Path Parameters

ParamTypeRequiredDescription
idnumberYesRating ID

Response (200)

json
{
  "details": {
    "rating_id": 1234,
    "rating": 4,
    "comment": "Good service",
    "rating_date": "2026-04-10T14:30:00Z",
    "source": "ticket",
    "reference_id": 5678,
    "company_id": 100,
    "company_name": "Acme Corp",
    "country": "MX",
    "ticket_type": "overweight",
    "ticket_type_description": "Overweight",
    "user_name": "John Customer",
    "admin_name": "Admin User",
    "admin_solution_name": "Support Agent",
    "diff_hours": 12,
    "latest_comment_date": "2026-04-10T14:00:00Z",
    "follow_up_comments": "Issue resolved successfully",
    "follow_up_created_at": "2026-04-11T10:00:00Z",
    "follow_up_created_by": 42
  }
}

GET /csat/ticket/{ticketId}

Returns CSAT rating details for a specific ticket. Used by the inline CsatSurveyCard component in the ticket chat view.

Path Parameters

ParamTypeRequiredDescription
ticketIdnumberYesTicket ID

Response (200)

Same structure as GET /csat/{id}, but looks up by ticket_id instead of rating.id. Returns { details: null } if no rating exists for the ticket.

Permission Note

This endpoint accepts either menu-csat or company-request-view permission. This means any admin who can view tickets can also see their CSAT data, without needing explicit CSAT module access.

POST /csat/comments

Adds an admin follow-up comment to a rating.

Request

json
{
  "ratingId": 1234,
  "comments": "We have addressed this issue and improved our process."
}

Response (200)

json
{
  "success": true
}

PUT /csat/comments

Updates an existing admin follow-up comment. Uses the same payload as POST.

Request

json
{
  "ratingId": 1234,
  "comments": "Updated: Follow-up complete, customer contacted."
}

Response (200)

json
{
  "success": true
}

GET /csat/agents/list

Returns a list of active administrators for use as filter options in the CSAT table.

Response (200)

json
{
  "list": [
    { "id": 1, "value": 1, "label": "Agent One", "text": "Agent One" },
    { "id": 2, "value": 2, "label": "Agent Two", "text": "Agent Two" }
  ]
}

Common Error Responses

All errors follow the Boom format:

json
{
  "statusCode": 409,
  "error": "Conflict",
  "message": "Descriptive error message"
}
StatusWhen
400Validation failed (Joi schema)
401Missing or invalid JWT
403Insufficient permissions
409Business logic error (query failure, invalid data)
422Malformed request parameters

Envia Admin