# Set whether a commitment renews

`PUT /apis/cra.diagrid.io/v1beta1/billing/subscription/commitments/{CommitmentId}/auto-renew`

Turn auto-renew on or off for one of the organization's prepaid annual commitments. Turning it off does not end coverage: the commitment runs to the end of its current term and lapses there, after which the regions it covers are billed monthly from the next billing period. Turning it on again before the term ends resumes renewal. Returns the updated billing subscription.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `CommitmentId` | string | Yes | The prepaid annual commitment's identifier, as listed in the billing subscription's spec.commitments[].id. |

### Request body

Required.

`application/json`

Whether a prepaid annual commitment renews at the end of its term.

- `autoRenew` (boolean) — Required. True to renew the commitment for another term when the current one ends; false to let it lapse at the end of the current term.

## Responses

### 200 — [OK](https://jsonapi.org/format/#crud-updating-responses-200)

`application/json`

- `apiVersion` (string)
- `kind` (string)
- `metadata` (object)
  - `name` (string) — The resource's name. It identifies the resource in request paths and cannot be changed. On create, the name must use only lowercase letters, digits and hyphens, start with a letter, and end with a letter or digit (`^[a-z]([a-z0-9-]*[a-z0-9])?$`).
  - `uid` (string) — A unique identifier the server assigns to the resource when it is created.
  - `resourceVersion` (integer) — The version of the resource's spec. The server increments it each time the spec changes.
  - `createdAt` (string) — When the resource was created, in UTC.
  - `updatedAt` (string) — When the resource was last changed, in UTC.
  - `deletedAt` (string) — When the resource's deletion was requested, in UTC. Absent while the resource is not being deleted.
  - `labels` (object<string, string>) — Key-value pairs attached to the resource.
  - `annotations` (object) — Additional information attached to the resource as key-value pairs.
- `spec` (object) — Required. The desired, user-independent configuration of the subscription: which rail settles it, the billing cadence, and where the payment-method precondition is enforced. The line items are derived from the org's config (`status.items`), not authored here.
  - `rail` (string) — Required. The settlement rail the subscription is billed through: card, for self-serve billing against the org's vaulted card, or cloud_marketplace, for billing through the cloud provider's marketplace. One of: `card`, `cloud_marketplace`.
  - `commitment` (string) — Required. The billing cadence, and it is always monthly. Annual capacity is bought as prepaid lots in `commitments`, never as a cadence on the subscription itself. One of: `monthly`.
  - `paymentPolicy` (string) — Required. Selects where the payment-method precondition sits: upfront (gates region create -> trialing) or after_trial (gates trialing -> active). One of: `upfront`, `after_trial`.
  - `entitlements` (object[]) — Allowances agreed with Diagrid: up to `quantity` chargeable resources of a given `kind` and `descriptor` are discounted by `discountPercent` (100 means free), oldest first, whatever the `rail`. Resources beyond the allowance are priced normally: creating one needs a valid default payment method, and an unpaid charge for them never blocks, suspends or removes a covered resource. Empty means no allowance.
    - `kind` (string) — Required. The chargeable kind this entitlement covers: dedicated_region, byoc_dedicated_region or private_region.
    - `descriptor` (string) — The variant within `kind`. For a region kind it is "<size>/<supportPlan>" (e.g. "large/premium") — the size and the support plan purchased with the region together select a single price, so an entitlement comps a region AT a support level rather than the two separately. Must match a descriptor the price catalog actually prices; a row that matches nothing is rejected.
    - `quantity` (integer) — Required. The number of matching resources this entitlement covers. The oldest live resources matching `kind` and `descriptor` (by `createdAt`) are covered, up to this number; any beyond them are overage.
    - `discountPercent` (integer) — The discount, from 0 to 100, applied to each covered item's catalog price. 100 makes the item's `amountCents` 0.
  - `commitments` (object[]) — The org's prepaid capacity lots: up to `quantity` live regions matching `kind` and `descriptor` are fully covered for the term. A commitment is not an entitlement: an entitlement is a discount for a deal paid for elsewhere, with no term and no charge; a commitment has a term, renews, and is charged for, on either `rail`.
    - `id` (string) — Required. The stable lot identifier, server-generated. Status rows and renewal notices key off it.
    - `kind` (string) — Required. The chargeable kind the commitment covers, in the same vocabulary as an entitlement's `kind`.
    - `descriptor` (string) — Required. The variant of kind the commitment covers. For a region it is "<size>/<supportPlan>", for example "large/premium".
    - `quantity` (integer) — Required. How many matching regions this lot covers. Today it is always 1: a lot is created only by a self-serve purchase at region create, which buys one region's worth of capacity. It counts REGIONS, never dollars — the unit count a metered prepay was settled at is a settlement detail, in `status`.
    - `termStart` (string) — When coverage starts: the purchase instant, or the trial end when bought while trialing, on either rail.
    - `termEnd` (string) — When the commitment's coverage ends.
    - `boughtTermEnd` (string) — The term end the customer originally bought, and it is present ONLY where the term was CUT SHORT. Its presence is the signal: it means "this term was ended early, and this is where it was going to end", so the months between it and `termEnd` are what the customer lost. A healthy lot does not carry it, because `termEnd` already is what was bought. Read status.commitments[].lapseCause for why the term was cut short.
    - `autoRenew` (boolean) — Defaults true: at term end the lot renews for another term and is charged for again.
