# Update Tickets

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

`PATCH /unified/ticketing/tickets/{id}`

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

## Supported integrations

Asana, Azure DevOps, Bitbucket, BMC Helix, Enchant, Freshdesk, Gorgias, Help Scout, Helpshift, Hive, HubSpot, Jira, Linear, Microsoft 365, Microsoft Planner, Pivotal Tracker, Planhat, Productboard, Qualtrics CoreXM, Quickbase for Project Management, SolarWinds Service Desk, SurveySparrow Ticket Management, Teamwork Project Management, Todoist, Trello, Wrike, Zoho Desk, Zoho Projects

## Path parameters

- **`id`** _(string, required)_
  The ID of the resource.

## 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.
- **`workspace_id`** _(unknown)_
- **`etag`** _(string)_
  The unique identifier for the specific version of the resource.
- **`ticket_type`** _(object)_
  Type of the ticket
  Allowed: `conversation`, `issue`
- **`organization`** _(object)_
- **`workspace`** _(object)_
  Workspace associated with the ticket

## Request body

- **`name`** _(string)_
  The name of the ticket
- **`assignees`** _(array<object>)_
  Users assigned to the ticket
  - **`id`** _(string, required)_
    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)_
  Status supports only for issue ticket type.
  Allowed: `pending`, `completed`, `approved`, `rejected`, `changes_requested`, `open`, `closed`, `pending`, `spam`, `trash`, `open`, `closed` (+11 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
- **`ticket_type`** _(object)_
  The type of the ticket.
  Allowed: `default_task`, `milestone`, `section`, `approval`
  - **`id`** _(string, required)_
    The unique identifier for a ticket type
  - **`name`** _(string)_
    The name of the ticket type
- **`description`** _(string)_
  Description of the ticket
- **`html_description`** _(string)_
  The HTML description of the task
- **`parent_ticket`** _(object)_
  Set either collection or parent_ticket.
  - **`id`** _(string)_
    The unique identifier for a ticket
  - **`name`** _(string)_
    The name of the ticket
- **`workspace`** _(string)_
  The unique identifier for the workspace. Required if collections is not provided.
- **`priority`** _(object)_
  Priority of the ticket
  - **`id`** _(string, required)_
    The unique identifier for a priority
  - **`name`** _(string)_
    The name of the priority
- **`custom_fields`** _(object)_
  Custom fields to set on the ticket
- **`collections`** _(array<object>)_
  Set either collection or parent_ticket.
  - **`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`
- **`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
- **`team`** _(object)_
  Team associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a team
  - **`name`** _(string)_
    The name of the team
- **`account`** _(object)_
  Account associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a contact
- **`tags`** _(array<object>)_
  Tags associated with the ticket
  - **`id`** _(string)_
    The unique identifier for a tag
  - **`name`** _(string, required)_
    The name of the tag
- **`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
- **`items`** _(object)_
  - **`id`** _(string)_
  - **`name`** _(string)_
  - **`emails`** _(array<object>)_
    The user's email addresses
    - **`email`** _(string, required)_
      The user's email address
    - **`type`** _(string)_
      The type of email address
- **`parent`** _(unknown)_
- **`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`
- **`assigness`** _(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 PATCH 'https://api.truto.one/unified/ticketing/tickets/{id}?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "your_name",
  "assignees": [],
  "status": "pending",
  "due_date": "your_due_date",
  "ticket_type": "default_task",
  "description": "your_description",
  "html_description": "your_html_description",
  "parent_ticket": {},
  "workspace": "your_workspace",
  "priority": {},
  "custom_fields": {},
  "collections": [],
  "contact": {},
  "team": {},
  "account": {},
  "tags": [],
  "source": {},
  "completed_at": "your_completed_at",
  "created_at": "your_created_at",
  "updated_at": "your_updated_at",
  "number": "your_number",
  "languages": [],
  "items": {},
  "created_by": {},
  "remote_data": {}
}'
```

### JavaScript

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

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

const response = await fetch(`https://api.truto.one/unified/ticketing/tickets/{id}?integrated_account_id=${integratedAccountId}`, {
  method: 'PATCH',
  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/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}
payload = {
    "name": "your_name",
    "assignees": [],
    "status": "pending",
    "due_date": "your_due_date",
    "ticket_type": "default_task",
    "description": "your_description",
    "html_description": "your_html_description",
    "parent_ticket": {},
    "workspace": "your_workspace",
    "priority": {},
    "custom_fields": {},
    "collections": [],
    "contact": {},
    "team": {},
    "account": {},
    "tags": [],
    "source": {},
    "completed_at": "your_completed_at",
    "created_at": "your_created_at",
    "updated_at": "your_updated_at",
    "number": "your_number",
    "languages": [],
    "items": {},
    "created_by": {},
    "remote_data": {}
}

response = requests.patch(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.update(
  'ticketing',
  'tickets',
  '<resource_id>',
  {
  "name": "your_name",
  "assignees": [],
  "status": "pending",
  "due_date": "your_due_date",
  "ticket_type": "default_task",
  "description": "your_description",
  "html_description": "your_html_description",
  "parent_ticket": {},
  "workspace": "your_workspace",
  "priority": {},
  "custom_fields": {},
  "collections": [],
  "contact": {},
  "team": {},
  "account": {},
  "tags": [],
  "source": {},
  "completed_at": "your_completed_at",
  "created_at": "your_created_at",
  "updated_at": "your_updated_at",
  "number": "your_number",
  "languages": [],
  "items": {},
  "created_by": {},
  "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.update(
        "ticketing",
        "tickets",
        "<resource_id>",
        {
        "name": "your_name",
        "assignees": [],
        "status": "pending",
        "due_date": "your_due_date",
        "ticket_type": "default_task",
        "description": "your_description",
        "html_description": "your_html_description",
        "parent_ticket": {},
        "workspace": "your_workspace",
        "priority": {},
        "custom_fields": {},
        "collections": [],
        "contact": {},
        "team": {},
        "account": {},
        "tags": [],
        "source": {},
        "completed_at": "your_completed_at",
        "created_at": "your_created_at",
        "updated_at": "your_updated_at",
        "number": "your_number",
        "languages": [],
        "items": {},
        "created_by": {},
        "remote_data": {}
},
        {"integrated_account_id": "<integrated_account_id>"}
    )
    print(result)

asyncio.run(main())
```
