# Delete Tickets

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

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

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

## Supported integrations

BMC Helix, Help Scout, Hive, HubSpot, Jira, Jira Service Management, Linear, Microsoft 365, Microsoft Planner, Pivotal Tracker, Planhat, Productboard, Qualtrics CoreXM, SolarWinds Service Desk, SurveySparrow Ticket Management, Teamwork Project Management, Todoist, Trello, Wrike, 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.
- **`etag`** _(string)_
  The unique identifier for the specific version of the resource.
- **`ticket_type`** _(object)_
  Type of the ticket
  Allowed: `conversation`, `issue`, `task`
- **`organization`** _(object)_
- **`workspace`** _(object)_
  Workspace associated with the ticket

## 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 DELETE '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'
```

### JavaScript

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

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

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>"
}

response = requests.delete(url, headers=headers, params=params)
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.delete(
  'ticketing',
  'tickets',
  '<resource_id>',
  { 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.delete(
        "ticketing",
        "tickets",
        "<resource_id>",
        {"integrated_account_id": "<integrated_account_id>"}
    )
    print(result)

asyncio.run(main())
```
