# Writes

[Open in the interactive reference](https://docs.api.lensing.ai/?op=guide%3Awrites)

Records are created with `POST`, updated with `PATCH` and deleted with `DELETE`. A successful write answers `200`.

### What a write returns

What a write returns depends on the endpoint. A create returns the new record's id, the whole record, or something in between; an update often returns an empty `data` object. Each endpoint's response shows what it returns. When you need the complete record, read it with `GET` by `id`.

### Updating a record

An update changes only the fields in the request body and leaves every other field as it is, so you do not need to read a record before changing one field. To clear a field, send `null`; see [Types and formats](https://docs.api.lensing.ai/api/app/uiengine/static/content-isolation-assets/guides/types.html).

Some list fields, such as a customer's addresses, are replaced as a whole when you send them: entries you leave out are removed. Check the field's description before you send part of a list.

For what a failed write leaves behind, see [Responses and errors](https://docs.api.lensing.ai/api/app/uiengine/static/content-isolation-assets/guides/responses.html). To retry a write safely, see [Idempotency](https://docs.api.lensing.ai/api/app/uiengine/static/content-isolation-assets/guides/idempotency.html).

## Examples

**Create, then read back**

```
POST /accounting/customers       -> { "data": { "id": "9f2c…" } }
GET  /accounting/customers/9f2c… -> the full record
```
