---
title: "Ingest a browser-tunneled Sentry envelope."
method: POST
path: "/_temps/sentry/envelope"
tags: ["sentry-ingestor"]
---

# Ingest a browser-tunneled Sentry envelope.

`POST /_temps/sentry/envelope`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/_temps/sentry/envelope`
- Auth: none declared

Two resolution paths, tried in this order:

1. **DSN credential.** An explicit `?sentry_key=` / `X-Sentry-Auth` /
   `Authorization: DSN` value, or — failing that — the `dsn` field browser
   SDKs embed in the envelope header whenever `Sentry.init({ tunnel })` is
   used. The credential alone decides the project; `Host` and `Origin` are
   not consulted. This is what makes the endpoint usable from an app Temps
   does not deploy, which by definition has no route-table entry at all.
2. **`Host`.** Unchanged legacy behaviour for same-origin, Temps-deployed
   apps: the project/environment/deployment are resolved from the `Host`
   header via the proxy's route table, the same way `/api/_temps/event`
   (analytics) resolves. The proxy forwards anything under `/api/_temps`
   to the console regardless of `Host`
   (`temps-proxy::services::ROUTE_PREFIX_TEMPS`), so it works on custom
   domains and previews without per-domain DSN configuration.

On path 2 there is no credential, so an `Origin`/`Referer` check stands in
for authentication: the request must claim to come from the same host it
resolves to, or it is rejected. That check is deliberately **skipped** on
path 1 — a tunneled request from another origin is the entire point there,
and the DSN is a stronger claim than a self-reported `Origin`. Path 1 does
honour the DSN row's own `allowed_origins` list when the operator has set
one (`403` when the `Origin` is off it); an empty or absent list, which is
every row Temps mints today, permits any origin.

# Ordering, and why it matters

This route is unauthenticated and reachable from every domain a project is
deployed to, so the expensive work is placed strictly after the cheap
admission control:

1. Shape gate + resolution cache + a global unresolved-credential budget,
   all before any database round trip (mirroring `temps-analytics`'s
   ADR-040 §2 defence).
2. Per-project rate limiting.
3. Only then `decompress_if_needed`, which can inflate up to
   `MAX_DECOMPRESSED_SIZE`.

The credential-free branch has to inflate the body to read an SDK-embedded
DSN, so when `Host` has not already resolved the request that inflate is
charged against the same global budget a forged key pays into.

An *explicit* credential that does not resolve is a `401`, never a silent
fall-through to `Host`: a typo'd key must fail loudly rather than land the
data under whichever project the `Host` happens to match. An *embedded*
envelope DSN that does not resolve falls through to path 2, because that
value was sniffed rather than presented — an app tunneling a third-party
DSN through Temps keeps working exactly as it did before.

## Query parameters

- `sentry_key` string

## Request body `application/octet-stream`

- string

## Response `200`

Envelope ingested

## Other responses

- `204`: Host resolved to a route with no attributable project (sandbox/orphan)
- `400`: Bad request
- `401`: An explicit DSN key was presented but did not resolve
- `403`: Origin/Referer does not match the resolved host (Host-resolved requests), or the Origin is not in the DSN's allowed_origins (keyed requests)
- `404`: Unknown host
- `413`: Request body too large (exceeds 2 MiB)
- `429`: Rate limit exceeded

## Changes

- **2026-09-18** `af0a8b134e9b`: 2 info
  - added the new optional `query` request parameter `sentry_key`
  - added the non-success response with the status `401`
- **2026-09-07** `38e97c3c35dd`: 1 info
  - endpoint added
- **2026-09-07** `f7404eb7ac98`: 1 breaking
  - api path removed without deprecation
- **2026-08-11** `c24b47a04260`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/_temps/sentry/envelope/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
