> Documentation index: https://docs.dev.repp.co.il/llms.txt - fetch it to find every page of these docs.

# Sessions

Make a session for one Repp frame on your page: the messenger, or one of the single components. Call it from your server with your secret key, and hand only the `client_secret` to the page.

- `POST https://api.dev.repp.co.il/partner/v1/embed-sessions`
- Needs your secret key: `Authorization: Bearer rsk_…`. From your server only.

One session per frame: one for the messenger's whole panel, one for each single component. The SDK asks for each through your `fetchClientSecret`, with `{ component, classId }`, and again when a session runs out.

**The `client_secret` works once, for 5 minutes.** The frame trades it for a token that lives only in its own memory, for 2 hours, and is sent as a bearer token to Repp; no cookie is ever set. A secret used twice revokes its session.

**Everything about the business comes from your server**, never from the browser: the business, the person and their role, the coming classes (about the next 14 days, up to 100) and the rooms (up to 50). Classes that already began are dropped.

Server to server only: no CORS, never from a page. **Try it** is not offered here, since the call needs your secret key; try the whole flow on the [demo](https://docs.dev.repp.co.il/partners-testing.md) instead.

## Request body

A JSON object, sent with `Content-Type: application/json`.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `partner_business_id` **(required)** | string | — | Your id of the business: letters, digits and `. _ : -`, up to 100. |
| `partner_business_name` **(required)** | string | — | Its name in your system, 1 to 120 characters. |
| `partner_user` **(required)** | object | — | The person signed in to your system, who will use the frame. |
| `partner_user.id` **(required)** | string | — | Your id of the person, up to 100 characters. |
| `partner_user.role` **(required)** | one of: owner, manager, staff | — | Only an `owner` connects and disconnects; an `owner` or a `manager` posts requests, opens rooms for rent and turns the business's text messages off or on; `staff` sees where things stand. |
| `partner_user.display_name` **(required)** | string | — | Their first name, 1 to 60 characters: the panel greets them by it. |
| `component` **(required)** | one of: connect, substitute, class-status, messenger | — | Which frame the session is for: what `fetchClientSecret` was asked. |
| `class` **(required)** | object or null | — | One class, with the fields of `classes[]`: required for `substitute` and `class-status`, `null` for `messenger` and `connect`. |
| `classes` | array, up to 100 | — | `messenger` only, and required there (may be `[]`): the business's coming classes in your calendar, each `partner_class_id` once. Leave it out for the other components. |
| `classes[].partner_class_id` **(required)** | string | — | Your id of the class: letters, digits and `. _ : -`, up to 100. |
| `classes[].date` **(required)** | YYYY-MM-DD | — | Its day, in Israel. |
| `classes[].time` **(required)** | HH:MM | — | Its start in Israel, on a quarter hour (`18:00`, `18:15`). |
| `classes[].duration_minutes` **(required)** | one of: 30, 45, 60, 75, 90, 120 | — | How long it is. |
| `classes[].style` **(required)** | string or null | — | The training style it matches, a key of the [Catalog](https://docs.dev.repp.co.il/catalog.md) (`pilates`, `barre`…), or `null`: the panel then asks once. |
| `classes[].service_name` **(required)** | string | — | Your name of the class, 1 to 80 characters ("פילאטיס מכשירים"). |
| `classes[].branch_name` **(required)** | string or null | — | Its branch, 1 to 80 characters, or `null`. |
| `rooms` | array, up to 50 | — | `messenger` only, may be `[]` or left out: the business's rooms in your system, each `partner_room_id` once. The panel offers each for rent as a space on Repp. |
| `rooms[].partner_room_id` **(required)** | string | — | Your id of the room: letters, digits and `. _ : -`, up to 100. |
| `rooms[].name` **(required)** | string | — | Its name in your system, 1 to 80 characters ("סטודיו גדול"). |
| `rooms[].branch_name` **(required)** | string or null | — | Its branch, 1 to 80 characters, or `null`. |
| `rooms[].capacity` **(required)** | integer 1–500 or null | — | How many people it holds, when you know. |

## Request

**cURL**

```bash
curl -X POST "https://api.dev.repp.co.il/partner/v1/embed-sessions" \
  -H "Authorization: Bearer $REPP_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "partner_business_id": "4012",
  "partner_business_name": "סטודיו מרכז",
  "partner_user": {
    "id": "51751",
    "role": "manager",
    "display_name": "מיכל"
  },
  "component": "messenger",
  "class": null,
  "classes": [
    {
      "partner_class_id": "30146899",
      "date": "2026-12-07",
      "time": "18:00",
      "duration_minutes": 60,
      "style": "pilates",
      "service_name": "פילאטיס מכשירים",
      "branch_name": "סניף ראשי"
    }
  ],
  "rooms": [
    {
      "partner_room_id": "room-2",
      "name": "סטודיו גדול",
      "branch_name": "סניף ראשי",
      "capacity": 20
    }
  ]
}'
```

**JavaScript**

```js
const response = await fetch("https://api.dev.repp.co.il/partner/v1/embed-sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.REPP_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "partner_business_id": "4012",
    "partner_business_name": "סטודיו מרכז",
    "partner_user": {
      "id": "51751",
      "role": "manager",
      "display_name": "מיכל"
    },
    "component": "messenger",
    "class": null,
    "classes": [
      {
        "partner_class_id": "30146899",
        "date": "2026-12-07",
        "time": "18:00",
        "duration_minutes": 60,
        "style": "pilates",
        "service_name": "פילאטיס מכשירים",
        "branch_name": "סניף ראשי"
      }
    ],
    "rooms": [
      {
        "partner_room_id": "room-2",
        "name": "סטודיו גדול",
        "branch_name": "סניף ראשי",
        "capacity": 20
      }
    ]
  }),
});
if (!response.ok) throw new Error((await response.json()).error.code);
const session = await response.json();
// Hand only session.client_secret to your page.
```

**TypeScript**

```ts
interface SessionCreated {
  id: string;
  /** Hand it to your page as it is: it works once, for 5 minutes. */
  client_secret: string;
  expires_at: string;
  component: "connect" | "substitute" | "class-status" | "messenger";
  /** Whether this business already connected its Repp account. */
  connected: boolean;
}

interface EmbedError {
  error: { code: string; message: string };
}

const response = await fetch("https://api.dev.repp.co.il/partner/v1/embed-sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.REPP_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "partner_business_id": "4012",
    "partner_business_name": "סטודיו מרכז",
    "partner_user": {
      "id": "51751",
      "role": "manager",
      "display_name": "מיכל"
    },
    "component": "messenger",
    "class": null,
    "classes": [
      {
        "partner_class_id": "30146899",
        "date": "2026-12-07",
        "time": "18:00",
        "duration_minutes": 60,
        "style": "pilates",
        "service_name": "פילאטיס מכשירים",
        "branch_name": "סניף ראשי"
      }
    ],
    "rooms": [
      {
        "partner_room_id": "room-2",
        "name": "סטודיו גדול",
        "branch_name": "סניף ראשי",
        "capacity": 20
      }
    ]
  }),
});
if (!response.ok) throw new Error(((await response.json()) as EmbedError).error.code);
const session = (await response.json()) as SessionCreated;
// Hand only session.client_secret to your page.
```

**Python**

```python
import os

import requests

response = requests.post(
    "https://api.dev.repp.co.il/partner/v1/embed-sessions",
    headers={"Authorization": f"Bearer {os.environ['REPP_SECRET_KEY']}"},
    json={
        "partner_business_id": "4012",
        "partner_business_name": "סטודיו מרכז",
        "partner_user": {
            "id": "51751",
            "role": "manager",
            "display_name": "מיכל",
        },
        "component": "messenger",
        "class": None,
        "classes": [
            {
                "partner_class_id": "30146899",
                "date": "2026-12-07",
                "time": "18:00",
                "duration_minutes": 60,
                "style": "pilates",
                "service_name": "פילאטיס מכשירים",
                "branch_name": "סניף ראשי",
            },
        ],
        "rooms": [
            {
                "partner_room_id": "room-2",
                "name": "סטודיו גדול",
                "branch_name": "סניף ראשי",
                "capacity": 20,
            },
        ],
    },
    timeout=30,
)
if not response.ok:
    raise RuntimeError(response.json()["error"]["code"])
session = response.json()
# Hand only session["client_secret"] to your page.
```

**PHP**

```php
<?php
$ch = curl_init("https://api.dev.repp.co.il/partner/v1/embed-sessions");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("REPP_SECRET_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "partner_business_id" => "4012",
        "partner_business_name" => "סטודיו מרכז",
        "partner_user" => [
            "id" => "51751",
            "role" => "manager",
            "display_name" => "מיכל",
        ],
        "component" => "messenger",
        "class" => null,
        "classes" => [
            [
                "partner_class_id" => "30146899",
                "date" => "2026-12-07",
                "time" => "18:00",
                "duration_minutes" => 60,
                "style" => "pilates",
                "service_name" => "פילאטיס מכשירים",
                "branch_name" => "סניף ראשי",
            ],
        ],
        "rooms" => [
            [
                "partner_room_id" => "room-2",
                "name" => "סטודיו גדול",
                "branch_name" => "סניף ראשי",
                "capacity" => 20,
            ],
        ],
    ]),
]);
$session = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException($session["error"]["code"]);
}
// Hand only $session["client_secret"] to your page.
```

## Response (201)

```json
{
  "id": "7c1e2a90-4b3d-4f5e-8a6b-1c2d3e4f5a6b",
  "client_secret": "res_5b1c2d3e4f5a6b7c8d9e0f1a_secret_3f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
  "expires_at": "2026-12-07T08:10:00+02:00",
  "component": "messenger",
  "connected": true
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | uuid | The session's id. |
| `client_secret` | string | Hand it to your page, which returns it from `fetchClientSecret`. Once, for 5 minutes. |
| `expires_at` | string | When the `client_secret` stops working (ISO 8601). |
| `component` | one of: connect, substitute, class-status, messenger | The component it is for. |
| `connected` | boolean | Whether this business already connected its Repp account. When not, the panel offers to connect. |

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `bad_request` | The body is not JSON, or a field is missing, too long or of the wrong shape. |
| 400 | `bad_session` | The component and its fields do not fit: `class` is needed for `substitute` and `class-status`, `classes` for `messenger` (and only there), neither for `connect`; or two classes share an id. |
| 403 | `role_not_allowed` | `partner_user.role` is none of `owner`, `manager`, `staff`. |
| 404 | `unknown_partner` | No secret key in `Authorization`, or one Repp does not know (revoked, mistyped, or a publishable key). |
| 405 | `not_found` | Any method but `POST`. |
| 409 | `not_connected` | `substitute` and `class-status` need a connected business. `messenger` and `connect` do not. |
| 429 | `too_many` | Over a limit (see [Security](https://docs.dev.repp.co.il/partners-security.md)). Wait a minute: the answer says `Retry-After: 60`. |
| 500 | `failed` | Something failed on Repp's side. Try again in a moment. |
