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

# Editing a Ticket

> Update a ticket's visitor information, line assignment, or language preference.

To update a ticket, send a PATCH request to `/tickets/{ticketId}`. Only include fields you want to change — omitted fields remain unchanged. Set a field to `null` to clear its value.

<CodeGroup>
  ```bash curl theme={null}
  curl -X PATCH https://api.qminder.com/tickets/14848 \
    -H "X-Qminder-REST-API-Key: YOUR_API_KEY" \
    -H "X-Qminder-API-Version: 2020-09-01" \
    -H "Content-Type: application/json" \
    -d '{
      "firstName": "John",
      "lastName": "Smith",
      "email": "john.smith@example.com",
      "phoneNumber": "+12125551234"
    }'
  ```

  ```typescript TypeScript theme={null}
  import { Qminder } from 'qminder-api';
  Qminder.setKey('YOUR_API_KEY');

  await Qminder.Ticket.edit(14848, {
    firstName: 'John',
    lastName: 'Smith',
    email: 'john.smith@example.com',
    phoneNumber: '+12125551234',
  });
  ```
</CodeGroup>

### Editable Fields

All fields are optional — only include the fields you want to change.

| Field          | Type           | Description                                                                      |
| -------------- | -------------- | -------------------------------------------------------------------------------- |
| `firstName`    | string         | Visitor's first name (2-50 characters). Cannot be null or empty.                 |
| `lastName`     | string \| null | Visitor's last name (max 50 characters). Set to `null` to clear.                 |
| `email`        | string \| null | Visitor's email address (max 100 characters). Set to `null` to clear.            |
| `phoneNumber`  | string \| null | Phone number with optional + prefix (5-20 digits). Set to `null` to clear.       |
| `line`         | string         | ID of the line to move the ticket to. Must be a valid line in the same location. |
| `languageCode` | string         | Visitor's preferred language code, e.g. "en", "es" (2-5 characters).             |

### Error Responses

| Status | Description                         | Example                                                                   |
| ------ | ----------------------------------- | ------------------------------------------------------------------------- |
| 400    | Validation failed                   | `{"statusCode": 400, "message": "First name must not be empty or blank"}` |
| 404    | Ticket or line not found            | `{"message": "Ticket with id 123456 not found"}`                          |
| 409    | Target line is disabled or archived | `{"message": "Line with id 789 is disabled"}`                             |
