Creates a new draft document. The published version must not already exist. If a draft exists, the action will fail by default.
Document to create. Must have _type property
_type
What to do if draft exists: 'fail' or 'ignore'
ID of the published document to create a draft for
await client.action({ actionType: 'sanity.action.document.create', publishedId: 'bike-123', attributes: {name: 'New Bike', _type: 'bike'}, ifExists: 'fail' // or 'ignore' to keep existing draft}) Copy
await client.action({ actionType: 'sanity.action.document.create', publishedId: 'bike-123', attributes: {name: 'New Bike', _type: 'bike'}, ifExists: 'fail' // or 'ignore' to keep existing draft})
Creates a new draft document. The published version must not already exist. If a draft exists, the action will fail by default.