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

# knowledgeArticlePublish

> Publish the changes staged on a Commerce Agent knowledge article, so Commerce Agent uses them. Fails with `KNOWLEDGE_ARTICLE_REVISION_STALE` when the draft changed since `expectedRevision`, and with `KNOWLEDGE_ARTICLE_DRAFT_STALE` when the live article changed after the draft was staged: stage the change again with `updateKnowledgeArticle`, or `deleteKnowledgeArticle` for a removal, then publish the `draft.revision` it returns. Repeating a publish that already went live returns the article unchanged. Returns null when this store has no article with that id.

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

## Arguments

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

The `draft.revision` you reviewed. Read it with a token that has `commerce_agent_knowledge_read`.

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

The article's `id`.

## Returns

**knowledgeArticlePublish** `[KnowledgeArticlePublishResult](/docs/api-reference/v3/reference/commerce-agent/knowledge-article-publish-result)`

The outcome of `knowledgeArticlePublish`.

**fields**

**article** `[KnowledgeArticle](/docs/api-reference/v3/reference/commerce-agent/knowledge-article)`

The article after the publish. Null when the publish removed it.

**fields**

**content** `String!` *required*

The live article body as authored.

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

When the article was created.

**draft** `[KnowledgeArticleDraft](/docs/api-reference/v3/reference/commerce-agent/knowledge-article-draft)`

Changes staged by the API and not yet published. Null when nothing is staged. Reading it needs a token with `commerce_agent_knowledge_read`.

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

**fields**

**content** `String!` *required*

The body the article gets on publish.

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

When the draft was first staged.

**deletesArticle** `Boolean!` *required*

True when publishing removes the article. The other fields then repeat the article as it was when the removal was staged.

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

When the article stops being retrievable after publish. Null means no end.

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

When the article becomes retrievable after publish, if `status` is ACTIVE. Null means immediately.

**referencedArticleIds** `[ID!]!` *required*

The ids of the knowledge articles the article cites after publish, as accepted by `referencedArticleIds` on the write inputs.

**referencedProductFamilyIds** `[ID!]!` *required*

The ids of the product families the article cites after publish, as accepted by `referencedProductFamilyIds` on the write inputs.

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

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

**status** `[KnowledgeArticleStatus!](/docs/api-reference/v3/reference/commerce-agent/knowledge-article-status)` *required*

The status the article gets on publish.

**title** `String!` *required*

The title the article gets on publish.

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

When the draft was last changed.

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

When the live article stops being retrievable. Null means no end.

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

When the live article becomes retrievable, if `status` is ACTIVE. Null means immediately.

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

The id of this knowledge article.

**origin** `[KnowledgeArticleOrigin!](/docs/api-reference/v3/reference/commerce-agent/knowledge-article-origin)` *required*

How this article was created. Immutable after create.

**productFamilies** `[ProductFamilyConnection!](/docs/api-reference/v3/pagination)` *required*

Product families this article cites.

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

**fields**

**Arguments**

**after** `String`

Forward pagination cursor — returns items after it. Pass an `edges[].cursor` or `pageInfo.endCursor` from a previous page.

**before** `String`

Backward pagination cursor — returns items before it. Pass an `edges[].cursor` or `pageInfo.startCursor` from a previous page.

**first** `Int`

Forward pagination: returns the first N items (max 100, default 25). Use with `after`; mutually exclusive with `last`/`before`.

**last** `Int`

Backward pagination: returns the last N items (max 100, default 25). Use with `before`; mutually exclusive with `first`/`after`.

**Fields**

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

The list of edges (each a node plus its pagination `cursor`).

**nodes** `[\[ProductFamily!\]!](/docs/api-reference/v3/reference/catalog/product-family)` *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** `[PageInfo!](/docs/api-reference/v3/pagination)` *required*

Pagination metadata for the current page.

**referencedArticles** `[KnowledgeArticleConnection!](/docs/api-reference/v3/pagination)` *required*

Other knowledge articles this article cites.

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

**fields**

**Arguments**

**after** `String`

Forward pagination cursor — returns items after it. Pass an `edges[].cursor` or `pageInfo.endCursor` from a previous page.

**before** `String`

Backward pagination cursor — returns items before it. Pass an `edges[].cursor` or `pageInfo.startCursor` from a previous page.

**first** `Int`

Forward pagination: returns the first N items (max 100, default 25). Use with `after`; mutually exclusive with `last`/`before`.

**last** `Int`

Backward pagination: returns the last N items (max 100, default 25). Use with `before`; mutually exclusive with `first`/`after`.

**Fields**

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

The list of edges (each a node plus its pagination `cursor`).

**nodes** `[\[KnowledgeArticle!\]!](/docs/api-reference/v3/reference/commerce-agent/knowledge-article)` *required*

The nodes in this page, without the edge/cursor wrapper — a convenience over `edges`.

**pageInfo** `[PageInfo!](/docs/api-reference/v3/pagination)` *required*

Pagination metadata for the current page.

**status** `[KnowledgeArticleStatus!](/docs/api-reference/v3/reference/commerce-agent/knowledge-article-status)` *required*

Whether Commerce Agent may retrieve this live article. Combine with the effective window.

**title** `String!` *required*

The live merchant-facing title of the article.

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

When the live article body was last edited.

**deleted** `Boolean!` *required*

True when the article was removed, now or earlier.

## Example

```graphql theme={null}
mutation {
  knowledgeArticlePublish(expectedRevision: "...", id: "...") {
    deleted
  }
}
```


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