---
title: "Add a batch"
method: POST
path: "/batches"
tags: ["Batches"]
---

# Add a batch

`POST /batches`

Submit a batch for processing. Batches can be of three types: **addMembers**, **unsubscribe**, and **deleteMembers**.

### Batch type: unsubscribe
Provide a list of member IDs (integer) or email addresses (string) to unsubscribe.

### Batch type: deleteMembers
Provide a list of member IDs (integer) or email addresses (string) to delete.

### Batch type: addMembers
Add or update members in bulk. Key behaviors:
- If a member already exists, it is updated with the provided information.
- If a field is empty and data already exists for that field, the existing data is kept.
- To explicitly clear a field, use the special string `__EMPTY__`.
- All submitted members will be added to the specified groups (in addition to any existing group memberships).
- The `relationType` field is required and accepts: `express-consent`, `active-clients`, `information-request`,
  `business-card`, `web-contacts`, `purchased-list`, `contest-participants`, `mixed-list`, `inactive-clients`,
  `association-members`, `employees`, `partners`.

## Request body

- union
  - object
    - `batchType` 'unsubscribe', required
    - `ids` union[], required
      - union
        - string
        - integer
  - object
    - `batchType` 'deleteMembers', required
    - `ids` union[], required
      - union
        - string
        - integer
  - object
    - `batchType` 'addMembers', required
    - `relationType` 'express-consent' | 'active-clients' | 'information-request' | 'business-card' | 'web-contacts' | 'purchased-list' | 'contest-participants' | 'mixed-list' | 'inactive-clients' | 'association-members' | 'employees' | 'partners', required
    - `defaultConsentDate` string, date
    - `defaultConsentProof` string
    - `groups` integer[]
    - `members` object[], required
      - `email` string, email, required
      - `firstname` string
      - `lastname` string
      - `company` string
      - `gender` string
      - `language` string
      - `postalCode` string
      - `country` string
      - `note` string
      - `birthdate` string
      - `customFields` object
      - `consentDate` string
      - `consentProof` string

## Response `201`

The newly created batch (status will be NEW until processed)

- Batch
  - `id` integer
  - `batchType` string
  - `batchJson` object
  - `createdOn` string
  - `status` string — NEW, PROCESSING, or COMPLETED
  - `result` object, nullable
    - `errors` object[]
      - `id` union
        - string
        - integer
      - `description` string
    - `successes` string[]

## Other responses

- `400` — Bad request — invalid batch JSON
- `401` — Unauthorized

---

[API](https://skmtc.net/cyberimpact/apis/cyberimpact-api.md) · [All operations](https://skmtc.net/cyberimpact/apis/cyberimpact-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cyberimpact/cyberimpact-api/revisions/bf0b51ee8e8a/schema)
