---
title: "Set a field on many contacts"
description: "Set one custom field to the same value on many contacts, as the Contacts page's Set field does: the contacts you list (contact_ids or emails, up to 1,000, each a contact of this workspace) or every member of a segment (segment_id, however many; also needs segments:read). `POST /api/v1/contacts/set-field`"
url: https://www.unitpost.com/docs/platform/post-contacts-set-field
section: "Platform API reference"
updated: 2026-11-17
---
# Set a field on many contacts

`POST /api/v1/contacts/set-field`

Set one custom field to the same value on many contacts, as the Contacts page's Set field does: the contacts you list (`contact_ids` or `emails`, up to 1,000, each a contact of this workspace) or every member of a segment (`segment_id`, however many; also needs `segments:read`). Send exactly one. `key` names a field that exists ([Create a custom contact field](https://www.unitpost.com/docs/platform/post-contact-fields)); `value` is typed against it the way an import types it, and `null` clears it. With `only_empty: true` a contact that has its own value keeps it (a contact that only shows the field's `default_value` has none, so it is filled). Each contact whose value changes gets a `contact.updated` webhook (`changed_fields`) and an activity row naming your key; one that already has the value is left as it is. Subscriptions, topics and SMS consent are never touched. It always runs as a background job (`202`, `Location`); follow it with [Retrieve a job](https://www.unitpost.com/docs/platform/get-jobs-id). Listed contacts are checked first: the first that isn't one of yours is a `404` naming it (`details`), and nothing starts. One bulk operation runs per field at a time, and five bulk contact edits per workspace (`409 job_in_progress`). Starting one counts against a limit of 30 bulk contact edits a minute per workspace by default (a `429` started nothing; retry after `Retry-After`). Pass an `Idempotency-Key` so a retry answers the same job instead of starting another. To give different contacts different values, update each with [Update a contact](https://www.unitpost.com/docs/platform/patch-contacts-id) or import them with [Start an async contact import](https://www.unitpost.com/docs/platform/post-contacts-imports). Requires the `contacts:write` capability.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Any unique string (1–256 characters, e.g. a UUID). Retrying with the same key and the same body within 24 hours returns the first result instead of sending again; the same key with a different body is `409 invalid_idempotent_request`, and one still in flight is `409 concurrent_idempotent_requests`. |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | yes | The custom field's key (`plan`). It must exist: create it with POST /contact-fields first. |
| `value` | string \| number \| boolean \| null | yes | The value, typed against the field the way an import types it: a number field takes `42` or `"42"`, a boolean `true` / `"yes"`, a date an ISO 8601 date. `null` clears the field. |
| `only_empty` | boolean | no | Default false: overwrite every value. True: set it only where the contact has no value of its own (the key is missing or null; a contact that shows the field's default has none). Not with `value: null`. |
| `contact_ids` | string[] | no | Contacts of this workspace (`con_…`), up to 1,000. |
| `emails` | string[] | no | Contacts of this workspace by email address, up to 1,000. |
| `segment_id` | string | no | Every member of this segment (`seg_…`), however many. Also needs `segments:read`. |

## Response fields (202)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `id` | string | yes | — |
| `kind` | string | yes | — |
| `status` | enum | yes | One of: `QUEUED`, `RUNNING`, `COMPLETED`, `FAILED`, `CANCELED`. |
| `total` | integer \| null | yes | — |
| `processed` | integer | yes | — |
| `failed` | integer | yes | — |
| `error` | string \| null | yes | — |
| `created_at` | string | yes | — |
| `completed_at` | string \| null | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 202 | The job (`Location` names it). |
| 400 | The body isn't JSON, or the `Idempotency-Key` header is not 1–256 characters. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope (`segment_id` also needs `segments:read`). |
| 404 | No field has that `key`, or a listed contact or the segment isn't in this workspace (`details` names it). |
| 409 | Idempotency conflict, or `job_in_progress`: the field already has a bulk operation running, or five bulk contact edits are running in this workspace (follow them with `GET /jobs`). |
| 422 | A value the field's type refuses, `only_empty` with `null`, not exactly one of `contact_ids`, `emails` and `segment_id`, more than 1,000 listed, or an unknown key. |
| 429 | Too many bulk contact edits this minute (`Retry-After`); nothing started. |
| 502 | `engine_unavailable`: the job couldn't be started; nothing was changed. Retry. |

## Example request

```bash
curl -X POST 'https://www.unitpost.com/api/v1/contacts/set-field' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{ }'
```

## Example response (202)

```json
{
  "object": "job",
  "id": "id_123",
  "kind": "string",
  "status": "QUEUED",
  "total": 1,
  "processed": 0,
  "failed": 0,
  "error": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "completed_at": "2026-01-01T00:00:00.000Z"
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/platform/post-contacts-set-field
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
