# Rename (/api/events/tickets/rename)



## Event Type [#event-type]

```ts
"ticket.rename"
```

## Description [#description]

This event is triggered when a ticket channel is renamed using the rename command or button.

## Payload Structure [#payload-structure]

<TypeTable
  type="{
  ticketId: {
    description: 'Unique identifier for the ticket',
    type: 'string',
  },
  panelId: {
    description: 'ID of the panel the ticket belongs to',
    type: 'string',
  },
  channel: {
    description: 'Discord channel information (with new name)',
    type: '{ id: string; name: string; }',
  },
  creatorId: {
    description: 'Discord user ID of who created the ticket',
    type: 'string',
  },
  openDate: {
    description: 'ISO 8601 timestamp when the ticket was created',
    type: 'string',
  },
  oldName: {
    description: 'Previous channel name',
    type: 'string',
  },
  newName: {
    description: 'New channel name',
    type: 'string',
  },
}"
/>

## Example Payload [#example-payload]

```json
{
  "type": "ticket.rename",
  "payload": {
    "ticketId": "TKT-1234",
    "panelId": "support-panel",
    "channel": {
      "id": "1140972530400776294",
      "name": "billing-issue"
    },
    "creatorId": "713115896805064856",
    "openDate": "2024-01-18T15:30:00.000Z",
    "oldName": "ticket-0001",
    "newName": "billing-issue"
  }
}
```

## Example Usage [#example-usage]

```ts
app.post('/webhook', (req, res) => {
  const { type, payload } = req.body;

  if (type === 'ticket.rename') {
    console.log(`Ticket renamed:`);
    console.log(`  Old: ${payload.oldName}`);
    console.log(`  New: ${payload.newName}`);
    
    // Log the rename event
    await logTicketRename({
      ticketId: payload.ticketId,
      oldName: payload.oldName,
      newName: payload.newName,
      timestamp: new Date(),
    });
  }

  res.status(200).send('OK');
});
```

## Use Cases [#use-cases]

* Track ticket name changes for audit logs
* Update ticket names in external systems
* Analyze common rename patterns
* Monitor ticket organization practices
