Publishes a draft document. Replaces published version if it exists. Deletes the draft after publishing. Can check revision IDs for optimistic locking.
Draft document ID to publish
Optional
Draft revision ID to match (optional)
Published revision ID to match (optional)
Published document ID to replace
await client.action({ actionType: 'sanity.action.document.publish', draftId: 'drafts.bike-123', publishedId: 'bike-123', ifDraftRevisionId: 'abc123', ifPublishedRevisionId: 'def456'}) Copy
await client.action({ actionType: 'sanity.action.document.publish', draftId: 'drafts.bike-123', publishedId: 'bike-123', ifDraftRevisionId: 'abc123', ifPublishedRevisionId: 'def456'})
Publishes a draft document. Replaces published version if it exists. Deletes the draft after publishing. Can check revision IDs for optimistic locking.