---
title: "Cancel a staff invitation"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel a staff invitation

Path: Nicer API › identity

`DELETE /identity/{userId}/invite/{inviteId}`

URL: `https://api.nicer.travel/identity/{userId}/invite/{inviteId}`

Cancels a pending staff invitation of the acting agency and frees its email and phone lookup rows when nothing else uses them. An admin cancels any of the agency's; anyone else only one they sent. Answers the invitation as it was.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Path parameters

- `userId` (`identity.invite.delete.path.userId`; string, required)
- `inviteId` (`identity.invite.delete.path.inviteId`; string, required)

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
});

await nicer.identity.invite.delete({
  "userId": "string",
  "inviteId": "string"
});
```

### Nicer CLI

```bash
nicer identity invite delete --user-id 'string' --invite-id 'string'
```

### cURL

```bash
curl --request DELETE \
  --url 'https://api.nicer.travel/identity/<userId>/invite/<inviteId>' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/identity/<userId>/invite/<inviteId>';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/identity/<userId>/invite/<inviteId>"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "advisorId": "string",
  "companyName": "string",
  "createdBy": "string",
  "deleted": true,
  "email": "string",
  "expiresAt": "string",
  "familyName": "string",
  "fullName": "string",
  "givenName": "string",
  "invitedBy": "string",
  "lastModifiedBy": "string",
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "phoneNumber": "string",
  "resendCount": 0,
  "role": "advisor",
  "sendMessage": true,
  "inviteId": "string",
  "userId": "string",
  "createdAt": "string",
  "type": "Invite",
  "updatedAt": "string"
}
```

- `companyName` (`identity.invite.delete.response.200.companyName`; string, required) — The agency the invitation is to.
- `createdBy` (`identity.invite.delete.response.200.createdBy`; string, required) — The user id of whoever sent it, or SYSTEM for a paid Join.
- `invitedBy` (`identity.invite.delete.response.200.invitedBy`; string, required) — The user id of whoever sent it, or SYSTEM for a paid Join.
- `lastModifiedBy` (`identity.invite.delete.response.200.lastModifiedBy`; string, required) — The user id of whoever last changed it, or SYSTEM.
- `role` (`identity.invite.delete.response.200.role`; string, required) — The role the invitee gets on accepting.
  - one of `"advisor"`, `"traveler"`, `"admin"`, `"superadmin"`
- `inviteId` (`identity.invite.delete.response.200.inviteId`; string, required) — The invitation's id.
- `userId` (`identity.invite.delete.response.200.userId`; string, required) — The user id of whoever sent it; JOIN#<registrationId> for a paid Join.
- `createdAt` (`identity.invite.delete.response.200.createdAt`; string, required) — When it was sent.
- `type` (`identity.invite.delete.response.200.type`; string, required)
- `updatedAt` (`identity.invite.delete.response.200.updatedAt`; string, required) — When it last changed.
- `advisorId` (`identity.invite.delete.response.200.advisorId`; any of, optional) — The advisor some older invitations name.
  - any of the following: `string`, `null`
- `deleted` (`identity.invite.delete.response.200.deleted`; boolean, optional) — True once it was cancelled.
- `email` (`identity.invite.delete.response.200.email`; string, optional) — The email it was sent to.
- `expiresAt` (`identity.invite.delete.response.200.expiresAt`; string, optional) — When it can no longer be accepted; one without it expires seven days after createdAt.
- `familyName` (`identity.invite.delete.response.200.familyName`; string, optional) — The invitee's last name.
- `fullName` (`identity.invite.delete.response.200.fullName`; string, optional) — The invitee's first and last name, joined.
- `givenName` (`identity.invite.delete.response.200.givenName`; string, optional) — The invitee's first name.
- `metadata` (`identity.invite.delete.response.200.metadata`; map of string, optional) — Details stored with it, such as joinRegistrationId.
- `phoneNumber` (`identity.invite.delete.response.200.phoneNumber`; string, optional) — The phone it was sent to.
- `resendCount` (`identity.invite.delete.response.200.resendCount`; number, optional) — How many times it was sent again; four at most.
- `sendMessage` (`identity.invite.delete.response.200.sendMessage`; boolean, optional) — Whether the request asked to send it, kept on invitations of a person whose traveler account was opened from a staff invitation.

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.invite.delete.response.400.errorCode`; string, required)
- `errorMessage` (`identity.invite.delete.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.invite.delete.response.401.errorCode`; string, required)
- `errorMessage` (`identity.invite.delete.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.invite.delete.response.403.errorCode`; string, required)
- `errorMessage` (`identity.invite.delete.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.invite.delete/index.md
