# Create Tickets

> Source: https://truto.one/docs/api-reference/unified-ticketing-api/tickets/create/

`POST /unified/ticketing/tickets`

Resource: **Tickets** · API: **Unified Ticketing API**

## Supported integrations

Accelo, Asana, Azure DevOps, Bitbucket, BMC Helix, ClickUp, Enchant, Freshdesk, Gorgias, Help Scout, Helpshift, Hive, HubSpot, Intercom, Jira, Jira Service Management, Linear, LiveChat, Monday.com, Pivotal Tracker, Planhat, Productboard, Quickbase for Project Management, Salesforce, SolarWinds Service Desk, Todoist, Trello, Wrike, Zendesk, Zoho Desk, Zoho Projects

## Query parameters

- **`integrated_account_id`** _(string, required)_
  The ID of the integrated account to use for the request.
- **`truto_response_format`** _(string)_
  The format of the response. - `unified` returns the response with unified mappings applied. - `raw` returns the unprocessed, raw response from the remote API. - `normalized` applies the unified mappings and returns the data in a normalized format. - `stream` returns the response as a stream, which is ideal for transmitting large datasets, files, or binary data. Using streaming mode helps to efficiently handle large payloads or real-time data flows without requiring the entire data to be buffered in memory. Defaults to `unified`.
  Allowed: `unified`, `raw`, `normalized`, `stream`
- **`truto_ignore_remote_data`** _(boolean)_
  Excludes the `remote_data` attribute from the response.
- **`truto_exclude_fields`** _(array<string>)_
  Array of fields to exclude from the response.
