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

# Trainers

The trainers in the public index: available now first, then verified, then those who switched on most recently, then the newest profiles.

- `GET https://api.dev.repp.co.il/v1/trainers`
- Public: no key.

The index never carries a phone number or a trainer's free-text about. A trainer appears once the profile is complete.

## Query parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `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 | — | Only this style. |
| `region` | one of: gush_dan, shfela, sharon, haifa, jerusalem, north, south, judea_samaria | — | Only this region. |
| `available` | boolean | `false` | Only trainers whose "looking for work" switch is on. |
| `limit` | integer 1–100 | `60` | How many to return, 1 to 100. |
| `offset` | integer 0–5000 | `0` | How many to skip from the start (for the next page), up to 5000. |

## Request

**cURL**

```bash
curl "https://api.dev.repp.co.il/v1/trainers?style=yoga&region=gush_dan"
```

**JavaScript**

```js
const response = await fetch("https://api.dev.repp.co.il/v1/trainers?style=yoga&region=gush_dan");
if (!response.ok) throw new Error((await response.json()).error.message);
const data = await response.json();
```

**TypeScript**

```ts
/** One page of a list. */
interface TrainerPage {
  items: Trainer[];
  more: boolean;
}

/** A trainer in the public index. Never a phone number or the trainer's free-text about. */
interface Trainer {
  id: string;
  name: string;
  photo_url: string | null;
  styles: Style[];
  regions: Region[];
  rating: Rating;
  verified: boolean;
  available_now: boolean;
}

/** 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";

/** The rating, or null while nobody has rated yet. */
type Rating = {
  average: number;
  count: number;
} | null;

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

const response = await fetch("https://api.dev.repp.co.il/v1/trainers?style=yoga&region=gush_dan");
if (!response.ok) throw new Error(((await response.json()) as ApiError).error.message);
const data = (await response.json()) as TrainerPage;
```

**Python**

```python
import requests

response = requests.get(
    "https://api.dev.repp.co.il/v1/trainers?style=yoga&region=gush_dan",
    timeout=30,
)
if not response.ok:
    raise RuntimeError(response.json()["error"]["message"])
data = response.json()
```

**PHP**

```php
<?php
$ch = curl_init("https://api.dev.repp.co.il/v1/trainers?style=yoga&region=gush_dan");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException($data["error"]["message"]);
}
```

## Response (200)

```json
{
  "items": [
    {
      "id": "3f2b9c1e-8a7d-4e6f-b5a4-1c2d3e4f5a6b",
      "name": "דנה כהן",
      "photo_url": "https://example.supabase.co/storage/v1/object/public/avatars/3f2b9c1e/photo.webp",
      "styles": [
        "yoga",
        "pilates"
      ],
      "regions": [
        "gush_dan"
      ],
      "rating": {
        "average": 4.8,
        "count": 12
      },
      "verified": true,
      "available_now": true
    }
  ],
  "more": false
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `items` | array of Trainer | The items of this page. |
| `items[].id` | string | Identifier. |
| `items[].name` | string | The trainer's name. |
| `items[].photo_url` | string, nullable | The trainer's photo, or null. |
| `items[].styles` | array of Style | The styles the trainer teaches. |
| `items[].regions` | array of Region | The regions the trainer works in. |
| `items[].rating` | Rating, nullable | The rating, or null while nobody has rated yet. |
| `items[].rating.average` | number | The average stars, 1 to 5, to two decimals. |
| `items[].rating.count` | integer | How many ratings. |
| `items[].verified` | boolean | We checked the trainer's instructor certificate (the blue check). |
| `items[].available_now` | boolean | The trainer's "looking for work" switch is on. |
| `more` | boolean | There is another page: ask again with a larger offset. |

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `bad_parameter` | A parameter is not one the endpoint accepts. The message names it. |
| 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. |
