These endpoints let you open a ticket, update its status, and post replies. All require a Bearer token (see Tickets Overview).
Create a ticket
POST /company/tickets
Opens a new support case for the authenticated company. The body varies by ticket type: shipment-based types reference a shipment_id, credit types reference credit_id, and type-specific fields go inside data as a JSON string. Credit line tickets (type 19) additionally require a documents array.
On success the ticket is created with status Pending (1), a history entry is recorded, the ticket is auto-assigned to a support agent, and (when a shipment_id is present) it is linked to any matching shipment incidence.
Body
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
type_id | integer (≥ 1) | yes | — | Ticket type ID. See Ticket types. |
comments | string | optional | "" | Initial message from the customer. Recommended for context. |
data | string (JSON) | optional | — | JSON-stringified, type-specific fields stored as ticket variables. |
shipment_id | integer (≥ 1) | conditional | null | Shipment reference. Required for shipment-based types (lost, damaged, delay, wrong address, overweight…). |
credit_id | integer (≥ 1) | conditional | null | Credit/recharge reference for credit-based types. |
carrier_id | integer (≥ 1) | optional | null | Carrier reference (e.g. carrier activation, type 2). |
warehouse_package_id | string | optional | null | Warehouse package reference (PO box types). Accepts the package ID or the shipper name. |
documents | array<object> | conditional | — | Required for credit line (type 19). See sub-props below. |
documents[] item
| Prop | Type | Required | Description |
|---|---|---|---|
field_id | string (max 50) | yes | Identifier of the required document field. |
key | string | optional | Human-readable field key. |
type | string — file | input | date | optional | How the value should be interpreted. |
value | string (nullable) | optional | The document URL, text value, or date. |
curl --request POST \
--url https://queries.envia.com/company/tickets \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"type_id": 4,
"shipment_id": 123456,
"comments": "The package never arrived.",
"data": "{\"tracking_number\":\"1Z999AA10123456784\"}"
}'curl --request POST \
--url https://queries.envia.com/company/tickets \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"type_id": 9,
"comments": "Attaching the transfer receipt.",
"data": "{\"payment_method_id\":3,\"payment_method_name\":\"Bank transfer\",\"bank_account\":\"****1234\"}"
}'curl --request POST \
--url https://queries.envia.com/company/tickets \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"type_id": 19,
"comments": "Requesting a credit line.",
"data": "{\"amount\":50000,\"days\":30}",
"documents": [
{ "field_id": "official_id", "type": "file", "value": "https://.../id.pdf" },
{ "field_id": "proof_address", "type": "file", "value": "https://.../proof.pdf" }
]
}'Response 200
{ "id": 987654 }Duplicate protection. Creating a ticket for the same company + shipment + type while an open ticket already exists (status Pending, Follow up, In review, or Declined) returns
409 Conflictwith the message "A ticket has already been created for this shipment." Reuse the existing ticket instead.
Update a ticket
PUT /company/tickets/{ticket_id}
Updates a ticket's status (and optionally its variables and a comment). Customers can move a ticket to a limited set of statuses. Requests on terminal tickets (Accepted / Declined) are ignored.
Path parameters
| Param | Type | Required | Description |
|---|---|---|---|
ticket_id | integer (≥ 1) | yes | The ticket ID. |
Body
| Prop | Type | Required | Description |
|---|---|---|---|
ticket_status_id | integer — 1, 5, or 10 | yes | Target status: 1 Pending, 5 Follow up, 10 Claim in review. |
comments | string | optional | Optional message added with the update. |
data | string (JSON) | optional | Replaces the ticket variables with this JSON payload. |
A transition to Follow up (5) is only honored from an In review (6) or Incomplete (4) ticket, and may be gated by an automated relevance check. Otherwise the ticket keeps its current status.
curl --request PUT \
--url https://queries.envia.com/company/tickets/987654 \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"ticket_status_id": 5,
"comments": "I have uploaded the missing document.",
"data": "{\"tracking_number\":\"1Z999AA10123456784\"}"
}'Response 200
{ "data": true }Add a comment
POST /company/tickets/{ticket_id}/comments
Posts a customer reply to the ticket thread. Blocked on terminal tickets (Accepted / Declined). If the ticket is In review (6), posting a comment can transition it to Follow up (5) so an agent re-engages.
Path parameters
| Param | Type | Required | Description |
|---|---|---|---|
ticket_id | integer (≥ 1) | yes | The ticket ID. |
Body
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
comment | string | optional | "" | The reply message text. |
curl --request POST \
--url https://queries.envia.com/company/tickets/987654/comments \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data '{ "comment": "Here is the additional information you requested." }'Response 200
{ "data": true }