# Partial updates (/docs/basic-concepts/partial-updates)

To change an object you send a `POST` to its URL with only the fields you want to change. Everything you leave out stays as it is. This page shows how that works and the few rules to keep in mind.

## Send only what changes [#send-only-what-changes]

To change a customer's email address, send just the email:

<Tabs items={['curl', 'Node.js']}>
<Tab value="curl">

```bash
curl -X POST "https://api.comecero.com/api/v1/customers/0106784119870CueWmZ9P7" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "email": "john@example.com" }'
```

</Tab>
<Tab value="Node.js">

```js
const response = await fetch(
  'https://api.comecero.com/api/v1/customers/0106784119870CueWmZ9P7',
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.COMECERO_TEST_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ email: 'john@example.com' }),
  },
);
const customer = await response.json();
```

</Tab>
</Tabs>

The name, addresses and every other field stay the same. The response is the whole customer after the change. See [Update a customer](/api/customers/update-customer) for the fields you can send.

## Leaving a field out is not the same as null [#leaving-a-field-out-is-not-the-same-as-null]

- Leave a field out to keep its value.
- Send it as `null` to clear it.

```json
{ "phone": null }
```

This removes the customer's phone number. Check the endpoint page before you clear a field: a required field cannot be cleared.

## Child objects [#child-objects]

Some child objects are updated the same way as the object itself. On a customer, sending part of `billing_address` changes only those fields of the address:

```json
{ "billing_address": { "postal_code": "10023" } }
```

Sending `"billing_address": null` resets the whole address.

`meta` is different: the value you send replaces the old one completely. To add one key to `meta`, read the object, change its `meta`, and send all of it back (see [Meta data](/docs/basic-concepts/meta-data)). Lists of values, such as a list service's `licenses`, are also replaced whole.

## Fields the endpoint does not know [#fields-the-endpoint-does-not-know]

A field that is not part of the object is usually ignored rather than refused. So a misspelled field name fails quietly: check the response to make sure the change happened. Fields that are read only, such as `date_created`, cannot be changed.

## The one exception [#the-one-exception]

Roles are replaced, not updated: [Replace a role](/api/roles/update-role) is a `PUT` that needs the whole role, and fields you leave out are cleared. Every other update in the API is a `POST` that changes only the fields you send.

## Next steps [#next-steps]

<Cards>
  <Card title="Meta data" href="/docs/basic-concepts/meta-data" />
  <Card title="Errors" href="/docs/basic-concepts/error-handling" />
</Cards>