- **`remote_query`** _(object)_
  Query parameters to pass to the underlying API without any transformations. Refer [this guide](https://truto.one/docs/api-reference/overview/querying#remote-query-parameters) to see how to structure the query parameters.
- **`ticket_type`** _(object)_
  Type of the ticket
  Allowed: `conversation`, `issue`
- **`workspace_id`** _(unknown)_
- **`collections`** _(array<object>)_
  Collection with type project is required.
- **`organization`** _(object)_
- **`workspace`** _(object)_
  Workspace associated with the ticket

## Request body

- **`name`** _(string)_
  The name of the ticket
- **`contact`** _(object)_
  Contact associated with the ticket
  - **`id`** _(string, required)_
    The unique identifier for a contact
  - **`first_name`** _(string)_
    The first name of the contact
  - **`last_name`** _(string)_
    The last name of the contact
  - **`name`** _(string)_
    The name of the contact
  - **`emails`** _(array<object>)_
    The emails of the contact
    - **`email`** _(string, required)_
      The email of the contact
    - **`type`** _(string)_
      The type of the email
  - **`phones`** _(array<object>)_
    The contact's phone number
    - **`number`** _(string, required)_
      The contact's phone number
    - **`type`** _(string)_
      The type of phone number
- **`account`** _(object)_
  Account associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
- **`ticket_type`** _(object)_
  Type of the ticket
  - **`id`** _(string, required)_
    The unique identifier for a ticket type
    Allowed: `default_task`, `milestone`, `section`, `approval`
  - **`name`** _(string)_
    The name of the ticket type
    Allowed: `default_task`, `milestone`, `section`, `approval`
- **`status`** _(object)_
  Status supports only for issue ticket type.
  Allowed: `pending`, `completed`, `approved`, `rejected`, `changes_requested`, `open`, `closed`, `archived`, `active`, `open`, `active`, `completed` (+5 more)
  - **`id`** _(string, required)_
    The unique identifier for a status
  - **`name`** _(string)_
    The name of the status
    Allowed: `active`, `closed`, `open`, `pending`, `spam`, `resolved`, `archived`, `deleted`, `completed`
- **`due_date`** _(string)_
  Due date of the ticket
- **`description`** _(string)_
  Description of the ticket
- **`assignees`** _(array<object>)_
  Users assigned to the ticket
  - **`id`** _(string, required)_
    The unique identifier for a user
  - **`name`** _(string, required)_
    The name of the user
  - **`first_name`** _(string)_
    The first name of the user
  - **`last_name`** _(string)_
    The last name of the user
  - **`emails`** _(array<object>)_
    The user's email addresses
    - **`email`** _(string, required)_
      The user's email address
    - **`type`** _(string)_
      The type of email address
  - **`phones`** _(array<object>)_
    The user's phone number
    - **`number`** _(string, required)_
      The user's phone number
    - **`type`** _(string)_
      The type of phone number
- **`priority`** _(object)_
  Priority of the ticket
  - **`id`** _(string, required)_
    The unique identifier for a priority
  - **`name`** _(string)_
    The name of the priority
- **`collections`** _(array<object>)_
  Collections associated with the ticket. One of parent_ticket, workspace or collections should be specified.
  - **`id`** _(string, required)_
    The unique identifier for a collection
  - **`name`** _(string)_
    The name of the collection
  - **`type`** _(string, required)_
    The type of the collection
    Allowed: `component`, `product`
- **`html_description`** _(string)_
  The HTML description of the task
- **`tags`** _(array<object>)_
  Tags associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a tag
  - **`name`** _(string, required)_
    The name of the tag
- **`parent_ticket`** _(object)_
  Parent ticket associated with the ticket. One of parent_ticket, workspace or collections should be specified.
  - **`id`** _(string)_
    The unique identifier for a ticket
  - **`name`** _(string)_
    The name of the ticket
- **`workspace`** _(string)_
  The unique identifier for the workspace. One of parent_ticket, workspace or collections should be specified.
- **`custom_fields`** _(object)_
  An object containing the custom fields to add to the Monday Item.
- **`team`** _(object)_
  Team associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a team
  - **`name`** _(string)_
    The name of the team
- **`source`** _(object)_
  The source of the ticket
  - **`id`** _(string)_
    The unique identifier for a source
  - **`name`** _(string)_
    The name of the source
- **`completed_at`** _(string)_
  Time at which the ticket was completed
- **`created_at`** _(string)_
  Time at which the ticket was created
- **`updated_at`** _(string)_
  Time at which the ticket was last updated
- **`number`** _(string)_
  An optional ticket number maintained by the system.
- **`languages`** _(array<string>)_
  Languages of the ticket
- **`comment`** _(object)_
  The comment to add to the ticket. The comment body has a limit of 4000 bytes.
  - **`author`** _(object)_
    The id of the user or contact who created the comment
    - **`id`** _(string)_
      The id of the user or contact who created the comment
    - **`type`** _(string, required)_
      Type of the author
      Allowed: `user`, `contact`, `user`, `contact`, `user`, `contact`, `user`, `contact`
    - **`emails`** _(array<object>)_
      The emails of the author
      - **`email`** _(string, required)_
        The email of the author
      - **`type`** _(string)_
        The type of the email
    - **`first_name`** _(string)_
      The first name of the author
    - **`last_name`** _(string)_
      The last name of the author
    - **`phones`** _(array<object>)_
      The phones of the author
      - **`number`** _(string)_
        The phone of the author
      - **`type`** _(string)_
        The type of the phone
  - **`body`** _(string, required)_
    The body of the comment
  - **`html_body`** _(string, required)_
    The body of the comment in HTML format
  - **`markdown_body`** _(string, required)_
    The body of the comment in Markdown format
- **`created_by`** _(object)_
  User or contact who created the ticket
  - **`id`** _(string)_
    The unique identifier for a user
  - **`name`** _(string)_
    The name of the user
  - **`type`** _(string)_
    The type of the user
    Allowed: `user`, `contact`
- **`additional_contacts`** _(array<object>)_
  Additional Contacts associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
  - **`first_name`** _(string)_
    The first name of the contact
  - **`last_name`** _(string)_
    The last name of the contact
  - **`name`** _(string)_
    The name of the contact
  - **`emails`** _(array<object>)_
    The emails of the contact
    - **`email`** _(string, required)_
      The email of the contact
    - **`type`** _(string)_
      The type of the email
  - **`phones`** _(array<object>)_
    The contact's phone number
    - **`number`** _(string, required)_
      The contact's phone number
    - **`type`** _(string)_
      The type of phone number
- **`group_id`** _(string)_
  The group the new item will belong to
- **`account_id`** _(unknown)_
- **`remote_data`** _(object)_
  Any additional data that should be passed as part of the request body. This data is not transformed by Truto and is passed as is to the remote API.

## Response body

- **`id`** _(string, required)_
  The unique identifier for a ticket
- **`name`** _(string)_
  The name of the ticket
- **`number`** _(string)_
  An optional ticket number maintained by the system.
- **`assignees`** _(array<object>)_
  Users assigned to the ticket
  - **`id`** _(string)_
    The unique identifier for a user
  - **`name`** _(string)_
    The name of the user
  - **`first_name`** _(string)_
    The first name of the user
  - **`last_name`** _(string)_
    The last name of the user
  - **`emails`** _(array<object>)_
    The user's email addresses
    - **`email`** _(string, required)_
      The user's email address
    - **`type`** _(string)_
      The type of email address
  - **`phones`** _(array<object>)_
    The user's phone number
    - **`number`** _(string, required)_
      The user's phone number
    - **`type`** _(string)_
      The type of phone number
- **`status`** _(object)_
  The status of the ticket
  - **`id`** _(string)_
    The unique identifier for a status
  - **`name`** _(string)_
    The name of the status
    Allowed: `active`, `closed`, `open`, `pending`, `spam`, `resolved`, `archived`, `deleted`, `completed`
- **`created_by`** _(object)_
  User or contact who created the ticket
  - **`id`** _(string)_
    The unique identifier for a user
  - **`name`** _(string)_
    The name of the user
  - **`type`** _(string)_
    The type of the user
    Allowed: `user`, `contact`
- **`due_date`** _(string)_
  Due date of the ticket
- **`description`** _(string)_
  Description of the ticket
- **`workspace`** _(object)_
  Workspace associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a workspace
  - **`name`** _(string)_
    The name of the workspace
- **`team`** _(object)_
  Team associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a team
  - **`name`** _(string)_
    The name of the team
- **`collections`** _(array<object>)_
  Collections associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a collection
  - **`name`** _(string)_
    The name of the collection
  - **`type`** _(string)_
    The type of the collection
- **`conversations`** _(array<object>)_
  Conversations associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a conversation
  - **`name`** _(string)_
    The name of the conversation
  - **`type`** _(string)_
    The type of the conversation
- **`ticket_type`** _(object)_
  Type of the ticket
  - **`id`** _(string)_
    The unique identifier for a ticket type
  - **`name`** _(string)_
    The name of the ticket type
- **`contact`** _(object)_
  Contact associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
  - **`first_name`** _(string)_
    The first name of the contact
  - **`last_name`** _(string)_
    The last name of the contact
  - **`name`** _(string)_
    The name of the contact
  - **`emails`** _(array<object>)_
    The emails of the contact
    - **`email`** _(string, required)_
      The email of the contact
    - **`type`** _(string)_
      The type of the email
  - **`phones`** _(array<object>)_
    The contact's phone number
    - **`number`** _(string, required)_
      The contact's phone number
    - **`type`** _(string)_
      The type of phone number
- **`additional_contacts`** _(array<object>)_
  Additional Contacts associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
  - **`first_name`** _(string)_
    The first name of the contact
  - **`last_name`** _(string)_
    The last name of the contact
  - **`name`** _(string)_
    The name of the contact
  - **`emails`** _(array<object>)_
    The emails of the contact
    - **`email`** _(string, required)_
      The email of the contact
    - **`type`** _(string)_
      The type of the email
  - **`phones`** _(array<object>)_
    The contact's phone number
    - **`number`** _(string, required)_
      The contact's phone number
    - **`type`** _(string)_
      The type of phone number
- **`account`** _(object)_
  Account associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
- **`parent_ticket`** _(object)_
  Parent ticket associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a ticket
  - **`name`** _(string)_
    The name of the ticket
- **`attachments`** _(array<object>)_
  Attachments associated with the ticket
  - **`id`** _(string)_
    The unique identifier for an attachment
  - **`file_name`** _(string)_
    The name of the attachment
  - **`file_url`** _(string)_
    The url of the attachment
- **`tags`** _(array<object>)_
  Tags associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a tag
  - **`name`** _(string)_
    The name of the tag
- **`created_at`** _(string)_
  Time at which the ticket was created
- **`updated_at`** _(string)_
  Time at which the ticket was last updated
- **`completed_at`** _(string)_
  Time at which the ticket was completed
- **`ticket_url`** _(string)_
  URL of the ticket
- **`priority`** _(object)_
  Priority of the ticket
  - **`id`** _(string)_
    The unique identifier for a priority
  - **`name`** _(string)_
    The name of the priority
- **`languages`** _(array<string>)_
  Languages of the ticket
- **`is_unread`** _(boolean)_
  Whether the ticket is unread
- **`source`** _(object)_
  The source of the ticket
  - **`id`** _(string)_
    The unique identifier for a source
  - **`name`** _(string)_
    The name of the source
- **`custom_fields`** _(object)_
  All the custom fields present on the ticket
- **`etag`** _(string)_
  The unique identifier for the specific version of the resource.
- **`remote_data`** _(object)_
  Raw data returned from the remote API call.

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/unified/ticketing/tickets?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "your_name",
  "contact": {},
  "account": {},
  "ticket_type": {},
  "status": "pending",
  "due_date": "your_due_date",
  "description": "your_description",
  "assignees": [],
  "priority": {},
  "collections": [],
  "html_description": "your_html_description",
  "tags": [],
  "parent_ticket": {},
  "workspace": "your_workspace",
  "custom_fields": {},
  "team": {},
  "source": {},
  "completed_at": "your_completed_at",
  "created_at": "your_created_at",
  "updated_at": "your_updated_at",
  "number": "your_number",
  "languages": [],
  "comment": {},
  "created_by": {},
  "additional_contacts": [],
  "group_id": "your_group_id",
  "remote_data": {}
}'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const body = {
  "name": "your_name",
  "contact": {},
  "account": {},
  "ticket_type": {},
  "status": "pending",
  "due_date": "your_due_date",
  "description": "your_description",
  "assignees": [],
  "priority": {},
  "collections": [],
  "html_description": "your_html_description",
  "tags": [],
  "parent_ticket": {},
  "workspace": "your_workspace",
  "custom_fields": {},
  "team": {},
  "source": {},
  "completed_at": "your_completed_at",
  "created_at": "your_created_at",
  "updated_at": "your_updated_at",
  "number": "your_number",
  "languages": [],
  "comment": {},
  "created_by": {},
  "additional_contacts": [],
  "group_id": "your_group_id",
  "remote_data": {}
};

