# Remove User (/api/events/tickets/remove)



## Event Type [#event-type]

```ts
"ticket.remove"
```

## Description [#description]

This event is triggered when a user is removed from a ticket channel, revoking their access to view and participate in the ticket.

## 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',
    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',
  },
  removedUser: {
    description: 'Discord user ID of the user who was removed from the ticket',
    type: 'string',
  },
}"
/>

## Example Payload [#example-payload]

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

## Example Usage [#example-usage]

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

  if (type === 'ticket.remove') {
    console.log(`User removed from ticket ${payload.ticketId}`);
    console.log(`Removed user: ${payload.removedUser}`);
    
    // Remove user from participant tracking
    await removeTicketParticipant({
      ticketId: payload.ticketId,
      userId: payload.removedUser,
      removedAt: new Date(),
    });
    
    // Log the removal for audit trail
    await logTicketAccess(payload.ticketId, payload.removedUser, 'removed');
  }

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

## Use Cases [#use-cases]

* Track ticket access changes
* Monitor participant removals
* Audit ticket access for compliance
* Update participant lists in external systems
* Log access revocation events
