# Regenerate invite link

> Source: https://docs.clonepartner.com/api-reference/users/regenerate-invite/

`POST /api/users/{id}/regenerate-invite`

Invalidates any existing invite tokens for the user, resets their password to a random
placeholder, clears any existing TOTP secret, marks TOTP unverified, and generates a
new invite token with 48h expiry.

**Operation ID:** `regenerateInvite`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID

## Success responses

### 200

New invite token generated

**Content type:** `application/json`

- Type: `object`
- Properties:
  - `invite_token` (`string`)

## Error responses

### 403

Insufficient permissions


### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/users/YOUR_ID/regenerate-invite' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/users/YOUR_ID/regenerate-invite', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
