POST/ tickets/
Create ticket
You can create a ticket. You can also set up any custom attribute of your choice. If a specified custom attribute doesn't exist yet it will be created.
Attributes
Optional unless marked required
- user_id
- A unique identifier for the user which is given by User automatically.
- assigned_to
- A unique identifier for the agent which is given by User automatically.
- attachments
- An attachment for a ticket (gif, jpg, pdf).
- company_id
- A unique identifier for the company which is given by User automatically.
- custom_id
- The unique identifier for the ticket which is provided by the client.
- description
- A ticket description.
- due_date
- A date in the future by which the task should be completed. Compliance with ISO 8601 standard format.
- name
- A ticket name.
- participants
- A list of users' ids.
- priority
- A priority of your ticket.
- status
- A current status of the ticket (draft, active, closed or archived).
Request
- cURL
- JavaScript
- PHP
- Python
curl -X POST "https://<your_app_subdomain>.user.com/api/public/tickets/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"name": "Login page error",
"custom_id": "login-page-error",
"description": "Login page error: reported through the REST API.",
"status": "draft",
"due_date": "2026-11-24T13:24:16Z",
"priority": 1,
"user_id": 1909,
"company_id": 778,
"assigned_to": 9
}'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/tickets/",
{
method: "POST",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Login page error",
custom_id: "login-page-error",
description: "Login page error: reported through the REST API.",
status: "draft",
due_date: "2026-11-24T13:24:16Z",
priority: 1,
user_id: 1909,
company_id: 778,
assigned_to: 9,
}),
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/tickets/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Login page error",
"custom_id" => "login-page-error",
"description" => "Login page error: reported through the REST API.",
"status" => "draft",
"due_date" => "2026-11-24T13:24:16Z",
"priority" => 1,
"user_id" => 1909,
"company_id" => 778,
"assigned_to" => 9,
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.post(
"https://<your_app_subdomain>.user.com/api/public/tickets/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json={
"name": "Login page error",
"custom_id": "login-page-error",
"description": "Login page error: reported through the REST API.",
"status": "draft",
"due_date": "2026-11-24T13:24:16Z",
"priority": 1,
"user_id": 1909,
"company_id": 778,
"assigned_to": 9,
},
)
print(response.json())
Response examples
- 201 Created
- 400 Bad Request
{"id": 398,"name": "Login page error","custom_id": "login-page-error","description": "Login page error: reported through the REST API.","status": "draft","due_date": "2026-11-24T13:24:16Z","assigned_to": 9,"user_id": 1909,"company_id": 778,"participants": [],"priority": 1}{"name": ["This field is required."]}Response fields
Fields returned in the 201 Created response body.
- id
- A unique identifier for the ticket which is given by User automatically.
- name
- A ticket name.
- custom_id
- The unique identifier for the ticket which is provided by the client.
- description
- A ticket description.
- status
- A current status of the ticket (draft, active, closed or archived).
- due_date
- A date in the future by which the task should be completed. Compliance with ISO 8601 standard format.
- assigned_to
- A unique identifier for the agent which is given by User automatically.
- user_id
- A unique identifier for the user which is given by User automatically.
- company_id
- A unique identifier for the company which is given by User automatically.
- participants
- A list of users' ids.
- priority
- A priority of your ticket.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.