---
title: "EmailLabelRelations.batch_create_or_update"
method: POST
path: "/entities/EmailLabelRelations/batch-modify"
tags: ["Email"]
---

# EmailLabelRelations.batch_create_or_update

`POST /entities/EmailLabelRelations/batch-modify`

## Request

- Base URL: `https://us-east.api.coevera.com/api/v100/rest/spaces/your_space_id`
- URL: `https://us-east.api.coevera.com/api/v100/rest/spaces/your_space_id/entities/EmailLabelRelations/batch-modify`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/coevera/apis/coevera-crm-api/docs/entities/EmailLabelRelations/batch-modify/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates or updates EmailLabelRelation records in one request: an item with an id updates that record, an item without one creates a new record.

## Query parameters

- `validation-level` integer
- `rollback-method` 0 | 1

## Request body

- BatchEmailLabelRelationInput[]
  - `email_label` object: Label applied to the thread by this relation. Related EmailLabel record; see 'updateEmailLabelInput' for its fields.
    - `id` string, uuid: Id of the related EmailLabel record.
  - `email_label_id` string, uuid: Id of the applied label.
  - `mailbox_id` string, uuid: Id of the mailbox (connected email account) the label is applied in. A label applies to a thread per mailbox, so the same thread can be labelled differently in two mailboxes.
  - `owner_id` string, uuid: Id of the relation owner.
  - `thread_id` string, uuid: Identifier of the conversation thread the label is applied to, matching Email.threadId. Every email in the thread shows the label.
  - `id` string, uuid: ID of object to update.

## Response `200`

Result per item, in request order: the id of the created or updated record, or the error.

- object
  - `success` boolean: True when the request succeeded; false on error.
  - `data` union[]
    - union
      - string, uuid: Id of the created or updated record.
      - Error: The body of every REST error. `code` and `name` are stable identifiers; `message` is for people. The full list of codes is at https://developers.coevera.com/reference/errors/.
        - `http_status` integer, required: HTTP status code.
        - `code` integer: Numeric code of the API error.
        - `name` string: Name of the API error.
        - `message` string: Message describing the error.
        - `success` boolean, required: Always false on error.

## Other responses

- `400`: Bad request: a bad or unknown parameter (codes 117, 118), a missing permission (code 50), conflicting data (code 2002) or any other API error. The REST API answers 400 where others answer 403 or 409; check `code`.
- `401`: Not authenticated: missing or wrong credentials, a credential of another space, or an expired token (code 401, ERROR_UNAUTHORIZED).
- `422`: Validation failed (code 40000, with the failing fields) or a required parameter is missing (code 119). By default one failed item fails a whole batch and nothing is written.
- `429`: Too many requests (code 182). Wait for the seconds in Retry-After, then retry.
- `500`: Unexpected server error (code 1000, ERROR_UNKNOWN).

---

[API](https://skmtc.dev/coevera/apis/coevera-crm-api.md) - [All operations](https://skmtc.dev/coevera/apis/coevera-crm-api/llms.txt) - [OpenAPI document](https://skmtc.dev/coevera/apis/coevera-crm-api/revisions/40ebbc83f179?raw)