- `status` (object) — The current state of the subscription, set by the server: its phase, its trial dates, its line items and total, and the payment references for the way it is paid (card or cloud marketplace).
  - `status` (string) — The current processing status of the resource.
  - `updatedAt` (string) — The time of the last status update.
  - `messages` (object[]) — Contains any status messages, such as error details.
    - `message` (string) — The text of the message.
  - `phase` (string) — The lifecycle state. One of: `pending_payment_method`, `trialing`, `active`, `past_due`, `suspended`, `canceled`.
  - `trialStartedAt` (string) — When the trial started.
  - `trialEndsAt` (string) — When the trial ends and charging begins.
  - `graceEndsAt` (string) — The deadline by which the org must fix payment before its regions are removed; set while in pending_payment_method / past_due / suspended, absent otherwise.
  - `cancelAtPeriodEnd` (boolean) — Reports a cancellation that is scheduled but has not taken effect yet: the regions the subscription bills for keep running until the end of the period that has been paid for, and the items and amount below are still being charged for that remainder. Read it together with paidThroughAt, which is the date the cancellation takes effect. It does not imply any particular phase — a cancellation can be scheduled while the phase is still active — so a pending cancellation must be read from this field rather than inferred from phase.
  - `paidThroughAt` (string) — The end of the billing period already paid for. While cancelAtPeriodEnd is set it is the date the cancellation takes effect and the regions are removed; it is also the date a new subscription created before then starts billing from, so a period already paid for is never charged twice.
  - `items` (object[]) — The kind-agnostic line items derived from the org's chargeable configuration. Today only dedicated_region items are emitted.
    - `kind` (string) — The chargeable kind (e.g. dedicated_region; future: seat, addon...).
    - `refId` (string) — The charged thing's id (e.g. the region id).
    - `descriptor` (string) — The variant within the kind. For a region kind it is "<size>/<supportPlan>" (e.g. "large/premium") — the size and the support plan purchased with the region together select a single price.
    - `product` (string) — The user-facing product bucket this line item bills for, derived from Kind: "dedicated_cloud" for a Diagrid-hosted dedicated region, and "byoc" for a bring-your-own-cloud dedicated region or a private region (both run on the customer's own infrastructure). It lets clients group and label line items by product without knowing the finer-grained kinds. One of: `dedicated_cloud`, `byoc`.
    - `quantity` (integer) — The number of units billed for this item; today always 1.
    - `priceId` (string) — The catalog price billed for this item, before any discount.
    - `amountCents` (integer) — The amount billed for this item, in cents, after `discountPercent`.
    - `salesLed` (boolean) — Reports whether this line is excluded from self-serve card settlement: true means it must never be sent to the card rail for charging, even if the org has a valid default payment method for its other (self-serve) lines. It is derived from this line's own Kind — every line bills a region, so there is no line whose sales-led status is inherited from another.
    - `discountPercent` (integer) — The discount, from 0 to 100, applied to this item's catalog price by an entitlement (see `spec.entitlements`): 0 means none and 100 means the item is free. `amountCents` already reflects it, while `priceId` stays the full catalog price.
    - `coveredByCommitmentId` (string) — The prepaid annual commitment covering this line; `coveredUntil` says until when. Both are absent on a line that is covered by something other than a commitment, or not covered at all. Which line a commitment covers can change as regions come and go, so read these off the current subscription rather than remembering them.
    - `coveredUntil` (string) — When the commitment in coveredByCommitmentId stops covering this line.
  - `amountCents` (integer) — The total, in cents: the sum of each item's `amountCents`.
  - `currency` (string) — The single currency all items resolve to.
  - `salesLed` (boolean) — Reports whether the trial is sales-led, with no self-serve payment rail. It is always sent, so false is distinct from absent.
  - `settlement` (object) — Holds rail-scoped settlement references. `spec.rail` names the active rail and therefore which of `card` and `marketplace` is authoritative. Both may be set at once, for example while an org moves between rails, so do not infer the rail from whichever one is set.
    - `card` (object) — The Stripe references for the card rail.
      - `stripeSubscriptionId` (string) — The id of the Stripe subscription charged to the organization's default card. Its trial ends at status.trialEndsAt.
      - `currentPeriodEnd` (string) — The end of the current Stripe billing period.
      - `latestInvoiceStatus` (string) — The Stripe status of the latest invoice, for example paid, open or uncollectible.
      - `hostedInvoiceUrl` (string) — The Stripe page for the latest unpaid invoice. When a charge is declined or needs the card to be authenticated, this is the page where the customer authenticates, pays, or updates their card. Cleared once the invoice is paid; empty when there is no unpaid invoice.
    - `marketplace` (object) — Holds the settlement references for the cloud_marketplace rail: who usage is reported against, and how far it has been reported.
      - `provider` (string) — The marketplace cloud: aws or azure.
      - `fulfillmentRef` (string) — The name of the payment method this settlement bills through.
      - `customerIdentifier` (string) — The marketplace-native buyer id usage is reported against, resolved at registration.
      - `licenseArn` (string) — The per-agreement licence the marketplace requires on each usage record (AWS only; empty for a provider that needs none).
      - `planId` (string) — The marketplace plan usage is reported under, when the provider requires one on the record (Azure only; empty for a provider that needs none).
      - `planChangedAt` (string) — When the buyer last moved to a different plan, and is empty for a subscription whose plan has never changed.
      - `meteredThrough` (string) — The metering watermark: usage up to this instant has been successfully reported to the marketplace. It only ever moves forward.
      - `carryCents` (integer) — The sub-unit remainder carried into the next reporting period.
      - `pendingPrepayCents` (integer) — The amount of prepaid-commitment money still to be reported as usage on this rail. It is added to by a purchase, a renewal or a commitment upgrade, and cleared when the metering hour that carried it is confirmed.
      - `lastReportedAt` (string) — When usage was last successfully reported to the cloud marketplace.
      - `lastReportError` (string) — Why the most recent usage report failed. Empty when it succeeded.
  - `commitments` (object[]) — The server-owned state of each of the organization's prepaid annual commitments, keyed by the same id as spec.commitments[]: how far the purchase has settled, and when it renews.
    - `id` (string) — The identifier of the commitment, matching spec.commitments[].id.
    - `phase` (string) — Pending_start, active or lapsed. A lot whose charge has not settled stays pending_start on either rail. Phase is a SETTLEMENT state, not a coverage state — coverage is decided by the term window alone.
    - `lapseCause` (string) — Says WHY the lot lapsed, and is set with the phase itself: subscription_canceled | term_ended | charge_refused | prepay_unsettled | covered_no_region. term_ended means the lot ran the full term it was paid for; covered_no_region means the lot covered no region when it was next due to be charged, so it was not charged and ended with nothing lost; subscription_canceled means the remainder of that term was forfeited, and the two unpaid causes mean the term was cut short for want of a charge. Absent while the lot is pending_start or active.
    - `lapsedAt` (string) — When the lot was stamped lapsed, which is the moment its coverage stopped. For a term cut short that is NOT the term end the customer was told: spec.commitments[].boughtTermEnd is the boundary they bought.
    - `stripePriceID` (string) — The annual catalog Price the lot was bought or last renewed at, so a later reprice stays auditable against what was paid.
    - `stripeInvoiceID` (string) — The one-off invoice that settled the lot on the CARD rail. Empty on the marketplace rail.
    - `prepayPeriodStart` (string) — The metering hour a lot's prepay was folded into, on the cloud_marketplace rail. `prepayUnits` is the unit count reported for it.
    - `prepayUnits` (integer) — The number of units reported to the cloud marketplace for the commitment's prepayment.
    - `unsettledPrepayCents` (integer) — This commitment's share of the marketplace prepay still to be reported: the cents raised for it that no metering hour has carried yet. Zero on the card rail, and zero once its prepay has settled.
    - `purchasedAt` (string) — When the commitment was bought, as distinct from termStart, which is when its coverage begins: a commitment bought during a trial starts covering when the trial ends. It never moves; a renewal extends the term of the same commitment rather than buying a new one.
    - `renewalNoticeStage` (string) — The send-once marker for the T-60/T-30/T-7 renewal notices.
    - `renewalInvoicedTermEnd` (string) — The term end at which the lot's most recent renewal was charged; the renewed term begins there. Unset until the lot's first renewal.
    - `upgradeInvoiceID` (string) — Names the one commitment-upgrade invoice that was raised for this lot and has not been collected; `upgradeInvoiceTarget` is the "kind/descriptor" it was raised for. Both are set together and cleared together, and they outlive the revert that puts a declined upgrade back — the lot stays at the size it covers today, and this pair is the record of the larger one that was asked for and refused. Paying that invoice does not by itself resize anything. The upgrade is applied when the same resize is requested again, which collects this invoice rather than raising a second one — and applies at no further charge if the invoice has been paid in the meantime.
    - `upgradeInvoiceTarget` (string) — The "kind/descriptor" the uncollected upgrade invoice in upgradeInvoiceID was raised for.
    - `lastInvoiceStatus` (string) — The last outcome reported for the invoice that settles this commitment — the one that bought it, the one that last renewed it, or an upgrade that applied: `paid`, or `payment_failed`, and absent while no outcome has been reported yet. It is empty for a commitment bought through a cloud marketplace, where no invoice is raised. It is the only field that says whether the money for a commitment ARRIVED. `phase` is a settlement state that advances when the term starts whether or not it did, and `stripeInvoiceID` names the invoice without saying what became of it — an invoice exists from the moment one is raised, a declined card included. So this is the field to read before presenting prepaid time as forfeited: only a collected charge makes it so. A declined commitment-upgrade invoice keeps its own outcome and is never reported here.
    - `renewsAt` (string) — The date this commitment renews and is charged again, present only while auto-renew is on AND the commitment currently covers a region. Its absence is the useful signal: it means coverage simply ends at the commitment's term end, and the regions it covers return to monthly billing from the next billing period. A commitment that covers no region is not renewed or charged again: it ends at its term end unless a matching region exists by then, so it is served without a renewal date. It is served rather than left to be derived so that every surface states the same date. A client must not compute it from termEnd itself: whether a commitment renews is a property of the commitment, and reading it off a date alone would show a renewal for a commitment the customer has already cancelled.

### 400 — The request body did not say whether to renew.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 401 — Authentication failed: the credentials are missing or not valid, or the `x-diagrid-orgid` header names a different organization than the credentials.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 403 — You are not authorized to perform this action.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### 404 — [Not found](https://jsonapi.org/format/#fetching-resources-responses-404)

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.

### default — Unexpected error.

`application/json`

In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.

- `code` (string) — Required. This is the same as the HTTP status of the response.
- `message` (string) — Required. A short description of the error.
- `status` (object) — Required. A status code that indicates the error type.
- `details` (object) — Additional details about the errors.
  - `@type` (string) — The type of error.
  - `reason` (string) — A reason for the error.
  - `domain` (string) — The domain in which the error occurred.
  - `metadata` (object) — Additional metadata about the error.

`application/vnd.api+json`

JSONAPI.org specification error response wrapper for UI.

- `error` (object) — In the case of an error, a standard format error response body will be returned and the HTTP status code will be set to an error status. The response contains an object with a single error object.
  - `code` (string) — Required. This is the same as the HTTP status of the response.
  - `message` (string) — Required. A short description of the error.
  - `status` (object) — Required. A status code that indicates the error type.
  - `details` (object) — Additional details about the errors.
    - `@type` (string) — The type of error.
    - `reason` (string) — A reason for the error.
    - `domain` (string) — The domain in which the error occurred.
    - `metadata` (object) — Additional metadata about the error.
- `meta` (object<string, object>) — Link members related to the primary data.
  - One of:
    - **string (uri-reference)** — A string containing the link's URL.
    - **object**
      - `href` (string (uri-reference)) — Required. A string containing the link's URL.
      - `meta` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
- `links` (object) — Non-standard meta-information that can not be represented as an attribute or relationship.
