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

# Post a request

Posts a "need a substitute" request for the business: trainers who fit are told, offer on it, and the business chooses among them on the site.

- `POST https://api.dev.repp.co.il/v1/requests`
- Needs a key: `Authorization: Bearer repp_…`.
- **Changes something · needs a read-and-actions key** (or an app signed in with `repp.write`). Send an `Idempotency-Key`: a repeat gets the first answer. Never moves money. See [Actions](https://docs.dev.repp.co.il/actions.md).

The class is at the business's saved address, never sent here: a business with none gets `409 no_place` and saves it once on the site. A request posted here always waits for offers; one that closes on the first yes charges a card, so it is posted on the site.

Send `invite_trainer_id` with `invite_hours` (1, 3 or 12) to offer it to one trainer first; when that trainer declines or the window runs out, the business opens it to everyone on the site.

The site's own rules hold and come back as `action_refused` with their word (a day that went by, too many invitations today…).

Needs a key made as **read and actions** on the site; a read-only key gets `403 read_only_key`. An AI app's sign-in acts through the MCP server only, never here. Send an `Idempotency-Key` header: the same key sent again does nothing and answers the first result.

## Request body

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

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `style` **(required)** | one of: pilates, barre, strength, crossfit, trx, calisthenics, cardio, hiit, spinning, running, aqua, yoga, mobility, meditation, personal, martial_arts, boxing, krav_maga, dance, zumba, kids, seniors, other | — | The class's style: a key of the catalog. |
| `date` **(required)** | YYYY-MM-DD | — | The day, in Israel. |
| `time` **(required)** | string | — | The start, HH:MM in Israel, 24 hours, on a quarter hour (:00, :15, :30 or :45). |
| `duration_minutes` **(required)** | integer 30–120 | — | Length in minutes, one of 30, 45, 60, 75, 90, 120. |
| `pay` **(required)** | integer 1–5000 | — | What the business pays the trainer, in whole shekels, 1 to 5000. |
| `notes` | string | — | A note for the trainer, up to 300 characters. |
| `cancel_policy` | one of: flexible, regular, strict | `regular` | Free cancellation until: `flexible` 2 hours before, `regular` 6 hours before, `strict` 24 hours before. |
| `invite_trainer_id` | uuid | — | Offer it to this trainer first (an id from the index). |
| `invite_hours` | integer 1–12 | — | How long the invited trainer has to answer: 1, 3 or 12 hours. Needed with `invite_trainer_id`. |

## Request

**cURL**

```bash
IDEMPOTENCY_KEY=$(uuidgen)  # send the same one again to retry this action
curl -X POST "https://api.dev.repp.co.il/v1/requests" \
  -H "Authorization: Bearer $REPP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "style": "yoga",
  "date": "2026-12-03",
  "time": "18:00",
  "duration_minutes": 60,
  "pay": 180,
  "notes": "מזרנים בארון ליד הכניסה",
  "cancel_policy": "regular"
}'
```

**JavaScript**

```js
// One key per action: send the same one again to retry it, and it is done once.
const idempotencyKey = crypto.randomUUID();
const response = await fetch("https://api.dev.repp.co.il/v1/requests", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.REPP_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": idempotencyKey,
  },
  body: JSON.stringify({
    "style": "yoga",
    "date": "2026-12-03",
    "time": "18:00",
    "duration_minutes": 60,
    "pay": 180,
    "notes": "מזרנים בארון ליד הכניסה",
    "cancel_policy": "regular"
  }),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const data = await response.json();
```

**TypeScript**

```ts
/** One of the business's "need a substitute" requests. */
interface ReppRequest {
  id: string;
  style: Style;
  date: string;
  time: string;
  starts_at: string;
  duration_minutes: number;
  pay: number;
  region: Region;
  address: string;
  status: "open" | "filled" | "missed";
  close_mode: "choose" | "first";
  cancel_policy: "flexible" | "regular" | "strict";
  offers_waiting: number;
  trainer: {
    id: string;
    name: string;
    verified: boolean;
  } | null;
  invitation: {
    trainer_id: string;
    trainer_name: string | null;
    state: "waiting" | "accepted" | "declined" | "expired";
    until: string;
  } | null;
  created_at: string;
}

/** A training style: one of the keys in Catalog. */
type Style =
  | "pilates"
  | "barre"
  | "strength"
  | "crossfit"
  | "trx"
  | "calisthenics"
  | "cardio"
  | "hiit"
  | "spinning"
  | "running"
  | "aqua"
  | "yoga"
  | "mobility"
  | "meditation"
  | "personal"
  | "martial_arts"
  | "boxing"
  | "krav_maga"
  | "dance"
  | "zumba"
  | "kids"
  | "seniors"
  | "other";

/** A region of Israel: one of the keys in Catalog. */
type Region = "gush_dan" | "shfela" | "sharon" | "haifa" | "jerusalem" | "north" | "south" | "judea_samaria";

interface ApiError {
  error: { code: string; message: string; reason?: string };
}

// One key per action: send the same one again to retry it, and it is done once.
const idempotencyKey = crypto.randomUUID();
const response = await fetch("https://api.dev.repp.co.il/v1/requests", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.REPP_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": idempotencyKey,
  },
  body: JSON.stringify({
    "style": "yoga",
    "date": "2026-12-03",
    "time": "18:00",
    "duration_minutes": 60,
    "pay": 180,
    "notes": "מזרנים בארון ליד הכניסה",
    "cancel_policy": "regular"
  }),
});
if (!response.ok) throw new Error(((await response.json()) as ApiError).error.message);
const data = (await response.json()) as ReppRequest;
```

**Python**

```python
import os
import uuid

import requests

# One key per action: send the same one again to retry it, and it is done once.
idempotency_key = str(uuid.uuid4())

response = requests.post(
    "https://api.dev.repp.co.il/v1/requests",
    headers={
        "Authorization": f"Bearer {os.environ['REPP_API_KEY']}",
        "Idempotency-Key": idempotency_key,
    },
    json={
        "style": "yoga",
        "date": "2026-12-03",
        "time": "18:00",
        "duration_minutes": 60,
        "pay": 180,
        "notes": "מזרנים בארון ליד הכניסה",
        "cancel_policy": "regular",
    },
    timeout=30,
)
if not response.ok:
    raise RuntimeError(response.json()["error"]["message"])
data = response.json()
```

**PHP**

```php
<?php
// One key per action: send the same one again to retry it, and it is done once.
$idempotencyKey = bin2hex(random_bytes(16));

$ch = curl_init("https://api.dev.repp.co.il/v1/requests");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("REPP_API_KEY"),
        "Content-Type: application/json",
        "Idempotency-Key: " . $idempotencyKey,
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "style" => "yoga",
        "date" => "2026-12-03",
        "time" => "18:00",
        "duration_minutes" => 60,
        "pay" => 180,
        "notes" => "מזרנים בארון ליד הכניסה",
        "cancel_policy" => "regular",
    ]),
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException($data["error"]["message"]);
}
```

## Response (201)

```json
{
  "id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a8b",
  "style": "yoga",
  "date": "2026-12-03",
  "time": "18:00",
  "starts_at": "2026-12-03T16:00:00+00:00",
  "duration_minutes": 60,
  "pay": 180,
  "region": "gush_dan",
  "address": "ביאליק 20, רמת גן",
  "status": "open",
  "close_mode": "choose",
  "cancel_policy": "regular",
  "offers_waiting": 0,
  "trainer": null,
  "invitation": null,
  "created_at": "2026-11-29T07:40:00+00:00"
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Identifier. |
| `style` | one of: pilates, barre, strength, crossfit, trx, calisthenics, cardio, hiit, spinning, running, aqua, yoga, mobility, meditation, personal, martial_arts, boxing, krav_maga, dance, zumba, kids, seniors, other | A training style: one of the keys in Catalog. |
| `date` | string | A date in Israel, YYYY-MM-DD. |
| `time` | string | A time of day in Israel, HH:MM, 24 hours. |
| `starts_at` | string | An exact moment, ISO 8601 with its offset. |
| `duration_minutes` | integer | Length of the class in minutes. |
| `pay` | integer | What the business pays the trainer. |
| `region` | one of: gush_dan, shfela, sharon, haifa, jerusalem, north, south, judea_samaria | A region of Israel: one of the keys in Catalog. |
| `address` | string | The address. |
| `status` | one of: open, filled, missed | open: looking for a trainer. filled: a trainer was chosen and paid. missed: it began and no trainer was found. |
| `close_mode` | one of: choose, first | choose: the business chooses among offers. first: the first trainer to accept takes it. |
| `cancel_policy` | one of: flexible, regular, strict | Free cancellation until: flexible 2 hours before, regular 6 hours before, strict 24 hours before. |
| `offers_waiting` | integer | How many offers wait for a choice. |
| `trainer` | object, nullable | The chosen trainer, or null. |
| `trainer.id` | string | Identifier. |
| `trainer.name` | string | The trainer's name. |
| `trainer.verified` | boolean | Has the blue check. |
| `invitation` | object, nullable | A direct invitation to one trainer, or null when the request is open to everyone. |
| `invitation.trainer_id` | string | Identifier. |
| `invitation.trainer_name` | string, nullable | The invited trainer's name. |
| `invitation.state` | one of: waiting, accepted, declined, expired | waiting: no answer yet. accepted, declined. expired: the window ran out. |
| `invitation.until` | string | When the invitation runs out. |
| `created_at` | string | An exact moment, ISO 8601 with its offset. |

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `bad_body` | The request body is not a JSON object (or a field in it is missing or malformed). The message names it. |
| 401 | `missing_key` | The endpoint needs a key and no Authorization header came. |
| 401 | `bad_key` | The key is not one of ours, was revoked, or its account was closed or blocked. |
| 403 | `read_only_key` | The key only reads. Actions need a key made with "read and actions" (or an app signed in with the scope repp.write). |
| 403 | `not_a_business` | The endpoint is for businesses and the key's account has none. |
| 409 | `idempotency_conflict` | The Idempotency-Key was already used by this key for a different action. |
| 409 | `no_place` | The business has no saved place yet: it is set once on the site ("העסק שלי"). |
| 409 | `action_refused` | The site's own rules refused the action; `reason` says which (for example class_not_available, already_offered, booking_not_available). |
| 429 | `too_many_actions` | The key ran 200 actions in the last 24 hours. Reads still work. |
| 429 | `too_many_requests` | Over the rate limit. Wait the seconds in `Retry-After` (60) and go on. |
| 500 | `server_error` | Something failed on our side. Try again shortly. |
