> ## 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.

# checkoutTreeCreate

> Save a whole checkout tree as a new tree. It doesn't go live until `checkoutTreePublish`. New A/B tests are created but don't start; tests that have started can't be changed here. CHECKOUT_TREE_REVISION_STALE when a tree was published since `expectedRevision`; CHECKOUT_TREE_DEFINITION_INVALID, with `diagnostics`, while a diagnostic blocks saving.

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

## Arguments

**definition** `[CheckoutTreeDefinitionInput!](/docs/api-reference/v3/reference/checkout/checkout-tree-definition-input)` *required*

The whole tree.

**fields**

**edges** `[\[CheckoutTreeEdgeInput!\]!](/docs/api-reference/v3/reference/checkout/checkout-tree-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; `matching`, `nonMatching` or an edge id from a segment; a treatment id (or, before the split is saved, its name) from a split.

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

The step it leads to.

**steps** `[\[CheckoutTreeStepInput!\]!](/docs/api-reference/v3/reference/checkout/checkout-tree-step-input)` *required*

Its steps.

**fields**

**config** `[JSON!](/docs/api-reference/v3/reference/common/json)` *required*

The step's settings, matching `configJsonSchema` on its `steps/<type>` page in `checkoutTreeCatalog`.

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

The step's id, unique in the tree. Keep a saved step's id; a new step may use any word and gets an id when saved.

**title** `String`

A name for the step.

**type** `[CheckoutTreeStepType!](/docs/api-reference/v3/reference/checkout/checkout-tree-step-type)` *required*

What the step does.

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

The `checkoutTreeRevision` the tree was made against, so a tree published meanwhile isn't overlooked.

## Returns

**checkoutTreeCreate** `[CheckoutTree!](/docs/api-reference/v3/reference/checkout/checkout-tree)` *required*

A saved checkout tree: which checkout experience each shopper sees. Saving never changes a tree; it creates a new one. One tree per store is live; make another live with `checkoutTreePublish`.

**fields**

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When it was saved.

**definition** `[CheckoutTreeDefinition!](/docs/api-reference/v3/reference/checkout/checkout-tree-definition)` *required*

Its steps and edges.

**fields**

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

Its edges, in port order.

**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; `matching`, `nonMatching` or an edge id from a segment; a treatment id from a split.

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

The step it leads to.

**steps** `[\[CheckoutTreeStep!\]!](/docs/api-reference/v3/reference/checkout/checkout-tree-step)` *required*

Its steps.

**fields**

**config** `[JSON!](/docs/api-reference/v3/reference/common/json)` *required*

The step's settings, matching `configJsonSchema` on its `steps/<type>` page in `checkoutTreeCatalog`.

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

The step's id, unique in the tree. It is also the id node analytics are reported under, so keep it when you edit the step.

**title** `String`

A name the merchant gave the step.

**type** `[CheckoutTreeStepType!](/docs/api-reference/v3/reference/checkout/checkout-tree-step-type)` *required*

What the step does.

**id** `ID!` *required*

The tree's id.

**live** `Boolean!` *required*

Whether shoppers see this tree now.

**script** `String!` *required*

The tree as CheckoutTreeScript. To change it, open a workspace with `workspaceCreate(resourceType: CHECKOUT_TREE)`.

## Example

```graphql theme={null}
mutation {
  checkoutTreeCreate(definition: { ... }, expectedRevision: "...") {
    createdAt
    id
    live
    script
  }
}
```


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