---
title: "Batch create, update, and delete Objects"
method: POST
path: "/buckets/{slug}/objects/batch"
tags: ["Objects"]
---

# Batch create, update, and delete Objects

`POST /buckets/{slug}/objects/batch`

Perform up to 25 Object operations in a single request. Each operation succeeds or fails independently, so inspect the `status` of every entry in the response rather than relying on the HTTP status alone. Prefer this over repeated single-Object calls when changing many Objects.

## Request body

- BatchRequest
  - `operations` BatchOperation[], required
    - `method` 'add' | 'edit' | 'delete', required
    - `object_id` string — Required for `edit` and `delete`.
    - `object` object — Required for `add` and `edit`. Accepts the same properties as the single-Object create and update endpoints.
    - `trigger_webhook` boolean

## Response `200`

The per-operation results, in request order.

- BatchResponse — Results in request order. Operations succeed or fail independently, so check each `status`.
  - `operations` object[], required
    - `method` 'add' | 'edit' | 'delete'
    - `status` 'success' | 'error'
    - `object` Object — 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
    - `message` string — Present on deletes and on failures.

## 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)
