Payload CMS icon

Payload CMS

Interact with Payload CMS collections and globals

Collection → Update by ID

AI-generated

Summary

Update a document in a collection by its ID

Inputs

  • collection (required) — Choose the collection to operate on
  • documentId (required) — The ID of the document to operate on
  • data (required) — The data to send (JSON format)
  • additionalOptions — Additional Options for the request (e.g., depth, limit, query parameters, etc.)

Output shape

updated document

If the request succeeds, the response body is returned; if it fails and continueOnFail is enabled, an error object is returned instead.

Examples

Example 1: Update a single document

Collection: posts; Document ID: 123; Data: {"title":"New Title"}; Additional Options: {}

Example 2: Update a document with locale and query parameters

Collection: users; Document ID: 456; Data: {"name":"Jane"}; Additional Options: Locale: en, Query: {"status":"active"}

Example 3: Update a document and upload a file

Collection: media; Document ID: 789; Data: {}; Additional Options: Upload: file, Query: {}

Links

Discussion