> 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/opportunities/write-operations/upsert-opportunities.md).

# Upsert opportunities

This endpoint creates and updates opportunities 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 an opportunity in your organization is reported as an error rather than created, so that a stale ID cannot quietly produce a duplicate.</mark>

#### Endpoint

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

#### Example Request Payload

```json
{
    "allow_partial": true,
    "opportunities": [
        {
            "id": "2f56f3ef-08f5-4e5a-bf5b-76ca8fc4d5f1",
            "title": "Weekend Mentor"
        },
        {
            "category_id": "d610ab31-e480-4ef1-9e35-94f94ebacde9",
            "title": "Evening Mentor",
            "coordinator_ids": ["8f1c2d3e-4a5b-6c7d-8e9f-0a1b2c3d4e5f"]
        }
    ]
}
```

#### Behavior

* Entries without an `id` follow the same rules as [Create opportunities](https://docs.vomevolunteer.com/resources/opportunities/write-operations/create-opportunities.md), including the required category, title and coordinator.
* Entries with an `id` follow the same rules as [Update opportunities](https://docs.vomevolunteer.com/resources/opportunities/write-operations/update-opportunities.md), changing only the fields you send.
