> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# postPurchaseFlowPublish

> Replace the store's post-purchase flow. It is live at once, for every order, with no draft and no rollback: to undo a publish, publish the old flow, after concluding any A/B test it started. Call without `acknowledgedRisks` first to see the `risks`; nothing changes until each is acknowledged. A running A/B test can't leave the flow or change here, only be rerouted: conclude it with `postPurchaseAbTestConclude`. A SPLIT step with no `split.id` starts a new test. A page attached to a checkout experience still wins over this flow. Null without a Shopify integration. CONVERSION_FEATURE_LOCKED (409) when post-purchase is locked for the store. POST_PURCHASE_FLOW_UNREADABLE (409) when the stored flow can't be read.

**Required scopes:** [`checkout_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-checkout_write)

## Arguments

**acknowledgedRisks** `[String!]`

The `code` of every risk you accept.

**definition** `[PostPurchaseFlowDefinitionInput!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-definition-input)` *required*

The whole flow.

**fields**

**edges** `[\[PostPurchaseFlowEdgeInput!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-edge-input)` *required*

Its edges. A port leads to at most one step.

**fields**

**from** `String!` *required*

The step it leaves, or `"trigger"` for the start.

**port** `String!` *required*

`next` from the start; `accept` or `decline` from a page; `matching` or `nonMatching` from a segment; a treatment's id (or, for one you're adding, its name) from a split.

**to** `String!` *required*

The step it leads to.

**steps** `[\[PostPurchaseFlowStepInput!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-step-input)` *required*

Its steps.

**fields**

**id** `String!` *required*

Any id, unique in the flow. The edges name steps by it.

**segment** `[PostPurchaseSegmentInput](/docs/api-reference/v3/reference/checkout/post-purchase-segment-input)`

Which orders a SEGMENT step matches.

**split** `[PostPurchaseFlowSplitInput](/docs/api-reference/v3/reference/checkout/post-purchase-flow-split-input)`

A SPLIT step's A/B test.

**title** `String`

A SEGMENT step's name.

**type** `[PostPurchaseFlowStepType!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-step-type)` *required*

What the step does.

**upsellPageId** `String`

A PAGE step's page.

**expectedRevision** `String!` *required*

The `postPurchaseFlowRevision` you reviewed.

## Returns

**postPurchaseFlowPublish** `[PostPurchaseFlowPublishResult](/docs/api-reference/v3/reference/checkout/post-purchase-flow-publish-result)`

The outcome of `postPurchaseFlowPublish`.

**fields**

**diagnostics** `[\[PostPurchaseFlowDiagnostic!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-diagnostic)` *required*

Why an INVALID publish was refused.

**fields**

**blocks** `[PostPurchaseFlowDiagnosticBlocks!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-diagnostic-blocks)` *required*

What it stops.

**code** `String!` *required*

A stable code.

**message** `String!` *required*

What is wrong.

**stepId** `String`

The step it is on; null for the flow as a whole.

**flow** `[PostPurchaseFlow](/docs/api-reference/v3/reference/checkout/post-purchase-flow)`

The flow now.

**fields**

**edges** `[\[PostPurchaseFlowEdge!\]!](/docs/api-reference/v3/pagination)` *required*

Its edges.

**fields**

**from** `String!` *required*

The step it leaves, or `"trigger"` for the start.

**port** `String!` *required*

The port it leaves by: `next` from the start; `accept` or `decline` from a page; `matching` or `nonMatching` from a segment; a treatment id from a split.

**to** `String!` *required*

The step it leads to.

**locked** `Boolean!` *required*

Whether post-purchase is locked for the store, which refuses writes.

**revision** `String!` *required*

A hash of the stored flow, for `expectedRevision`. `"none"` with no flow.

**steps** `[\[PostPurchaseFlowStep!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-step)` *required*

Its steps. Empty with no flow.

**fields**

**id** `String!` *required*

The step's id. Publishing gives every step a new one.

**segment** `[PostPurchaseSegment](/docs/api-reference/v3/reference/checkout/post-purchase-segment)`

Which orders a SEGMENT step matches.

**split** `[PostPurchaseFlowSplit](/docs/api-reference/v3/reference/checkout/post-purchase-flow-split)`

A SPLIT step's A/B test.

**title** `String`

A SEGMENT step's name.

**type** `[PostPurchaseFlowStepType!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-step-type)` *required*

What the step does.

**upsellPage** `[UpsellPage](/docs/api-reference/v3/reference/checkout/upsell-page)`

A PAGE step's page. Null on the others, and when the page was deleted.

**revision** `String!` *required*

The store's flow revision now.

**risks** `[\[PostPurchaseFlowRisk!\]!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-risk)` *required*

The consequences of publishing this flow.

**fields**

**code** `[PostPurchaseFlowRiskCode!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-risk-code)` *required*

What kind of consequence.

**message** `String!` *required*

What happens.

**splitIds** `[String!]!` *required*

The stored A/B tests it concerns.

**status** `[PostPurchaseFlowPublishStatus!](/docs/api-reference/v3/reference/checkout/post-purchase-flow-publish-status)` *required*

What happened.

## Example

```graphql theme={null}
mutation {
  postPurchaseFlowPublish(acknowledgedRisks: "...", definition: { ... }, expectedRevision: "...") {
    revision
    status
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.