# Reverse Proxy (in.layers.com) (/docs/sdk/reverse-proxy)



The SDK posts events to `https://in.layers.com/events`. This is a
reverse-proxy endpoint, not a backend service.

## Why a reverse proxy [#why-a-reverse-proxy]

* **Bypass ad-blockers.** A first-party-style domain is rarely blocked.
* **Single TLS termination** for SDK traffic, regardless of backend
  changes.
* **Server-side enrichment** — IP truncation, UA parsing, geo lookup
  before storing.
* **Returns 202 immediately** — fire-and-forget client semantics.
* **Easy to swap** to your own custom domain (CNAME).

## Endpoint reference [#endpoint-reference]

```
POST https://in.layers.com/events
Content-Type: application/json
X-App-Id: <your app_id>

{
  "events": [ /* array of event objects */ ],
  "batch_id": "optional-batch-id",
  "sent_at": "2026-04-19T12:00:00.000Z"
}
```

Response:

```
202 Accepted
```

Request body is validated synchronously. Failures return `400` with a
structured error.

Other endpoints exposed by the ingest service:

| Method | Path                | Purpose                                                          |
| ------ | ------------------- | ---------------------------------------------------------------- |
| `POST` | `/events`           | Event batch ingest                                               |
| `POST` | `/users/properties` | User properties upsert                                           |
| `POST` | `/consent`          | Consent state write                                              |
| `GET`  | `/config`           | Fetch remote SDK config (killswitches, event allowlists, etc.)   |
| `POST` | `/skan/postbacks`   | SKAdNetwork postback ingest                                      |
| `GET`  | `/c/:appId`         | Click-relay landing redirect (for paid-media CAPI tracking URLs) |
| `GET`  | `/health`           | Liveness (no auth)                                               |

All non-health, non-click routes require the `X-App-Id` header.

## No JS bundle is served [#no-js-bundle-is-served]

The ingest host does NOT serve a bundled SDK file. Install the JS SDK
via npm (`@layers/client` for web, `@layers/react-native` for RN,
`@layers/expo` for Expo, `@layers/node` for Node). There is no
`https://in.layers.com/sdk.js` drop-in snippet.

## Custom domain [#custom-domain]

For ad-blocker resilience, configure a custom domain
([Custom domain](/docs/sdk/custom-domain)) — `events.yourdomain.com`
CNAME to `in.layers.com`. The SDK supports a `baseUrl` override:

```ts
new LayersClient({
  apiKey: 'unused',
  appId: 'app_xxx',
  environment: 'production',
  baseUrl: 'https://events.yourdomain.com',
});
```

## Edge & geo enrichment [#edge--geo-enrichment]

Geo, IP, and user-agent details are resolved at the edge and merged
onto the event payload before storage, so your SDK does not need to
provide them.

The SDK ingest is hosted in the US; latency scales with distance from
the US region.
