---
title: HTTP ingest API
description: Send log events to ZevSight with one POST, as JSON or NDJSON, optionally gzip-compressed, with an ingest token.
url: https://docs.zevsight.com/send/http-api
---

# HTTP ingest API

> Send log events to ZevSight with one POST, as JSON or NDJSON, optionally gzip-compressed, with an ingest token.

`POST https://ingest.zevsight.com/v1/ingest/events`

Use this when there is no SDK for your language, or when you want full control. Full field reference: [Ingest API reference](/api/reference/ingest).

## Authenticate

Send an ingest token (`zsi_…`) as a bearer token. It is the only header form accepted.

```http
Authorization: Bearer <INGEST_TOKEN>
```

Find or create tokens in the dashboard: **Services → your service → Connect**.

## Send a batch

```bash
curl -X POST https://ingest.zevsight.com/v1/ingest/events \
  -H "Authorization: Bearer <INGEST_TOKEN>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: batch-2026-11-29-0001" \
  -d '{
    "events": [
      {
        "service": "checkout",
        "environment": "production",
        "type": "log",
        "severity": "error",
        "ts": "2026-11-29T09:41:07.512Z",
        "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
        "attrs": { "route": "/v1/pay", "user.id": "42" },
        "resource": { "host.name": "web-1" },
        "body": {
          "message": "payment provider timeout after 3 retries",
          "fields": { "provider": "card", "attempt": 3 }
        }
      }
    ]
  }'
```

### Formats

| Content-Type | Body |
|---|---|
| `application/json` | `{"events": [ … ]}` with 1 to 5,000 events |
| `application/x-ndjson` | One event object per line |

Add `Content-Encoding: gzip` to send a compressed body. The size limit applies after decompression.

## Event fields

| Field | Required | Notes |
|---|---|---|
| `type` | yes | `log` for log lines. `heartbeat` is also accepted; `check_result` is refused for ingest tokens. |
| `body` | yes | For logs: `{"message": "...", "fields": { ... }}`. `message` is truncated above 64 KiB. `fields` holds structured data of any shape. |
| `service` | | Slug, default `unknown` (or the token's service). |
| `environment` | | Slug, default `production` (or the token's environment). |
| `severity` | | A level name: `trace`, `debug`, `info`, `warn`, `error`, `fatal`. Common logger spellings also work: `warning`, `err`, `critical`, `panic`, `notice`, `verbose` and more. Send a string, not a number. |
| `ts` | | RFC 3339. If it is more than 10 minutes in the future or more than 7 days in the past, the receive time is used and the original is kept in `attrs` as `zs.original_ts`. |
| `id` | | UUIDv7. Omit it and one is generated. Send your own to make retries safe. |
| `trace_id`, `span_id` | | 32 and 16 lowercase hex characters. Invalid values are moved aside, not rejected. |
| `attrs` | | Flat string map, searchable as `attrs.<key>:value`. Up to 128 keys. |
| `resource` | | Flat string map describing the source (host, version, region). Searchable as `resource.<key>:value`. |

Unknown top-level fields, and body keys other than `message` and `fields`, are dropped. Put structured data in `fields` and anything you want to filter on in `attrs`.

## Responses

A `202` means the events were durably queued. They are searchable within seconds, and visible in live tail sooner.

```json
{
  "accepted": 9,
  "rejected": [{ "index": 3, "field": "trace_id", "message": "..." }],
  "quota": { "used_ratio": 0.83, "state": "warning" }
}
```

- `rejected` lists events refused one by one. The rest were stored.
- `quota` appears once the workspace has used 80% of its monthly ingest.

| Status | Code | What to do |
|---|---|---|
| `400` | `INVALID_REQUEST` | Fix the request; every event in it was invalid. |
| `401` | `UNAUTHENTICATED` | Check the token, and that it is an ingest token. |
| `413` | `PAYLOAD_TOO_LARGE` | Split the batch: at most 5,000 events and 5 MiB decompressed. |
| `421` | `WRONG_REGION` | Send to the host in the response's `endpoint` field. |
| `429` | `RATE_LIMITED` or `QUOTA_EXCEEDED` | Wait for `Retry-After` seconds. |
| `503` | `UNAVAILABLE` | Nothing was stored. Retry after `Retry-After`. |

> **Note: Retries are safe**
>
> Writes are idempotent. Retry with the same `Idempotency-Key` (up to 128 characters) within 2 hours, or with the same event `id`s, and nothing is stored twice.

## Next

- [Limits and batching](/send/limits): sizes, rates and quota behaviour.
- [Other languages](/send/other-languages): Python, Go, Ruby and PHP examples.
- [Search syntax](/explore/search-syntax): how to find what you sent.
