> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.neetodesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting the Ticket ID

> Understand how to retrieve ticket IDs and numbers for API calls and customer communication.

## Overview

NeetoDesk uses two types of identifiers for tickets:

* **Ticket ID** - A unique UUID-based identifier required for API calls.
* **Ticket Number** - A sequential, user-friendly number for display and customer communication.

Both identifiers can be used interchangeably in API endpoints that require a ticket identifier.

## What is a Ticket ID?

A ticket ID is a unique UUID assigned to each ticket in your workspace. It's required for making API requests that interact with specific tickets, such as retrieving ticket details, updating tickets, or adding comments.
e.g., `123e4567-e89b-12d3-a456-426614174000`

## What is a Ticket Number?

A ticket number is a sequential identifier displayed in the NeetoDesk interface for each ticket in your workspace. Unlike ticket IDs, ticket numbers are user-friendly sequential numbers like `#1`, `#2`, `#3`, etc., primarily used for display purposes and customer communication.

## Getting Ticket Identifiers

There are two main ways to get ticket identifiers:

* **Using the API** - Programmatically retrieve all tickets and their identifiers.
* **From the URL** - Extract the number directly from your browser's address bar (ticket number only).

### Method 1: Using the API Endpoint

The [List all tickets](/api-reference/tickets/list) API endpoint returns both ticket IDs and numbers along with other ticket information.

#### Step-by-Step Instructions

1. **Make the API request**

   Send a `GET` request to the [List all tickets](/api-reference/tickets/list) API endpoint, including your API key in the request header.

2. **Parse the response**

   The response will contain an array of tickets, each with both `id` and `number` fields.

   Example:

   ```json theme={"system"}
   {
     "tickets": [
       {
         "id": "123e4567-e89b-12d3-a456-426614174000",
         "number": 1,
         "subject": "Unable to login to my account",
         "description": "I'm having trouble accessing my account after the recent update.",
         "priority": "high",
         "status": "open",
         "category": "technical_support",
         "created_at": "2024-01-15T10:30:00Z",
         "updated_at": "2024-01-20T14:45:00Z",
         "requester": {
           "id": "user123",
           "name": "John Doe",
           "email": "john.doe@example.com"
         }
       }
       // ... rest of the tickets
     ],
     "pagination": {
       "total_records": 1,
       "total_pages": 1,
       "current_page_number": 1,
       "page_size": 1
     }
   }
   ```

3. **Extract the ticket identifiers**

   From this example:

   * **Ticket ID**: `123e4567-e89b-12d3-a456-426614174000`
   * **Ticket Number**: `1`

   You can access both identifiers in your code from the response:

   <CodeGroup>
     ```javascript JavaScript theme={"system"}
     // Get the first ticket's ID and number
     const ticketId = response.tickets[0].id;
     const ticketNumber = response.tickets[0].number;

     // Or find a specific ticket by subject
     const loginTicket = response.tickets.find(ticket =>
       ticket.subject.includes("login")
     );
     const loginTicketId = loginTicket.id;
     const loginTicketNumber = loginTicket.number;
     ```

     ```python Python theme={"system"}
     # Get the first ticket's ID and number
     ticket_id = response['tickets'][0]['id']
     ticket_number = response['tickets'][0]['number']

     # Or find a specific ticket by subject
     login_ticket = next((ticket for ticket in response['tickets']
                         if 'login' in ticket['subject'].lower()), None)
     if login_ticket:
         login_ticket_id = login_ticket['id']
         login_ticket_number = login_ticket['number']
     ```

     ```bash Bash theme={"system"}
     # Get the first ticket's ID and number using jq
     ticket_id=$(echo "$response" | jq -r '.tickets[0].id')
     ticket_number=$(echo "$response" | jq -r '.tickets[0].number')

     # Or find a specific ticket by subject
     login_ticket_id=$(echo "$response" | jq -r '.tickets[] | select(.subject | contains("login")) | .id')
     login_ticket_number=$(echo "$response" | jq -r '.tickets[] | select(.subject | contains("login")) | .number')
     ```
   </CodeGroup>

<Note>
  The `tickets` array contains all tickets in your workspace. You can filter by subject, status, or other properties to find the specific ticket you need.
</Note>

### Method 2: From the URL (Ticket Numbers Only)

Ticket numbers also appear in NeetoDesk interface URLs, making them easy to identify when viewing tickets in the web interface. For example, in the URL:

```
https://{your-subdomain}.neetodesk.com/admin/tickets/10
```

The ticket number is: **10**

#### Step-by-Step Instructions

1. **Navigate to your ticket**

   Log into your NeetoDesk workspace and navigate to the ticket you want to work with.

2. **Locate the ticket URL**

   Once you're viewing the ticket, look at your browser's address bar. The URL will contain the ticket number.

3. **Extract the ticket number**

   The ticket number is found at the end of the URL path. Look for a pattern like:

   ```
   https://{your-subdomain}.neetodesk.com/admin/tickets/{ticket-number}
   ```

   The `{ticket-number}` part is what you need.

#### URL Examples

Here are some examples of how ticket numbers appear in URLs:

| URL Example                                        | Ticket Number |
| -------------------------------------------------- | ------------- |
| `https://mycompany.neetodesk.com/admin/tickets/1`  | `1`           |
| `https://support.neetodesk.com/admin/tickets/25`   | `25`          |
| `https://helpdesk.neetodesk.com/admin/tickets/150` | `150`         |
