Payload CMS icon

Payload CMS

Interact with Payload CMS collections and globals

Endpoint → Put

AI-generated

Summary

Update a document in a Payload CMS collection via a PUT request.

Inputs

  • resource (required) — Endpoint to operate on
  • data (required) — JSON payload to send
  • depth — How deep to populate relationships
  • limit — Maximum number of documents to return
  • page — Page number for pagination
  • sort — Sort field (use - for descending)
  • where — Where clause for filtering (JSON format)
  • select — Fields to select (comma-separated)
  • locale — Locale for localized content
  • upload — Name of the binary property that contains the file to upload
  • query — Query parameters to add to the request url

Output shape

the server's response JSON

Returns the response body; errors are wrapped in an error object when continueOnFail is disabled

Examples

Example 1: Update a document in a collection

resource: "collection", operation: "update", data: {"name":"John"}, additionalOptions: {"where":"{"_id":"123"}"}

Example 2: Update a global setting

resource: "global", operation: "update", data: {"title":"New Title"}

Example 3: PUT request to a custom endpoint

resource: "/custom/path", operation: "put", data: {"key":"value"}, additionalOptions: {"upload":"file"}

Links

Discussion