# Send with generic OTLP and the ingest API

Send telemetry from tools without a Harnessforce adapter over OTLP/HTTP, or post events in the canonical format to the generic ingest API. Generic OTLP does not create sessions.

```sh
/plugin marketplace add lambda-script/harnessforce-agent
/plugin install harnessforce@harnessforce-agent
/harnessforce:setup
```

Tools that Harnessforce has no adapter for, and your own scripts, can send data in two ways: OpenTelemetry over OTLP/HTTP, and the generic ingest API, which takes JSON in the canonical format. Both use the same ingest origin and ingest keys as Claude Code and Codex.

## Ingest keys

Every request carries an ingest key as a Bearer token. The key decides the workspace, and any workspace ID inside the payload is ignored.

```text
Authorization: Bearer <ingest key>
```

For an OTLP exporter, pass the header with `OTEL_EXPORTER_OTLP_HEADERS`. Use the same origin as the `OTEL_EXPORTER_OTLP_ENDPOINT` in the managed settings JSON the app shows.

A missing, malformed, revoked, or unknown key returns 401 with `WWW-Authenticate: Bearer`. The key is checked before the body is read, so an invalid key returns 401 even when the body is also invalid. For OTLP, a key revoked while its workspace is over the monthly event limit or read-only can receive the dropped-items partial success instead of 401 for up to 60 seconds; nothing it sends is stored.

## Generic OTLP

| Path               | Signal  |
| ------------------ | ------- |
| `POST /v1/traces`  | Traces  |
| `POST /v1/logs`    | Logs    |
| `POST /v1/metrics` | Metrics |

* **Content type:** `application/x-protobuf` or `application/json`. JSON is read as UTF-8.
* **Compression:** None or `gzip`.
* **Response:** 200 with the OTLP response. When some items are rejected, the response is a partial success with the number of rejected items and the reason.

Generic OTLP receives telemetry but does not create sessions. Sessions are created from the Claude Code and Codex telemetry that `harnessforce login` or managed settings set up.

## Generic ingest API

The generic ingest API takes JSON in the canonical format. The shape of each body is defined in [Semantic conventions](/en/docs/semantic-conventions).

| Path                          | What it takes                                                                | Items per request |
| ----------------------------- | ---------------------------------------------------------------------------- | ----------------- |
| `POST /v1/events`             | Events such as pull requests, CI runs, and deploys. Idempotent by `event_id` | 1,000             |
| `POST /v1/config-snapshots`   | Config snapshots                                                             | 1,000             |
| `POST /v1/sessions`           | Session registrations. Idempotent by agent and session ID                    | 1,000             |
| `POST /v1/sessions/locations` | Session work locations                                                       | 1,000             |
| `POST /v1/imports/sessions`   | Session imports. Only a user ingest key is accepted                          | 100               |
| `POST /v1/analysis-reports`   | Analysis reports. Only a user ingest key is accepted                         | 100               |
| `POST /v1/session-usage`      | Session usage summaries                                                      | 100               |

## Limits

| Condition                                                                           | Response                                                                                                                                                                                                                                |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The request body, received or after gzip is expanded, is larger than 10 MiB         | 413                                                                                                                                                                                                                                     |
| An OTLP request has more than 10,000 items (spans, log records, metric data points) | 413                                                                                                                                                                                                                                     |
| An OTLP attribute list has more than 128 entries                                    | 413                                                                                                                                                                                                                                     |
| More than 1,000 requests in 10 seconds from one IP address                          | 429 with `Retry-After: 10`                                                                                                                                                                                                              |
| The workspace's requests per second are exceeded                                    | 429 with `Retry-After: 1`                                                                                                                                                                                                               |
| The monthly event limit is exceeded                                                 | Accepted and dropped, reported as a partial success. Once an OTLP request has every item dropped, requests with the same key are dropped the same way for up to 60 seconds, without counting toward the workspace's requests per second |

## Errors

| Condition                                                       | Status                              |
| --------------------------------------------------------------- | ----------------------------------- |
| A path under `/v1/` that doesn't exist                          | 404                                 |
| A method other than POST                                        | 405 with `Allow: POST`              |
| The ingest key fails                                            | 401 with `WWW-Authenticate: Bearer` |
| Ingestion is temporarily stopped by the operator                | 503 with `Retry-After: 60`          |
| An unsupported `Content-Type` or `Content-Encoding`             | 415                                 |
| A body that can't be decoded, or that breaks the OTLP structure | 400                                 |
| A temporary failure on our side                                 | 503 with `Retry-After: 30`          |

Error bodies are a Status with a `code` and a `message`, encoded in the request's content type.

## Read next

* [Semantic conventions](/en/docs/semantic-conventions): the attributes Harnessforce reads and the shape of each body.
* [Set up Codex with the CLI](/en/docs/codex): send from Codex.
