---
title: Send a log
project: OpenLogger
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/openlogger/1-0/reference/send-log/
updated: 2026-11-19T08:02:31.630Z
---

# Send a log

> POST / stores one log: the fields, their limits and an example.

`POST /` stores one log. Send it with an [API token](../../guides/api-tokens/).

## Request

```bash
curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \
  -d '{
    "app": "Demo project",
    "type": "error",
    "schema": "Reports",
    "message": "Report export failed: timeout",
    "userid": "u101",
    "username": "John Smith",
    "url": "https://app.example.com/reports/",
    "ip": "198.51.100.7",
    "ua": "Chrome 131 (Windows)",
    "data": "{\"report\":\"monthly\",\"timeout\":30000}"
  }' \
  https://logs.example.com/
```

Response `200`:

```json
{"success":true}
```

## Fields

| Field | Required | Max. length | What it holds |
|---|---|---|---|
| `app` | yes | 40 | The name of the app, for example `Demo project`. Shown in **App**. |
| `type` | no | | `info`, `warning`, `error` or `success`, in lower case. Any other value, or none, is stored as `info`. |
| `message` | no | 500 | The text of the log. |
| `schema` | no | 50 | The part of the app, for example `Orders` or `Users`. |
| `userid` | no | 30 | The ID of the user. |
| `username` | no | 50 | The name of the user. |
| `url` | no | 100 | The address the user was on. |
| `ip` | no | 80 | The IP address of the user. |
| `ua` | no | 30 | The device or browser, shown in **Device**. |
| `data` | no | | Extra data as a **JSON string**. Shown formatted in [Log detail](../../guides/log-detail/). |
| `reference` | no | 50 | Your own reference, for example an order number. Only in the [downloaded file](../../guides/download-logs/). |
| `date` | no | | The time of the event, as an ISO date. Only in the downloaded file. Without it, the time of arrival is used. |
| `clientside` | no | | `true` if the event happened in the browser. Only in the downloaded file. |

OpenLogger adds `id` and `dtcreated`, the time it received the log. Other fields are ignored.

## Rules

- A longer value is cut to the maximum length, without an error.
- `data` must be a string. Turn an object into JSON first, for example with `JSON.stringify()` in JavaScript. An object sent as it is gets stored empty.
- Without `app`, the request fails with `400`. See [Errors](../errors/).
