# bulk_upsert_subscribers

Add or update up to 1,000 subscribers

`POST /v1/subscribers/bulk`

| | |
| --- | --- |
| Risk | bulk |
| Authentication | API key or OAuth access token |
| Scopes | `subscribers:write` |
| Idempotency | required: send an Idempotency-Key header |
| Dry run | yes: add dry_run=true to the query |
| Success status | 200 |
| Response type | application/json |

## What it does

- Use when: You send a batch of readers; each item is an upsert_subscriber body.
- Do not use when: you add one reader (call upsert_subscriber) or import a purchased list (not accepted).
- Side effects: Creates subscribers; Queues confirmation emails; Over 100 items becomes an async operation.
- Reversible: Yes, call unsubscribe_subscriber per reader.
- Required scope: subscribers:write.
- Idempotency: required (Idempotency-Key header).
- Typical next step: call get_operation if the answer was 202.

## Scopes

- `subscribers:write`: Add subscribers with double opt-in, update them, unsubscribe them, and change their lists and tags.

## Side effects

- Creates subscribers
- Queues confirmation emails
- Over 100 items becomes an async operation

## Request

### Path parameters

None.

### Query parameters

None.

Every mutation also accepts `dry_run=true`: it runs every check and returns `{"dry_run": true, "would": {...}}` without writing anything.

### Body (application/json)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array of any, max 1000 items | yes |  |

## Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `results` | array of object | yes |  |
| `results[].index` | integer, min -9007199254740991, max 9007199254740991 | yes | Position of the item in the request |
| `results[].status` | one of "added_pending", "confirmation_resent", "added_confirmed", "updated", "unchanged", "already_subscribed", "already_pending", "cannot_resubscribe", "invalid", "plan_limit", "daily_limit", "unavailable", "not_found", "unknown", "canceled" | yes |  |
| `results[].email` | string | no |  |
| `results[].subscriber_id` | string | no |  |
| `results[].code` | string | no |  |
| `results[].message` | string | no |  |
| `counts` | object | yes |  |

## Examples

### one item

Request:

```bash
curl -X POST 'https://api.seemly.com/v1/subscribers/bulk' \
  -H "Authorization: Bearer $SEEMLY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    {
      "email": "reader@example.com",
      "tags": [
        "launch"
      ]
    }
  ]
}'
```

Response: `200`:

```json
{
  "results": [
    {
      "index": 0,
      "status": "added_pending",
      "email": "reader@example.com",
      "subscriber_id": "sub_0123456789abcdefghjkmnpq",
      "message": "Added."
    }
  ],
  "counts": {
    "added_pending": 1
  }
}
```

## Errors

| Status | Codes |
| --- | --- |
| 400 | [`validation_failed`](/developers/md/errors/validation_failed), [`idempotency_key_required`](/developers/md/errors/idempotency_key_required) |
| 401 | [`unauthenticated`](/developers/md/errors/unauthenticated), [`credential_revoked`](/developers/md/errors/credential_revoked), [`credential_expired`](/developers/md/errors/credential_expired) |
| 403 | [`insufficient_scope`](/developers/md/errors/insufficient_scope), [`plan_does_not_include`](/developers/md/errors/plan_does_not_include), [`workspace_paused`](/developers/md/errors/workspace_paused), [`api_suspended`](/developers/md/errors/api_suspended), [`consent_required`](/developers/md/errors/consent_required) |
| 409 | [`conflict`](/developers/md/errors/conflict), [`idempotency_key_reused`](/developers/md/errors/idempotency_key_reused), [`request_in_progress`](/developers/md/errors/request_in_progress) |
| 413 | [`payload_too_large`](/developers/md/errors/payload_too_large) |
| 415 | [`unsupported_media_type`](/developers/md/errors/unsupported_media_type) |
| 429 | [`rate_limited`](/developers/md/errors/rate_limited), [`quota_exceeded`](/developers/md/errors/quota_exceeded) |
| 503 | [`service_unavailable`](/developers/md/errors/service_unavailable) |

Every error is an `application/problem+json` body with a `code`, a `fix` sentence and `next_actions`. See [reading a problem response](/developers/md/guides/agents#reading-a-problem-response).

## Typical next steps

- [`get_operation`](/developers/md/operations/get_operation)
- [`list_subscribers`](/developers/md/operations/list_subscribers)

## Related

- [OpenAPI document](https://api.seemly.com/v1/openapi.json)
- [Agent guide](/developers/md/guides/agents)
