---
title: "Initialize session replay with metadata"
method: POST
path: "/_temps/session-replay/init"
tags: ["Analytics"]
---

# Initialize session replay with metadata

`POST /_temps/session-replay/init`

## Request

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

## Query parameters

- `temps_key` string

## Headers

- `x-temps-analytics-key` string, nullable

## Request body

- SessionReplayInitRequest
  - `colorDepth` integer, nullable
  - `language` string, nullable
  - `screenHeight` integer, nullable
  - `screenWidth` integer, nullable
  - `sessionId` string, required
  - `timestamp` string, nullable
  - `timezone` string, nullable
  - `url` string, nullable
  - `userAgent` string, nullable
  - `viewportHeight` integer, nullable
  - `viewportWidth` integer, nullable
  - `visitorId` string, nullable: Client-generated visitor id, used only when the request carries no Temps-issued `_temps_visitor_id` cookie — i.e. Temps is used purely as an analytics backend for an app it doesn't deploy/proxy (gotempsh/temps#848). The SDK already sends this today via `getSessionMetadata()`.

## Response `201`

Session initialized successfully

- SessionReplayInitResponse
  - `message` string, required
  - `session_id` string, required

## Other responses

- `400`: Bad request
- `500`: Internal server error

## Changes

- **2026-09-07** `c2a1f69745e7`: 3 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `visitorId`
- **2026-09-07** `7a3103561bd0`: 3 warning
  - deleted the `header` request parameter `x-temps-analytics-key`
  - deleted the `query` request parameter `temps_key`
  - removed the request property `visitorId`
- **2026-09-07** `7fcff272f099`: 3 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `visitorId`
- **2026-09-07** `c1fa498b6377`: 3 warning
  - deleted the `header` request parameter `x-temps-analytics-key`
  - deleted the `query` request parameter `temps_key`
  - removed the request property `visitorId`
- **2026-09-07** `c43de0e360be`: 3 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `visitorId`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/_temps/session-replay/init/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)
