# Turn a customer's automatic top-up on or off (/api/usage/set-customer-auto-top-up)

`PATCH https://api.comecero.com/api/v1/customers/{customer_id}/usage/{subscription_id}/auto_top_up`

On: send `enabled` true with a `quote_id` from `POST .../auto_top_up/quotes` and `consent_accepted` true. Only the customer's own login can turn it on, since it is their consent to the quote's terms; the consent (the exact `consent_text`, the amounts, the card, who and from where) is kept as evidence, and the top-up is bound to that card. Accepting the same quote again changes nothing and answers the same. Accepting a new quote while it is on changes its amounts. Off: send `enabled` false; you or the customer may turn it off, and turning off what is off changes nothing. `expected_revision` is required, so a change made since you read it is never overwritten. The `Idempotency-Key` header is required: the request is kept (its body, then its answer, for a day) before anything changes, so a retry with the same key and body answers as the first did and changes nothing twice, and the same key with another body is refused.

## Parameters

- `Idempotency-Key` (header, required): Required. Names one change: the same request again with the same key (after a timeout, say) changes nothing more and answers as the first one did, for a day. 1 to 128 printable ASCII characters, sent once; missing or empty is refused (`400`, reference `UbV150`). Use a new random key, such as a UUID, for each change you mean to make. The same key with another body is refused (`409`, reference `UbV151`).

Request body: the `usage_auto_top_up_request` schema.

Responses: 200, 400, 401, 403, 404, 409, 500.

Full schemas: operation `set_customer_auto_top_up` in /openapi.json.