---
title: "Editor sessions, MailKaro Docs"
description: "Editor sessions in MailKaro: short-lived tokens to init the editor without exposing a long-lived key."
---

# Editor sessions

Rendering

# Editor sessions

Short-lived tokens to init the editor without exposing a long-lived key.

Create a session server-side and hand the token to the browser, it's org-scoped, HMAC-signed and self-expiring:

bash

```
POST /v3/editor-sessions → 201 { session_token: "es_…", expires_at }
```

Verify it server-side before trusting it. See [authentication](https://docs.mailkaro.com/authentication).

## Calling it

The endpoint needs a secret server key (`sk_live_…`), sent as a Bearer token or as `?token=`. A publishable `pk_live_…` token, or an inactive key, gets `401` with `{ "error": "invalid_token" }`. The request takes no body.

bash

```
curl -X POST https://api.mailkaro.com/v3/editor-sessions \
 -H "Authorization: Bearer sk_live_…"
# 201 { "session_token": "es_…", "expires_at": "2026-10-29T11:00:00.000Z" }
```

## Lifetime

A session lasts one hour from when it is created, and the request cannot change that. Create a new session when the old one is close to `expires_at`.

## What is inside the token

The token is `es_`, then a base64url payload, a dot and a signature. The payload holds the organization id and the expiry as plain text, so anyone with the token can read them; the HMAC-SHA256 signature only stops them from being changed. Keep the token out of URLs and logs. To create the server key, see [embed tokens](https://docs.mailkaro.com/embed-tokens).

Source: https://docs.mailkaro.com/editor-sessions
