Type Alias ReplaceDraftAction

ReplaceDraftAction: {
    actionType: "sanity.action.document.replaceDraft";
    attributes: IdentifiedSanityDocumentStub;
    publishedId: string;
}

Replaces an existing draft document. At least one of draft or published versions must exist.

Type declaration

  • actionType: "sanity.action.document.replaceDraft"
  • attributes: IdentifiedSanityDocumentStub

    Document to create. Must have _id and _type

  • publishedId: string

    Published document ID to base draft on

await client.action({
actionType: 'sanity.action.document.replaceDraft',
publishedId: 'bike-123',
attributes: {
_id: 'drafts.bike-123',
_type: 'bike',
name: 'Updated Bike'
}
})