---
title: "Update an Object"
method: PATCH
path: "/buckets/{slug}/objects/{object_id}"
tags: ["Objects"]
---

# Update an Object

`PATCH /buckets/{slug}/objects/{object_id}`

Update an Object in place. Only the properties you send are changed, and within `metadata` only the keys you send are changed, so you can update a single Metafield without resending the rest. Set `status` to `published` to publish a draft.

## Request body

- ObjectUpdate — Only the properties sent are changed. Within `metadata`, only the keys sent are changed.
  - `title` string
  - `slug` string
  - `status` 'published' | 'draft'
  - `content` string
  - `metadata` Metadata — Values of the Metafields defined on the Object type, keyed by Metafield `key`. The value shape follows the Metafield type, and differs between write and read for two of them: - Text, textarea, markdown, and HTML Metafields are strings. Number Metafields are numbers, switches are booleans, dates are ISO 8601 strings. - Object Relationship Metafields are written as an Object `id` string (or an array of ids for the multiple variant) and returned as a nested Object (or array of Objects) once `depth` is at least 1. - File and Image Metafields are written as a media `name` string (or an array of names) and returned as an object with `url` and `imgix_url`, plus `alt_text`, `width`, and `height` when requested via `props`. - Repeater Metafields are arrays of objects keyed by the child Metafield keys.
  - `thumbnail` string — Media `name`.
  - `locale` string
  - `publish_at` union — UNIX millisecond timestamp. Send `null` to clear.
    - string
    - number
  - `unpublish_at` union — UNIX millisecond timestamp. Send `null` to clear.
    - string
    - number
  - `trigger_webhook` boolean

## Response `200`

The updated Object.

- ObjectResponse
  - `object` Object, required — A single piece of content. Which properties are present depends on `props`.
    - `id` string — Unique identifier.
    - `type` string — Object type slug.
    - `title` string
    - `slug` string — Unique within the Object type. Localized versions of an Object share a slug and count as one Object against plan limits.
    - `status` 'published' | 'draft'
    - `content` string, nullable — HTML content. Deprecated in v3; use a Metafield instead.
    - `metadata` Metadata — Values of the Metafields defined on the Object type, keyed by Metafield `key`. The value shape follows the Metafield type, and differs between write and read for two of them: - Text, textarea, markdown, and HTML Metafields are strings. Number Metafields are numbers, switches are booleans, dates are ISO 8601 strings. - Object Relationship Metafields are written as an Object `id` string (or an array of ids for the multiple variant) and returned as a nested Object (or array of Objects) once `depth` is at least 1. - File and Image Metafields are written as a media `name` string (or an array of names) and returned as an object with `url` and `imgix_url`, plus `alt_text`, `width`, and `height` when requested via `props`. - Repeater Metafields are arrays of objects keyed by the child Metafield keys.
    - `bucket` string — Bucket id.
    - `thumbnail` string, nullable — Media `name` of the Object thumbnail. Returned as a URL on read.
    - `locale` string, nullable — Locale code, when the Object type has localization enabled.
    - `created_at` string, date-time
    - `created_by` string — User id.
    - `modified_at` string, date-time
    - `modified_by` string — User id.
    - `published_at` string, date-time, nullable
    - `publish_at` union — UNIX millisecond timestamp for scheduled publishing.
      - string
      - number
    - `unpublish_at` union — UNIX millisecond timestamp for scheduled unpublishing.
      - string
      - number
    - `assigned_to` string, nullable — User id.
    - `assigned_by` string, nullable — User id.
    - `assigned_at` string, date-time, nullable

## Other responses

- `400` — The request was invalid, most often a malformed `query` or a Metafield value that failed validation.
- `401` — The access key is missing or incorrect.
- `402` — The Bucket needs to be upgraded before it can be used again.
- `404` — The addressed resource does not exist in this Bucket. Note that this covers a resource missing from a route that exists; an unrecognized route answers 200 with a `Route not found` body instead, as described in the API description above.
- `429` — Too many requests hit the API too quickly. Back off and retry.
- `500` — Something went wrong on the Cosmic side.

---

[API](https://skmtc.dev/cosmicjs/apis/cosmic-rest-api-v3.md) · [All operations](https://skmtc.dev/cosmicjs/apis/cosmic-rest-api-v3/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/cosmicjs/cosmic-rest-api-v3/revisions/e0aa2a0913b3/schema)
