# unpublishStorefront

mutation · in the family [Storefront](/reference/storefront/)

## What it does

Take a live storefront down — the web address is released and the configuration stands for a later republish.

Unpublish a PUBLISHED Storefront: the domain marker RELEASES in the SAME transaction (the name becomes claimable); the config keeps standing for a later republish. The ONLY road from published to doom runs through here (the FSM forbids published→doomed). Requires the unrestricted capability + the record's CURRENT revision (OCC).

## What happens

The only road from live to decommissioned runs through here — a live site never vanishes in one step.

## Who may call it

Capability area: **System and integration setup** — Registers, connections and the settings your systems run on.

- Owner
- System Administrator
- An API key whose scope allows `api:unpublishStorefront`

## 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. |
| `reason` | [String](/types/#scalars) | no | No further notes. |

## Returns

[Storefront](/types/Storefront/) `Storefront!` — A Storefront — the ecom DTC PUBLISH-CONFIG document: which selling facility the site sells from, which canned theme renders it, which collections it merchandises, which browse tree and channel division frame it, and (optionally) the custom domain it claims. The lifecycle: born draft (claiming nothing) → publish (THE INVALID_CONFIG GATE re-validates every ref record-aware + the GLOBAL domain marker claims in the SAME transaction — CONFLICT/IDENTITY_TAKEN if another published site holds the name) → unpublish (the marker releases) → republish (the SAME gate + re-claim). published NEVER dooms — unpublish first (the FSM forbids the edge). THE SERVING ESTATE IS DELIBERATELY ABSENT v1 (the map): publish flips state, claims the domain, validates config — it provisions NOTHING; this record is the control plane the DTC workstream will consume. SEO copy rides the Decoration attachment, never fields here.

## Example request

```graphql
mutation ExampleUnpublishStorefront($id: ID!, $revision: ID!, $reason: String) {
  unpublishStorefront(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    theme
    customDomain
    collectionIds
    categoryId
    divisionId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

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

## Example response

```json
{
  "data": {
    "unpublishStorefront": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SF-EXMP-0000-000F",
      "type": "Storefront",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "theme": "<theme>",
      "customDomain": "<custom domain>",
      "collectionIds": [
        "01900000-0000-7000-8000-b1c179550000"
      ],
      "categoryId": "01900000-0000-7000-8000-786111a40000",
      "divisionId": "01900000-0000-7000-8000-25bd925b0000"
    }
  },
  "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/))

## Used in

- [Open your online storefront](/use-cases/open-a-storefront/)
