# Send client log

`POST /api/v1/server/logs/client`

Authentication: no security requirement declared for this operation.

Request body: application/json

Type: SendClientLog

Schema: [SendClientLog](https://sourcey-peertube.pages.dev/api-rest-reference/models/sendclientlog.md)

- `message` (required)
  Type: string

- `url` (required)
  Type: string
  
  URL of the current user page

- `level` (required)
  Type: any
  
  enum: ["error","warn"]

- `stackTrace` (optional)
  Type: string
  
  Stack trace of the error if there is one

- `userAgent` (optional)
  Type: string
  
  User agent of the web browser that sends the message

- `meta` (optional)
  Type: string
  
  Additional information regarding this log

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/server/logs/client' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "message": "string",
  "url": "string",
  "level": "error",
  "stackTrace": "string",
  "userAgent": "string",
  "meta": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "message": "string",
  "url": "string",
  "level": "error",
  "stackTrace": "string",
  "userAgent": "string",
  "meta": "string"
}`;

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

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

### Python

```python
import requests

body = '''{
  "message": "string",
  "url": "string",
  "level": "error",
  "stackTrace": "string",
  "userAgent": "string",
  "meta": "string"
}'''

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