> For the complete documentation index, see [llms.txt](https://docs.vomevolunteer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vomevolunteer.com/resources/schedule/shifts/write-operations/upsert-shifts.md).

# Upsert shifts

This endpoint creates and updates shifts in one call. An entry with no `id` is created. An entry with an `id` is updated.

<mark style="color:red;">An</mark> <mark style="color:red;">**id**</mark> <mark style="color:red;">that does not match a shift in your organization is reported as an error rather than created, so that a stale ID cannot quietly produce a duplicate shift.</mark>

#### Endpoint

```plaintext
POST api/shifts/bulk-upsert/
```

#### Example Request Payload

```json
{
    "allow_partial": true,
    "shifts": [
        {
            "id": "4a9f2c7e-1b2c-4d3e-8f90-a1b2c3d4e5f6",
            "spots": 20
        },
        {
            "opportunity_id": "2f56f3ef-08f5-4e5a-bf5b-76ca8fc4d5f1",
            "shift_start_at": "2026-11-16T14:00:00Z",
            "shift_end_at": "2026-11-16T17:00:00Z",
            "spots": 12,
            "use_default_location": true
        }
    ]
}
```

#### Behavior

* Entries without an `id` follow the same rules as [Create shifts](https://docs.vomevolunteer.com/resources/schedule/shifts/write-operations/create-shifts.md), including the duplicate-time guard.
* Entries with an `id` follow the same rules as [Update shifts](https://docs.vomevolunteer.com/resources/schedule/shifts/write-operations/update-shifts.md), changing only the fields you send.
