# updateWarranty

mutation · in the family [Warranty](/reference/warranty/)

## What it does

Edit warranty terms on what you sell — change its details.

Edit a Warranty's mutable attributes. Requires the unrestricted capability + the record's CURRENT revision.

## Careful

Edits take effect immediately and write a new revision; the old revision stays in history.

## Who may call it

Capability area: **Selling** — Ringing sales, serving customers and issuing invoices.

- Owner
- Manager
- Associate Manager
- Sales Associate
- Cashier
- An API key whose scope allows `api:updateWarranty`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `id` | [ID](/types/#scalars) `ID!` | yes | The id of the record. |
| `revision` | [ID](/types/#scalars) `ID!` | yes | The revision id you read on the record; the change is refused if an edit landed in the meantime. |
| `input` | [EditWarrantyInput](/types/EditWarrantyInput/) `EditWarrantyInput!` | yes | No further notes. |

## Returns

[Warranty](/types/Warranty/) `Warranty!` — A Warranty — THE WARRANTY INSTANCE: one sold order line under one WarrantyTerms template. Born by the ENGINE when the sale completes (paid AND delivered) for every variant line whose product carries an active product-attached template or whose variant names a manufacturer carrying an active manufacturer-attached template (one warranty per matching template); never created on the wire. The policy is SNAPSHOTTED at birth (provider · durationDays → expiresAt = startsAt + durationDays), so later template edits never rewrite an issued warranty. `active → expired` is the scheduler’s over expiresAt; `active → claimed` is fileClaimWarranty (a warranty_claim CsCase linked both ways). The serial number is optional and stamped through updateWarranty. Listings keep expired warranties as coverage history (the settled-payment class — a status filter narrows to active); every warranty stays reachable by id from the order line’s warrantyIds.

## Example request

```graphql
mutation ExampleUpdateWarranty($id: ID!, $revision: ID!, $input: EditWarrantyInput!) {
  updateWarranty(id: $id, revision: $revision, input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    organizationId
    orderLineNo
    variantId
    productId
    warrantyTermsId
    provider
    durationDays
    quantity
    startsAt
    expiresAt
    consumerId
    serialNumber
    caseId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "input": {
    "serialNumber": "<serial number>"
  }
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

## Example response

```json
{
  "data": {
    "updateWarranty": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "WR-EXMP-0000-000F",
      "type": "Warranty",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "orderLineNo": 1,
      "variantId": "01900000-0000-7000-8000-8415e73b0000",
      "productId": "01900000-0000-7000-8000-969657010000",
      "warrantyTermsId": "01900000-0000-7000-8000-d9cacfd90000",
      "provider": "manufacturer",
      "durationDays": 1,
      "quantity": "2",
      "startsAt": "2027-01-31T00:00:00.000Z",
      "expiresAt": "2027-01-31T00:00:00.000Z",
      "consumerId": "01900000-0000-7000-8000-6e8c92ec0000",
      "serialNumber": "<serial number>",
      "caseId": "01900000-0000-7000-8000-4559fce40000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `NOT_FOUND/*` — That record could not be found. ([NOT_FOUND](/errors/NOT_FOUND/))
- `CONFLICT/*` — The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. ([CONFLICT](/errors/CONFLICT/))
- `VALIDATION/VERSION_REQUIRED` — The request did not say which app version it came from. ([VALIDATION](/errors/VALIDATION/))

## Dry run

Add `dryRun: true` to the request envelope (`extensions.at`) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries `dryRun: true`, so a rehearsed record is never mistaken for a saved one.

## Used in

- [Set warranty terms and handle a claim](/use-cases/warranty-terms-and-claims/)
