Update an entry
Renames the entry, replaces its content with document or mdx, or edits it with operations (with name, also renames). document and mdx need expectedHash, the hash of the content they replace (from entries.get); a different current hash returns CONTENT_HASH_MISMATCH. Operations anchor on block IDs, unique text, and field keys from entries.get with contentFormat blocks; expectedHash is optional for them, and a missing or ambiguous anchor returns CONTENT_OPERATION_INVALID. Only the changed blocks change, so live edits elsewhere are kept. Current content without a version is first saved as an auto version. version also saves the new content as a named version. Rejects names already used by a sibling entry or collection. expectedName applies the update only when the entry still has that name. An active schema migration can block this action. A repeated request with the same Idempotency-Key header returns the first result for 24 hours.
Required API key permissions: entries. Write permissions also grant read access for the same resource.
Authentication
apiKeyhttp, bearer, Andesine API keyUse an Andesine API key as a Bearer token
oauthhttp, bearer, Andesine OAuth access tokenUse an OAuth access token with andesine:api scope. Send x-workspace-id for workspace operations. Current user permissions apply.
Path parameters
id*stringID of the entry to be updated
Headers
x-workspace-idstringRequired for OAuth: ID of the workspace to access. API keys use their own workspace.
Request body
application/jsonBodyobject7 fields
namestringNew name of the entry
documentobjectProseMirror JSON of the entry document, which must match the editor and the collection schema
5 fields
type*stringattrsobject1 field
{key}anycontentarray of ContentNodeInput5 fields
type*stringattrsobject1 field
{key}anycontentarray of ContentNodeInputmarksarray of ContentMark2 fields
type*stringattrsobject1 field
{key}anytextstringmarksarray of ContentMark2 fields
type*stringattrsobject1 field
{key}anytextstringmdxstringContent as MDX: the title as H1, properties as elements in place, fragments as elements, and images as asset:; frontmatter properties are also read, and entries.update and versions.create import image URLs
operationsarray of any ofEdit operations, applied in order; all or none apply
Options
Any of
Option 1object
Replace text in one block
type*constant"replaceText"find*stringText that occurs exactly once in the MDX of one block
replace*stringReplacement text
Option 2object
Replace a block with zero or more blocks
type*constant"replaceBlock"id*stringmdx*stringBlocks as MDX, without a title
Option 3object
Insert blocks
type*constant"insertBlocks"mdx*stringBlocks as MDX, without a title
beforestringID of the block to insert before
afterstringID of the block to insert after
positionstringInsert at the start or the end
"start", "end"fragmentstringFragment key for position
Option 4object
Delete blocks
type*constant"deleteBlocks"ids*array of stringOption 5object
Set a property value or the content of a fragment
type*constant"setField"key*stringField name or key
value*any ofProperty value, or MDX for a fragment
Options
Any of
Option 1string
Option 2number
Option 3boolean
Option 4array of string
Option 5null
expectedHashstringHash of the content that the change is based on
expectedNamestringName the entry must still have
versionobjectAlso save the new content as a version
1 field
namestringVersion name
Responses
200OKapplication/json
Bodyobject2 fields
hash*stringHash of the current content after the update
versionEntryVersionSummaryThe version saved with version
10 fields
id*stringID of the version
entryID*stringID of the versioned entry
entryName*stringEntry name stored in the version
hash*stringHash of the version content
name*any ofOptional name of the version
Options
Any of
Option 1string
Option 2null
reason*stringReason why the version was created
"auto", "manual", "revert", "schema-migration", "import"sourceVersionID*any ofSource version used for a revert
Options
Any of
Option 1string
Option 2null
contributorIDs*array of stringMemberships that contributed to the version
createdAt*stringTime when the version was created
updatedAt*stringTime when the version name was last updated
400Bad Requestapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"BAD_REQUEST"status*constant400message*string"Bad Request"dataValidationErrorData2 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
issuesarray of ValidationIssue3 fields
message*stringcodestringpatharray of any ofOptions
Any of
Option 1string
Option 2number
Option 3object
key*any ofOptions
Any of
Option 1string
Option 2number
Option 2object
defined*constanttruecode*constant"CONTENT_FORMAT_INVALID"status*constant400message*string"CONTENT_FORMAT_INVALID"data*object3 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
linenumberLine of the error in the source
columnnumberColumn of the error in the source
Option 3object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany401Unauthorizedapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"UNAUTHORIZED"status*constant401message*string"Unauthorized"dataErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany403Forbiddenapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"FORBIDDEN"status*constant403message*string"Forbidden"dataForbiddenErrorData4 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
missingPermissionsarray of stringrequiredPlanconstant"pro"actionstringThe requested action that was denied
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany404Not Foundapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"NOT_FOUND"status*constant404message*string"Not Found"dataErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany409Conflictapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"CONFLICT"status*constant409message*string"Conflict"dataErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constanttruecode*constant"CONTENT_NAME_CONFLICT"status*constant409message*string"CONTENT_NAME_CONFLICT"data*ContentNameConflictErrorData4 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
name*stringslug*stringConflicting URL slug derived from the name
parentID*any ofOptions
Any of
Option 1string
Option 2null
Option 3object
defined*constanttruecode*constant"CONTENT_SCHEMA_INVALID"status*constant409message*string"CONTENT_SCHEMA_INVALID"data*ContentSchemaInvalidErrorData5 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
entryIDstringversionIDstringrevisionID*any ofOptions
Any of
Option 1string
Option 2null
issues*array of ContentSchemaIssue4 fields
code*string"invalid_schema", "invalid_structure", "missing_field", "unknown_field", "duplicate_field", "field_kind_mismatch", "field_key_mismatch", "property_type_mismatch", "invalid_property_value", "invalid_field_options", "invalid_allowed_blocks", "invalid_fragment_content"message*stringpath*array of any ofOptions
Any of
Option 1string
Option 2number
fieldIDstringOption 4object
defined*constanttruecode*constant"CONTENT_HASH_MISMATCH"status*constant409message*string"CONTENT_HASH_MISMATCH"data*object3 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
hash*stringHash of the current content
changedIDsarray of stringEntries of a bulk call that kept the change, because they were edited meanwhile
Option 5object
defined*constanttruecode*constant"CONTENT_OPERATION_INVALID"status*constant409message*string"CONTENT_OPERATION_INVALID"data*object3 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
index*numberIndex of the operation that failed
reason*stringWhy the operation's anchor didn't match
"not_found", "ambiguous"Option 6object
defined*constanttruecode*constant"CONTENT_LINK_INVALID"status*constant409message*string"CONTENT_LINK_INVALID"data*object2 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
href*stringLink that doesn't point to an entry
Option 7object
defined*constanttruecode*constant"CONTENT_IMAGE_UNAVAILABLE"status*constant409message*string"CONTENT_IMAGE_UNAVAILABLE"data*object4 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
url*stringImage URL in the content
assetID*stringImported image
assetStatus*stringStatus of the image when the write stopped waiting
Option 8object
defined*constanttruecode*constant"CONTENT_PRECONDITION_FAILED"status*constant409message*string"CONTENT_PRECONDITION_FAILED"data*object3 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
field*stringExpected field that didn't match
current*any ofCurrent value of the field
Options
Any of
Option 1string
Option 2null
Option 9object
defined*constanttruecode*constant"IDEMPOTENCY_KEY_IN_PROGRESS"status*constant409message*string"A request with this Idempotency-Key is in progress"data*ErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 10object
defined*constanttruecode*constant"SCHEMA_FIELD_KEY_CONFLICT"status*constant409message*string"SCHEMA_FIELD_KEY_CONFLICT"data*SchemaFieldKeyConflictErrorData4 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
key*stringkind*string"fragment", "property"fieldIDs*array of stringOption 11object
defined*constanttruecode*constant"SCHEMA_MIGRATION_IN_PROGRESS"status*constant409message*string"A schema migration is in progress for this collection"data*SchemaMigrationErrorData2 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
migrationID*stringOption 12object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany422Unprocessable Contentapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"IDEMPOTENCY_KEY_REUSED"status*constant422message*string"This Idempotency-Key was used with a different request"data*ErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany429Too Many Requestsapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"TOO_MANY_REQUESTS"status*constant429message*string"Too Many Requests"dataRateLimitErrorData3 fields
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
limitstringThe limit that was reached: a short-term rate limit, or a monthly API call, AI credit, or spending limit
"rate", "api-calls", "ai-credits", "spending"retryAfterSecondsnumberMinimum delay before another attempt, in seconds. Also sent in Retry-After.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany500Internal Server Errorapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"INTERNAL_SERVER_ERROR"status*constant500message*string"Internal Server Error"dataErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany503Service Unavailableapplication/json
Bodyone ofOptions
One of
Option 1object
defined*constanttruecode*constant"SERVICE_UNAVAILABLE"status*constant503message*string"Service Unavailable"dataErrorData1 field
hintsarray of stringSuggested next steps. Wording can change; use error codes and structured data for program logic.
Option 2object
defined*constantfalsecode*stringstatus*numbermessage*stringdataany