HTTP API Reference


The HTTP API is how every Understand.io SDK sends data, and you can call it directly from any language or runtime that can make an HTTPS request.

Endpoint

POST https://api.understand.io/{input-key}
  • {input-key} is your channel's input key (see below).
  • The body is JSON. A Content-Type: application/json header is recommended but not required.
  • CORS is enabled, so the endpoint can be called from browser code.

Optional header:

Header Value Effect
Understand-Auto-Detect client_ip Stores the IP address the request came from in the client_ip field.

Input Keys

The input key identifies the channel that events are stored in. The SDKs call this setting token (for example UNDERSTAND_TOKEN or token: '...'), but it is the same value. You can find and create input keys in your channel under Settings → Input Tokens.

An input key can only send data. With an input key, someone can:

  • send events to your channel, and
  • read your channel's total event count (POST /api/v1/count).

It cannot read your events, errors, search results or settings. Reading data always requires signing in to the dashboard, or an AI assistant that you approved yourself (see MCP Server).

This makes the input key safe to use in browser code, where anyone can see it. The risk of a public key is that someone could send junk events that count towards your plan. To limit this:

  • Use a separate input key for browser code and for server code. A channel can have several keys.
  • If a key is abused, create a new key and delete the old one. Events sent with the deleted key are rejected.
  • Never put your Understand.io account password or AI assistant access in client code. Only the input key belongs there.

Request Body

The body is either one event (a JSON object) or a batch of events (a JSON array of objects):

{"message": "my very first event"}
[
  {"message": "first event"},
  {"message": "second event", "level": "warning"}
]

There are no required fields. Any valid, non-empty JSON object is stored. The fields below have a special meaning; any other field you send (for example user_id, page, role or nested objects) is stored as is and can be searched and filtered.

Event Fields

Field Type Description
message string The text of the event. Shown as the title of an error.
level string Severity, for example info or error. See Levels.
env string Environment, for example production or staging. Optional for the API; the SDKs default it to production. Recommended, because it lets you filter errors by environment.
timestamp number or string When the event happened: seconds or milliseconds since the epoch (integer or decimal) or an ISO 8601 date string. Optional; defaults to the time the event is received.
tags string or array of strings Labels for filtering. See Tags.
group_id string Groups events into one error. See What Appears in Errors.
class string Exception class, for example TypeError.
file string File where the error happened.
line number Line where the error happened.
stack array Stack trace: a list of frames such as {"file": "app.js", "line": 10, "function": "save"}. The first frame is used as the error location when file/line are missing.
user_id string or number The affected user. Used for the "affected users" count of an error.
client_ip string Client IP address. Can be filled automatically with the Understand-Auto-Detect header.

__understand_meta is reserved: it is set by Understand.io and anything you send in it is overwritten.

Levels

level can be any string, so you can use the names your logging library uses. These values have a special meaning:

Level Meaning
fatal, emergency, alert, critical, error Error levels. An event with an error level and exception data (class or stack) appears in Errors.
warning, notice, info, log, debug Log levels. Stored and searchable in Search. They appear in Errors only when they have a group_id or an SDK error tag (see below).

Tags

tags is a string or an array of strings. Values that are not strings are removed.

The SDKs add one tag to every event so you can tell where it came from:

Tag Added by Meaning
error_log Laravel An exception reported by the Laravel SDK.
laravel_log Laravel A log entry from the Laravel SDK.
js_error_log JavaScript An event with level fatal, critical, error or warning.
js_log JavaScript An event with level info, log or debug.
py_error_log Python An exception reported by the Python SDK.

The error tags (error_log, js_error_log, py_error_log) make an event appear in Errors. This is why warnings sent by the JavaScript SDK are listed there.

What Appears in Errors

An event appears in Errors, grouped with other occurrences of the same error, when any of these is true:

  1. It has a group_id (at any level).
  2. It has an SDK error tag: error_log, js_error_log or py_error_log.
  3. Its level is an error level (fatal, emergency, alert, critical, error) and it has a class or a stack.

All other events are stored and searchable in Search, but they are not shown in Errors.

How events are grouped

  • If you send a group_id, it decides the grouping. Any string works, for example "checkout-failed". A 40-character value, such as a SHA-1 hash, is stored as is; other values are hashed.
  • Otherwise the group is derived from class, file and line (or the first stack frame). Without a file or line, the message is used as well.

The SDKs set group_id for you when they report an exception.

Sensitive Data Masking

Sensitive data is masked when it arrives, before it is stored:

  • Values of these fields are replaced with [value hidden], at any depth and regardless of case or separators (Card-Number, card_number and cardNumber all match): password, password_confirmation, token, access_token, refresh_token, secret, secret_key, api_key, access_key, authorization, cvv, cvc, card_number, cookie, cookies, set_cookie.
  • Payment card numbers anywhere in the event are masked down to their last 4 digits.

The SDKs can also hide fields before sending. See the SDK pages for their hidden fields settings.

Responses

Status Body Meaning
200 {"count": 2, "ids": ["…", "…"], "status": true} The events were accepted. count is the number of events, ids has one event ID per event, in the order they were sent.
400 {"status": false, "error": …} The request was rejected: the body is empty, not valid JSON, not a JSON object or array, an empty object, or larger than the size limit. Do not retry without fixing the request.
401 {"status": false, "error": "…"} The input key is wrong or deleted (Incorrect Input Key.), or the channel is locked, for example because the plan's monthly event allowance is used up (Channel access denied. …).
503 {"status": false, "error": {"message": "Event queue unavailable, …"}} The events were not stored because of a temporary problem on our side. Retry after the number of seconds in the Retry-After header.
500 {"status": false, "error": "Internal error #1"} Unexpected error. Retry later.

Event IDs. Every accepted event gets an ID, returned in ids. Keep it in your own logs: it identifies the exact event in Understand.io, so you can check that an event was stored and find it later.

Retrying. Retry only on 503, 500 or network errors, with a delay. If a batch fails with 503, some events of that batch may already be stored, so a retry can store them twice.

Limits

Limit Value
Request body size 2 MB per request (single event or batch).
Events per request No fixed limit, as long as the body fits in 2 MB.
Event volume Your plan's monthly event allowance. When it is used up, the channel is locked and the API answers 401 until the next billing period or a plan upgrade.

There is no per-second request limit for sending events. For high volumes, send events in batches instead of one request per event.

Examples

A log event

curl -XPOST https://api.understand.io/your-input-key \
  -H 'Content-Type: application/json' \
  -d '{"message": "user signed up", "level": "info", "env": "production", "user_id": 42}'

An error

curl -XPOST https://api.understand.io/your-input-key \
  -H 'Content-Type: application/json' \
  -d '{
    "message": "Cannot read properties of undefined (reading \"id\")",
    "level": "error",
    "env": "production",
    "class": "TypeError",
    "file": "app/checkout/page.tsx",
    "line": 42,
    "user_id": 42,
    "tags": ["checkout"]
  }'

From JavaScript without an SDK (works in browsers, Node.js 18+ and edge runtimes):

async function sendToUnderstand(event) {
  const response = await fetch('https://api.understand.io/your-input-key', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ env: 'production', timestamp: Date.now(), ...event })
  });

  if (!response.ok) {
    // 400/401: fix the request or key; 503/500: retry later
    throw new Error('Understand.io responded with ' + response.status);
  }

  const { ids } = await response.json();
  return ids; // event IDs, one per event
}