# SDKs

> How your app sends data to Sypnia. One SDK for the browser, one for Node, one for Next.js, a bridge for apps that already use OpenTelemetry, and the OTLP intake for every other backend.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://telemetry.docs.sypnia.com/sdks/

An SDK is the small piece of Sypnia that lives inside your app. It notices what happens (an error, a slow page, a click that does nothing) and sends it to Sypnia as events.

The SDKs are open source, under the MIT licence (decided 2026-11-17: see [Licensing](https://telemetry.docs.sypnia.com/licensing)), and are **the same for the open-source engine and for Sypnia Cloud**. Two things differ, and every page shows both:

|                          | Sypnia Cloud                                                                                                       | Self-hosted engine                                |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- |
| Where the SDK sends      | `https://ingest.sypnia.com`, the default (also answers at `https://telemetry.ingest.sypnia.com`). You set nothing. | Your engine's base URL, in the option `endpoint`. |
| Where the key comes from | Your project's page in `telemetry.app.sypnia.com`.                                                                 | `sypnia project create`, or the API.              |

**npm**

```bash
npm install @sypnia/telemetry
```

```js
import { init } from '@sypnia/telemetry/browser';

init({ project: 'YOUR_PROJECT_KEY' });
```

**pnpm**

```bash
pnpm add @sypnia/telemetry
```

```js
import { init } from '@sypnia/telemetry/browser';

init({ project: 'YOUR_PROJECT_KEY' });
```

**yarn**

```bash
yarn add @sypnia/telemetry
```

```js
import { init } from '@sypnia/telemetry/browser';

init({ project: 'YOUR_PROJECT_KEY' });
```

**bun**

```bash
bun add @sypnia/telemetry
```

```js
import { init } from '@sypnia/telemetry/browser';

init({ project: 'YOUR_PROJECT_KEY' });
```

**script tag**

```html
<script async
  src="https://telemetry.ingest.sypnia.com/v1/sdk.js"
  data-project="YOUR_PROJECT_KEY"></script>
```

No build step and no `init` call: paste it before `</head>`. The tag starts Sypnia with the key in `data-project`.

## Which one you need

| Your app                                                                                        | Use                                                                                                                                                                                            |
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Anything that runs in a browser: React, Vue, Svelte, plain HTML, an app made with an AI builder | [`@sypnia/telemetry/browser`](https://telemetry.docs.sypnia.com/sdks/browser)                                                                                                                  |
| A Next.js app                                                                                   | [`@sypnia/telemetry/next`](https://telemetry.docs.sypnia.com/sdks/nextjs), which covers the browser and the server                                                                             |
| A Node server: Express, Fastify, Koa, NestJS, Hono                                              | [`@sypnia/telemetry/node`](https://telemetry.docs.sypnia.com/sdks/node)                                                                                                                        |
| A backend in Python, Go, PHP, Rust, Java or anything else                                       | [OpenTelemetry](https://telemetry.docs.sypnia.com/sdks/opentelemetry): point your OTLP exporter at Sypnia                                                                                      |
| A mobile app built as a web view                                                                | [`@sypnia/telemetry/browser`](https://telemetry.docs.sypnia.com/sdks/browser)                                                                                                                  |
| A native iOS or Android app                                                                     | There is no native Sypnia SDK: send traces with OpenTelemetry's SDK for your language, and use the browser SDK in web views. See [Limits](https://telemetry.docs.sypnia.com/reference/limits). |

A web app with its own backend uses two: the browser SDK in the page and a server SDK (or OpenTelemetry) in the backend, both sending to the same project. That is what lets Sypnia follow one click from the page to the database.

| Node or Next.js backend                                                                            | Use                                                                                                                                                  |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| No OpenTelemetry today                                                                             | [`@sypnia/telemetry/node`](https://telemetry.docs.sypnia.com/sdks/node) or [`@sypnia/telemetry/next`](https://telemetry.docs.sypnia.com/sdks/nextjs) |
| OpenTelemetry already registered, or you need its instrumentations (Prisma, MySQL, MongoDB, Redis) | [`@sypnia/telemetry/otel`](https://telemetry.docs.sypnia.com/sdks/otel-bridge), the bridge, at OpenTelemetry's cost                                  |

## Own SDKs, a standard wire

Sypnia's SDKs are its own, and light on purpose: none of them depends on OpenTelemetry. On the wire they split by what OpenTelemetry has a standard for:

|                                            | Sends                                                                                                                                                                                                                                                                    | To                   |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- |
| Browser SDK                                | Sypnia's compact [events](https://telemetry.docs.sypnia.com/reference/event-schema): sessions, replay, clicks, rage and dead clicks, vitals with their element. OpenTelemetry has no standard for these. It also sends the W3C `traceparent` header on calls to your API | `/v1/ingest/events`  |
| Server SDKs (Node, Next.js) and the bridge | Traces in the OpenTelemetry protocol, OTLP/HTTP in protobuf, with OpenTelemetry's attribute names and a few `sypnia.*` ones: the [semantic conventions](https://telemetry.docs.sypnia.com/reference/semantic-conventions)                                                | `/v1/otlp/v1/traces` |
| Any OpenTelemetry exporter, any language   | The same OTLP traces                                                                                                                                                                                                                                                     | `/v1/otlp/v1/traces` |

Why not OpenTelemetry inside the SDKs: we measured it. On one Node server, the official OpenTelemetry SDK added three to five times as much CPU per request as a light tracer of our own, and 600–800 ms to startup (measured on 2026-11-15: [the numbers and the method](https://telemetry.docs.sypnia.com/sdks/node#what-it-costs)). Why OTLP on the wire: so a server's traces are readable by any tool, and so any language can send them.

## The whole public API

The three main packages, a handful of functions. The bridge's two functions are on [its page](https://telemetry.docs.sypnia.com/sdks/otel-bridge#the-functions-you-call).

| Function                                                                              | `@sypnia/telemetry/browser` | `@sypnia/telemetry/node` | What it does                                                                                                                                                            |
| ------------------------------------------------------------------------------------- | --------------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `init(options)`                                                                       | yes                         | yes                      | Starts the SDK. Once.                                                                                                                                                   |
| `identify(who)`                                                                       | yes                         | yes                      | Says who the person is, and their account.                                                                                                                              |
| `reportError(error)`                                                                  | yes                         | yes                      | Reports an error your code caught.                                                                                                                                      |
| `track(name, props)`                                                                  | yes                         | no                       | Sends a custom event.                                                                                                                                                   |
| `flush()`                                                                             | yes                         | yes                      | Sends what is waiting.                                                                                                                                                  |
| `getSessionId()`                                                                      | yes                         | no                       | The current session's id.                                                                                                                                               |
| `optOut()`, `optIn()`                                                                 | yes                         | no                       | Stops and resumes everything for one browser.                                                                                                                           |
| `span(name, fn)`                                                                      | no                          | yes                      | Records a step of your own inside a request.                                                                                                                            |
| `setSpanAttributes(values)`, `activeSpan()`                                           | no                          | yes                      | Sets attributes on the span the current code runs in, such as `sypnia.case`.                                                                                            |
| `shutdown()`                                                                          | no                          | yes                      | Sends what is waiting and stops.                                                                                                                                        |
| `wrapFetchHandler(handler)`                                                           | no                          | yes                      | Traces a function from a `Request` to a `Response`.                                                                                                                     |
| `injectTraceContext(payload)`, `sqsTraceAttributes(attributes)`                       | no                          | yes                      | Sends the current trace with work handed to a Lambda function or an SQS queue. See [Queues and functions](https://telemetry.docs.sypnia.com/sdks/queues-and-functions). |
| `wrapSqsHandler(handle)`, `wrapLambdaHandler(handler)`, `traceSqsRecord(message, fn)` | no                          | yes                      | Continues that trace in the function that does the work, one span per message or invocation.                                                                            |
| `continueTrace(carrier, name, fn)`                                                    | no                          | yes                      | The same for a worker that is not a Lambda function.                                                                                                                    |
| `notifyNavigation(url, kind)`                                                         | yes                         | no                       | For framework integrations: announces a navigation before the address changes. Apps do not call it.                                                                     |
| `traceRequest(request, handle, options)`                                              | no                          | yes                      | For framework integrations: one traced request on a host with no Node server. Apps do not call it.                                                                      |

`@sypnia/telemetry/next` gives you the browser functions from `@sypnia/telemetry/next/client`, the server functions from `@sypnia/telemetry/next/server`, `withSypnia` for `next.config.ts`, and `traceOpenNext` from `@sypnia/telemetry/next/opennext` for [Next.js on AWS Lambda](https://telemetry.docs.sypnia.com/sdks/nextjs#on-aws-lambda-with-opennext).

Every SDK is one npm package, **`@sypnia/telemetry`** (version 0.4.0), with a subpath per runtime: install it once and import `@sypnia/telemetry/browser`, `/node` or `/next`. It replaced `@sypnia/browser`, `@sypnia/node` and `@sypnia/next` on 2026-11-17; those stay on npm but are not released again. What changes between versions is in the [changelog](https://telemetry.docs.sypnia.com/reference/changelog).

## Pages in this section

The exact shape of everything the SDKs send is the [event schema](https://telemetry.docs.sypnia.com/reference/event-schema) for the browser and the [semantic conventions](https://telemetry.docs.sypnia.com/reference/semantic-conventions) for the server.
