> ## Documentation Index
> Fetch the complete documentation index at: https://developers.onio.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing data

> Create, change and delete wishlists and wishes.

The write endpoints change your data in the same way as the app. Followers get the same notifications, for example when you add a shared wish to a shared list.

## Create

`POST /api/v1/wishlists` creates a wishlist. `POST /api/v1/wishlists/{wishlistId}/wishes` adds a wish. The response is the new item with its `id`, and the status is `201`.

```bash theme={null}
curl https://web.onio.app/api/v1/wishlists \
  -H "Authorization: Bearer onio_pat_your_token" \
  -H "Content-Type: application/json" \
  -d '{"title": "Birthday 2027", "occasion": "birthday"}'
```

* A new wishlist is always private (`draft`). To share it, see [Share](#share).
* A new wish is shared (`published`) unless you send `"status": "draft"`. A shared wish is visible only when its list is shared.
* An archived wishlist takes no new wishes. Unarchive it in the app first.
* Onio sets `id`, `createdAt` and `updatedAt`. Do not send them.

## Change

`PATCH` changes only the fields you send. Send `null` to clear an optional field, for example `"notes": null`.

```bash theme={null}
curl -X PATCH https://web.onio.app/api/v1/wishlists/3f6c1a52-8d1e-4b7a-9c2e-1f5d7a9b0c41/wishes/7b2e4c19-5a3d-4f8e-b6c1-2d9a0e7f3b58 \
  -H "Authorization: Bearer onio_pat_your_token" \
  -H "Content-Type: application/json" \
  -d '{"priority": "high", "description": null}'
```

* The API rejects unknown fields with `400`. This includes a wishlist’s `status`. To change it, use [Share](#share).
* If someone is getting the wish, they see the change. The API never tells you whether someone is getting a wish.
* The last write wins. A `PATCH` overwrites the fields it sends, also when the app changed them a moment before.

## Delete

`DELETE` answers `204` with no body.

* Deleting a wishlist also deletes its wishes. Its share link stops working.
* A deleted wish cannot be restored. Onio also removes its uploaded image.

To restore a deleted wishlist, write to [hello@onio.app](mailto:hello@onio.app) within 30 days.

## Share

`POST /api/v1/wishlists/{wishlistId}/share` shares a wishlist. It needs the `wishlists:share` scope. The response holds the share link, and the status is `200`.

```bash theme={null}
curl -X POST https://web.onio.app/api/v1/wishlists/3f6c1a52-8d1e-4b7a-9c2e-1f5d7a9b0c41/share \
  -H "Authorization: Bearer onio_pat_your_token"
```

```json theme={null}
{ "url": "https://web.onio.app/s/q3Zr8Kp1vXc0LmN4tYb7HwE2sJd9uFa6GhR5oTi_kWe" }
```

* The wishlist becomes shared (`published`). Anyone with the link can view it.
* If the wishlist already has a link, you get the same link again.
* People who already follow the wishlist see its wishes again.

`DELETE /api/v1/wishlists/{wishlistId}/share` stops sharing. It answers `204` with no body.

* The link stops working, and the wishlist becomes private (`draft`).
* Followers stay, but they no longer see the wishes.
* If you share the wishlist again, it gets a new link.

Both requests are safe to repeat. An archived wishlist cannot be shared or unshared: the API answers `409`. Unarchive it in the app first. The API cannot archive or unarchive a list.

## Conflicts

Each write is checked against changes from the app and from other tools. When your data changes during a write, Onio tries again on its own. If it still fails, the API answers `409`. Wait a moment and send the request again.

`409` also means that you tried to add a wish to an archived wishlist, or to share or unshare one. Do not retry that one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.