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

# My spaces

The business's own spaces, paused ones too, with their address, hours and how they are booked.

- `GET https://api.dev.repp.co.il/v1/my-spaces`
- Needs a key: `Authorization: Bearer repp_…`.

A key of an account with no business gets `403 not_a_business`.

## Request

**cURL**

```bash
curl "https://api.dev.repp.co.il/v1/my-spaces" \
  -H "Authorization: Bearer $REPP_API_KEY"
```

**JavaScript**

```js
const response = await fetch("https://api.dev.repp.co.il/v1/my-spaces", {
  headers: { Authorization: `Bearer ${process.env.REPP_API_KEY}` },
});
if (!response.ok) throw new Error((await response.json()).error.message);
const data = await response.json();
```

**TypeScript**

```ts
/** The business's spaces. */
interface MySpaces {
  items: MySpace[];
}

/** One of the business's own spaces. */
interface MySpace {
  id: string;
  name: string;
  active: boolean;
  price_per_hour: number;
  capacity: number;
  days: number[];
  open_from: string;
  open_to: string;
  region: Region;
  address: string;
  booking_mode: "instant" | "approval";
  cancel_policy: "flexible" | "regular" | "strict";
}

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

const response = await fetch("https://api.dev.repp.co.il/v1/my-spaces", {
  headers: { Authorization: `Bearer ${process.env.REPP_API_KEY}` },
});
if (!response.ok) throw new Error(((await response.json()) as ApiError).error.message);
const data = (await response.json()) as MySpaces;
```

**Python**

```python
import os

import requests

response = requests.get(
    "https://api.dev.repp.co.il/v1/my-spaces",
    headers={"Authorization": f"Bearer {os.environ['REPP_API_KEY']}"},
    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/my-spaces");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("REPP_API_KEY"),
    ],
]);
$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": "b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e",
      "name": "מתחם הקומה השנייה",
      "active": true,
      "price_per_hour": 90,
      "capacity": 12,
      "days": [
        0,
        1,
        2,
        3,
        4
      ],
      "open_from": "11:00",
      "open_to": "16:00",
      "region": "gush_dan",
      "address": "ביאליק 20, רמת גן",
      "booking_mode": "approval",
      "cancel_policy": "regular"
    }
  ]
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `items` | array of MySpace | Every space of the business, paused ones too, oldest first. |
| `items[].id` | string | Identifier. |
| `items[].name` | string | The space's name. |
| `items[].active` | boolean | Open for rent. A paused space is not in the index. |
| `items[].price_per_hour` | integer | Rent for one hour, in whole shekels. |
| `items[].capacity` | integer | How many people fit in it. |
| `items[].days` | array of integer | The weekdays it can be rented, 0 = Sunday. |
| `items[].open_from` | string | Opening time. |
| `items[].open_to` | string | Closing time. |
| `items[].region` | one of: gush_dan, shfela, sharon, haifa, jerusalem, north, south, judea_samaria | A region of Israel: one of the keys in Catalog. |
| `items[].address` | string | The address. |
| `items[].booking_mode` | one of: instant, approval | instant: a booking is confirmed at once. approval: it waits for your yes. |
| `items[].cancel_policy` | one of: flexible, regular, strict | Free cancellation until: flexible 2 hours before, regular 6 hours before, strict 24 hours before. |

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 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 | `not_a_business` | The endpoint is for businesses and the key's account has none. |
| 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. |