const response = await fetch(`https://api.truto.one/unified/ticketing/tickets?integrated_account_id=${integratedAccountId}`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/unified/ticketing/tickets"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}
payload = {
    "name": "your_name",
    "contact": {},
    "account": {},
    "ticket_type": {},
    "status": "pending",
    "due_date": "your_due_date",
    "description": "your_description",
    "assignees": [],
    "priority": {},
    "collections": [],
    "html_description": "your_html_description",
    "tags": [],
    "parent_ticket": {},
    "workspace": "your_workspace",
    "custom_fields": {},
    "team": {},
    "source": {},
    "completed_at": "your_completed_at",
    "created_at": "your_created_at",
    "updated_at": "your_updated_at",
    "number": "your_number",
    "languages": [],
    "comment": {},
    "created_by": {},
    "additional_contacts": [],
    "group_id": "your_group_id",
    "remote_data": {}
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.unifiedApi.create(
  'ticketing',
  'tickets',
  {
  "name": "your_name",
  "contact": {},
  "account": {},
  "ticket_type": {},
  "status": "pending",
  "due_date": "your_due_date",
  "description": "your_description",
  "assignees": [],
  "priority": {},
  "collections": [],
  "html_description": "your_html_description",
  "tags": [],
  "parent_ticket": {},
  "workspace": "your_workspace",
  "custom_fields": {},
  "team": {},
  "source": {},
  "completed_at": "your_completed_at",
  "created_at": "your_created_at",
  "updated_at": "your_updated_at",
  "number": "your_number",
  "languages": [],
  "comment": {},
  "created_by": {},
  "additional_contacts": [],
  "group_id": "your_group_id",
  "remote_data": {}
},
  { integrated_account_id: '<integrated_account_id>' }
);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    result = await truto_api.unified_api.create(
        "ticketing",
        "tickets",
        {
        "name": "your_name",
        "contact": {},
        "account": {},
        "ticket_type": {},
        "status": "pending",
        "due_date": "your_due_date",
        "description": "your_description",
        "assignees": [],
        "priority": {},
        "collections": [],
        "html_description": "your_html_description",
        "tags": [],
        "parent_ticket": {},
        "workspace": "your_workspace",
        "custom_fields": {},
        "team": {},
        "source": {},
        "completed_at": "your_completed_at",
        "created_at": "your_created_at",
        "updated_at": "your_updated_at",
        "number": "your_number",
        "languages": [],
        "comment": {},
        "created_by": {},
        "additional_contacts": [],
        "group_id": "your_group_id",
        "remote_data": {}
},
        {"integrated_account_id": "<integrated_account_id>"}
    )
    print(result)

asyncio.run(main())
```
