---
title: api-ingest
description: The OTLP intake. Port 4100.
---

Accepts OTLP over HTTP at `/v1/logs` and `/v1/traces`, as protobuf or JSON, optionally gzipped. The project key comes from `Authorization: Bearer <key>` or the `key` query parameter. Logs and spans are queued in Redis and drained into ClickHouse; errors are queued for [worker-errors](/self-hosting/services/worker-errors).

Reads [PostgreSQL](/self-hosting/configuration#postgresql), [ClickHouse](/self-hosting/configuration#clickhouse), [Redis](/self-hosting/configuration#redis), the [ingest queue](/self-hosting/configuration#ingest-queue), [proxies](/self-hosting/configuration#proxies) and [logging](/self-hosting/configuration#logging). All variables below are optional.

| Variable                               | Default    | Description                                                                                |
| -------------------------------------- | ---------- | ------------------------------------------------------------------------------------------ |
| `PORT`                                 | `4100`     | HTTP port.                                                                                 |
| `OTLP_MAX_BODY_BYTES`                  | `10485760` | Largest OTLP body, compressed or not.                                                      |
| `INGEST_RATE_LIMIT_PER_MINUTE`         | `10000`    | Requests per project per minute before 429. `0` turns it off.                              |
| `INGEST_IP_RATE_LIMIT_PER_MINUTE`      | `10000`    | Requests per client address per minute. `0` turns it off.                                  |
| `INGEST_AUTH_FAILURE_LIMIT_PER_MINUTE` | `60`       | Invalid keys per address per minute before its requests see 429. `0` turns it off.         |
| `INGEST_IDEMPOTENCY_WINDOW_MS`         | `900000`   | How long retried bodies and duplicate errors are recognized and dropped. `0` turns it off. |
| `INGEST_KEY_CACHE_MS`                  | `30000`    | Cache time of a known project key.                                                         |
| `INGEST_KEY_NEGATIVE_MS`               | `5000`     | Cache time of an unknown project key.                                                      |

## Responses

| Status | When                                                                                                                                                                                                                                                   |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 200    | Queued, or the same body was already delivered within the idempotency window. `partialSuccess.rejectedSpans` counts spans without an id or dated outside the accepted window, `partialSuccess.rejectedLogRecords` counts log records dated outside it. |
| 400    | Malformed body or gzip stream.                                                                                                                                                                                                                         |
| 401    | Invalid project key.                                                                                                                                                                                                                                   |
| 403    | The `Origin` is not in the project's allowed origins.                                                                                                                                                                                                  |
| 413    | Body over `OTLP_MAX_BODY_BYTES`, or rows over `INGEST_REQUEST_MAX_BYTES` once decoded.                                                                                                                                                                 |
| 415    | Unsupported content type or encoding.                                                                                                                                                                                                                  |
| 429    | A rate limit, too many invalid keys from one address, or a full [queue](/self-hosting/operations#queues). `Retry-After` says when to retry.                                                                                                            |
| 503    | Redis is unreachable. `Retry-After: 5`.                                                                                                                                                                                                                |

A request is queued whole or not at all, except for its rejected items: a span or log record dated more than 7 days back or 10 minutes ahead of the server clock is dropped, and so is a span without an id. An error sent twice within the idempotency window, such as both as a span event and a log, is stored once.

An attribute map keeps its first 128 attributes. A key over 256 characters is dropped, and a value is cut at 32768 characters.
