# API-Referenz: Standorte

## Standorte auflisten

`GET /v1/locations`

Alle Standorte der Organisation.

Antwort 200:

```json
{
  "object": "list",
  "data": [
    {
      "id": "loc_2b8e1c0d9f7a6b5c",
      "object": "location",
      "name": "Hofladen",
      "street": "string",
      "postal_code": "string",
      "city": "string",
      "country": "string",
      "latitude": 0,
      "longitude": 0,
      "time_zone": "string",
      "opening_hours": "string",
      "payment_integration_id": "string",
      "is_public": true,
      "created_at": "string"
    }
  ],
  "has_more": true
}
```

## Standort anlegen

`POST /v1/locations`

Neuer Standort mit Adresse und Zahlungskonto für QR-Zahlungen.

Parameter:

- `idempotency-key` (header, string): Wiederholbare Anfragen ohne doppelte Wirkung (24 Stunden)

Anfrage:

```json
{
  "name": "string",
  "street": "string",
  "postal_code": "string",
  "city": "string",
  "country": "CH",
  "latitude": -90,
  "longitude": -180,
  "time_zone": "Europe/Zurich",
  "opening_hours": "string",
  "payment_integration_id": "string",
  "is_public": true
}
```

Antwort 201:

```json
{
  "id": "loc_2b8e1c0d9f7a6b5c",
  "object": "location",
  "name": "Hofladen",
  "street": "string",
  "postal_code": "string",
  "city": "string",
  "country": "string",
  "latitude": 0,
  "longitude": 0,
  "time_zone": "string",
  "opening_hours": "string",
  "payment_integration_id": "string",
  "is_public": true,
  "created_at": "string"
}
```

## Standort abrufen

`GET /v1/locations/{id}`

Ein Standort.

Parameter:

- `id` (path, string, Pflicht)

Antwort 200:

```json
{
  "id": "loc_2b8e1c0d9f7a6b5c",
  "object": "location",
  "name": "Hofladen",
  "street": "string",
  "postal_code": "string",
  "city": "string",
  "country": "string",
  "latitude": 0,
  "longitude": 0,
  "time_zone": "string",
  "opening_hours": "string",
  "payment_integration_id": "string",
  "is_public": true,
  "created_at": "string"
}
```

## Standort ändern

`PATCH /v1/locations/{id}`

Ändert Name, Adresse, Öffnungszeiten oder das Zahlungskonto.

Parameter:

- `id` (path, string, Pflicht)

Anfrage:

```json
{
  "name": "string",
  "street": "string",
  "postal_code": "string",
  "city": "string",
  "country": "CH",
  "latitude": -90,
  "longitude": -180,
  "time_zone": "Europe/Zurich",
  "opening_hours": "string",
  "payment_integration_id": "string",
  "is_public": true
}
```

Antwort 200:

```json
{
  "id": "loc_2b8e1c0d9f7a6b5c",
  "object": "location",
  "name": "Hofladen",
  "street": "string",
  "postal_code": "string",
  "city": "string",
  "country": "string",
  "latitude": 0,
  "longitude": 0,
  "time_zone": "string",
  "opening_hours": "string",
  "payment_integration_id": "string",
  "is_public": true,
  "created_at": "string"
}
```

## Standort löschen

`DELETE /v1/locations/{id}`

Nur Standorte ohne Geräte.

Parameter:

- `id` (path, string, Pflicht)

Antwort 200:

```json
{
  "id": "string",
  "object": "string",
  "deleted": true
}
```
