# Verify a user

`POST /api/v1/users/{id}/verify-email`

Following a user registration, the new user will receive an email asking to click a link
containing a secret.
This endpoint can also be used to verify a new email set in the user account.


Authentication: no security requirement declared for this operation.

Parameters:

- `id` (path, id, required) - Entity id
  Type: id
  
  Schema: [id](https://sourcey-peertube.pages.dev/api-rest-reference/models/id.md)
  
  minimum: 1
  
  Example:
  
  ```json
  42
  ```

Request body: application/json

Type: object

- `verificationString` (required)
  Type: string, url

- `isPendingEmail` (optional)
  Type: boolean

Responses:

- 204: successful operation

- 403: invalid verification string

- 404: user not found

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/users/42/verify-email' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "verificationString": "https://example.com",
  "isPendingEmail": true
}'
```

### JavaScript

```javascript
const body = `{
  "verificationString": "https://example.com",
  "isPendingEmail": true
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/users/42/verify-email', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "verificationString": "https://example.com",
  "isPendingEmail": true
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/users/42/verify-email',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
