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

# commerceAgentStrategyPublish

> Publish a Commerce Agent strategy's staged `draft`, so agents use its guidance. Fails with `COMMERCE_AGENT_STRATEGY_REVISION_STALE` when the draft changed since `expectedRevision`, including when another draft was published since. Repeating a publish that already went live returns the strategy unchanged. Returns null when this store has no strategy with that id.

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

## Arguments

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

The `draft.revision` you reviewed.

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

The strategy id.

## Returns

**commerceAgentStrategyPublish** `[CommerceAgentStrategy](/docs/api-reference/v3/reference/marketing/commerce-agent-strategy)`

Guidance for a Commerce Agent conversation started by a Start Agent Conversation automation step: the goal, how to write the outreach, and an optional discount code the agent may offer. The guidance fields are the published guidance that agents use; a change staged by `updateCommerceAgentStrategy` waits in `draft` until it is published.

**fields**

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

When the strategy was created.

**discountCodeId** `ID`

The DiscountCode the Commerce Agent may offer. Null when there is none, or when the discount code was deleted.

**draft** `[CommerceAgentStrategyDraft](/docs/api-reference/v3/reference/marketing/commerce-agent-strategy-draft)`

Guidance staged by `updateCommerceAgentStrategy` and not yet published. Null when nothing is staged.

**fields**

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

When the draft was first staged.

**goalGuidance** `String`

The goal guidance that goes live on publish. Null clears it.

**outreachGuidance** `String`

The outreach guidance that goes live on publish. Null clears it.

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

Identifies this draft's content. Pass it as `expectedRevision` to `commerceAgentStrategyPublish`; it changes whenever the draft does.

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

When the draft was last changed.

**goalGuidance** `String`

The published goal guidance, which agents use: what the Commerce Agent should accomplish in the conversation. A staged change waits in `draft`.

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

The id of this strategy. Set it as `strategyId` on a Start Agent Conversation step.

**name** `String!` *required*

Merchant-facing name.

**outreachGuidance** `String`

The published outreach guidance, which agents use: how the Commerce Agent should write its first message and replies. A staged change waits in `draft`.

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

When the strategy's name, discount code or published guidance last changed. Staging a draft does not change it.

## Example

```graphql theme={null}
mutation {
  commerceAgentStrategyPublish(expectedRevision: "...", id: "...") {
    createdAt
    discountCodeId
    goalGuidance
    id
    name
    outreachGuidance
    updatedAt
  }
}
```


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