# Update override

POST `https://app.iteras.dk/api/customers/updateoverride/`

The API key must allow "Change subscriber data".

Changes an existing override, e.g. a new end to extend or shorten it, or a new address. It is also how a suspension is ended, which unpauses the subscription.

Which fields can change depends on the state of the override. Only overrides that have not taken effect yet can have all their fields changed; once an override is active, only its `end` can change. An override that has ended cannot be changed at all. A vacation override can change its `override_type` to another vacation type while it is still in the future.

At least one field besides `override_id` must be given. If `address` is left out, the existing address is kept; if `weekdays` is left out, the existing weekdays are kept.

## Parameters

- `id` (string, required): ID of the customer.
- `override_id` (string, required): ID of the override.

  Find it with the [customer data](/api/docs/server/retrievingcustomers.md) or [create override](/api/docs/server/createoverride.md) endpoint.
- `override_type` (string): A new type of override, only for a vacation override that is still in the future. Changing to an address override requires an `address`.

  See the [available override types](/api/docs/server/overridetypes.md).
- `begin` (string): The new effective date of the override, as `YYYY-MM-DDTHH:MM:SS`.
- `end` (string): The new end of the override, as `YYYY-MM-DDTHH:MM:SS`: the first moment it no longer applies, so a pause through 20 November ends at `2026-11-21T00:00:00`. For a suspension, the end must be now, and ending it unpauses the subscription.
- `address` (object): The new address, for the overrides that change the delivery or billing address or send to another address, e.g. `{"name": "John Doe", "address": "Main Street 12\n8000 Aarhus", "country": "DK"}`, where `address` is the address lines with postcode and city, without the country.
- `new_values` (object): The fields to change for a `change-fields` override that is still in the future, e.g. `{"name": "New Name"}`. Custom fields are referenced by their field ID.

  See the custom fields set up for your account below.
- `pause_reason` (string): A new reason for pausing, for a `pause-subscription` override that is still in the future.
- `weekdays` (array): The weekdays the override applies to, for an address override, as numbers with 1 being Monday and 7 being Sunday, e.g. `[1, 3, 5]`. Only relevant for weekdays-based distribution.
- `exclude_from_webhooks` (bool, Defaults to `false`): Set to `true` to keep every event the request causes from being sent to webhooks, invoice and payment events included, e.g. `"exclude_from_webhooks": true`. The events are still added to the history.

A `change-fields` override can change a built-in customer or subscription field, or a custom field.

You can set any custom customer field, using its field id (the field name with a colon prepended, or its external identifier).

[Log in](/login/?next=/api/docs/server/updateoverride.md), or send your API key as a bearer token, to see the custom customer fields set up for your account.

A yes/no field (type `bool`) is `true` or `false`, and has no value when it isn't set. Set it with `true` or `false`, and clear it with `null`.

A date and time field (type `datetime`) can be set up to follow other fields, so it is set to the time one of them changes. If the same update changes the date and time field itself, that value is kept.

You can set any custom subscription field, using its field id (the field name with a colon prepended, or its external identifier).

[Log in](/login/?next=/api/docs/server/updateoverride.md), or send your API key as a bearer token, to see the custom subscription fields set up for your account.

A yes/no field (type `bool`) is `true` or `false`, and has no value when it isn't set. Set it with `true` or `false`, and clear it with `null`.

## Examples

Extend an override:

```http
POST /api/customers/updateoverride/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "id": "12345",
  "override_id": "77642",
  "end": "2027-01-22T13:57:00"
}
```

End a suspension, unpausing the subscription:

```http
POST /api/customers/updateoverride/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "id": "12345",
  "override_id": "77642",
  "end": "2026-11-22T13:57:00"
}
```

Move a future address change:

```http
POST /api/customers/updateoverride/ HTTP/1.1
Content-Type: application/json
```

```json
{
  "id": "12345",
  "override_id": "77642",
  "begin": "2027-01-22T13:57:00",
  "address": {
    "name": "John Doe",
    "address": "Main Street 12\n8000 Aarhus",
    "country": "DK"
  }
}
```

## Return value

On success the endpoint returns the ID of the updated override:

```json
{ "override_id": "77642" }
```

## Errors

Invalid requests due to programming error, e.g. invalid JSON, no fields to change, an unknown field, a field with the wrong type, an unknown `override_type` or a change of type that isn't allowed, returns 400.

A well-formed operation where a supplied value is invalid is not executed and returns an HTTP 422 error. This covers changing a field that is locked for the override's state, an `end` that isn't later than `begin`, an invalid `address` or `new_values`, an override type the subscription's policy does not allow, an override that takes effect before the earliest possible delivery date or on a date blocked for delivery changes, an override that overlaps an existing one, and a suspension end that isn't now. Errors that are not specific to a field are returned with the empty string as key, e.g. an unknown override or an override that has already ended:

```json
{
  "": ["Override has ended."]
}
```

An unknown field or a locked field is reported under its own name:

```json
{
  "begin": ["This field cannot be changed for this override."]
}
```