Guides / n8n × Pipedrive / Field mapping

Pipedrive dropdown and multi-select fields: the option ID is not the label

A correct field key is only half of an option field. Each dropdown choice has its own numeric ID, and the visible text is never accepted. Where to find the IDs, and how multi-select differs from single-select.

Illustrated troubleshooting diagram for Pipedrive custom dropdown and multi-select fields: why the option ID does not match the UI.
400 Bad Request on a custom field whose key is demonstrably correct, or a 200 response where the dropdown ends up empty after sending the option's visible text.
Short answer: A Pipedrive dropdown (enum) or multi-select (set) field has two levels of identifier: the field's 40-character hash key, and a numeric ID for each option inside it. The API accepts only the numeric option ID as the value — the label shown in the UI is display text and is never valid. Read the options array from the relevant fields endpoint, build a label-to-ID map once, and send the ID; for multi-select, send a comma-separated list of IDs.

Two identifiers, and people usually find only the first

Getting a custom field to work in Pipedrive is a two-step discovery, and most integrations stop after step one. Step one is the field key: a 40-character hash that the API requires in place of the field's display name. Step two applies only to option fields, and it is that each individual choice inside the dropdown also has its own numeric ID, allocated when the option was created.

So a payload can carry a perfectly correct field key and still fail, because the value is "Gold" where the API wanted 47. This is why the error changes character partway through debugging: the invalid-field complaint disappears once the key is right, and is replaced by a value-level rejection or, worse, an accepted write that stores nothing.

Option IDs are per-field and per-company. The ID for "Gold" in one company's Customer Tier field has no relationship to the ID for "Gold" in another company's, or even in a second field in the same company. They cannot be copied between accounts or hardcoded from an example.

Where the option IDs come from

The same fields endpoint that returns the hash key also returns the full options array for option fields, each entry carrying its id and its label. One call answers both questions for every field on the object at once, which is the argument for fetching it once at the top of the workflow rather than hunting fields individually.

GET https://COMPANY.pipedrive.com/api/v2/dealFields
x-api-token: YOUR_TOKEN

# -> data: [
#   { "key": "a1b2c3d4e5f6...",
#     "name": "Customer tier",
#     "field_type": "enum",              <- single-select dropdown
#     "options": [ { "id": 46, "label": "Silver" },
#                  { "id": 47, "label": "Gold" } ] },
#   { "key": "9f8e7d6c5b4a...",
#     "name": "Product interest",
#     "field_type": "set",               <- multi-select
#     "options": [ { "id": 12, "label": "Hardware" },
#                  { "id": 13, "label": "Support" } ] }
# ]
#
# personFields / organizationFields for the other objects.

enum takes one ID; set takes a comma-separated list

The field_type distinguishes them and determines the value shape. A single-select field reports field_type enum and takes exactly one numeric ID. A multi-select reports set and takes several IDs as a comma-separated string.

On v2 endpoints both go inside the custom_fields object rather than at the top level of the record, which is a second thing to get right at the same time. And because a PATCH merges, sending a set field replaces that field's whole selection — to add one option to an existing selection you must send every ID you want to keep, not just the new one.

PATCH https://COMPANY.pipedrive.com/api/v2/deals/901
x-api-token: YOUR_TOKEN
Content-Type: application/json

{
  "custom_fields": {
    "a1b2c3d4e5f6...": 47,           // enum  -> one numeric option ID
    "9f8e7d6c5b4a...": "12,13"       // set   -> comma-separated IDs
  }
}

# Rejected or silently empty:
#   "a1b2c3d4e5f6...": "Gold"        <- the label, never accepted
#   "9f8e7d6c5b4a...": [12, 13]      <- a JSON array, not the expected form
#
# set replaces the whole selection. To add 13 to an existing {12},
# send "12,13" — sending "13" alone removes 12.

Map labels to IDs once, and fail loudly on a miss

Build a label-to-ID map for each option field at the start of the run and reuse it. Hardcoding numeric IDs across node parameters produces a workflow nobody can review — 47 means nothing to a reader — and one that breaks silently if an admin deletes and recreates an option, since the replacement gets a new ID.

Route an unmapped source value to an error branch rather than sending it. An unmapped value that reaches Pipedrive either fails the whole record or, on some shapes, is accepted and stored as nothing, and the second outcome is a data gap nobody notices for a month.

Read-back is the other half. Pipedrive returns option fields as IDs too, so anything downstream that expects a human-readable tier needs the same map inverted. Building it once and keeping both directions available costs one API call and removes a whole class of confusion at the reporting end.

// n8n Code node — run once after GET /api/v2/dealFields
const byName = Object.fromEntries($json.data.map((f) => [f.name, {
  key: f.key,
  type: f.field_type,
  toId:    Object.fromEntries((f.options || []).map((o) => [o.label, o.id])),
  toLabel: Object.fromEntries((f.options || []).map((o) => [o.id, o.label]))
}]));

const tier = byName["Customer tier"];
const id = tier.toId[$json.tier];
if (id === undefined) {
  return [{ json: { error: "unmapped option", field: "Customer tier", raw: $json.tier } }];
}
return [{ json: { custom_fields: { [tier.key]: id } } }];

Options change, and the workflow should notice

Dropdown options are admin-editable, which means the mapping a workflow depends on has a maintainer who does not know the workflow exists. An option renamed in the UI keeps its ID and breaks nothing; an option deleted and recreated gets a new ID and breaks a hardcoded mapping silently; a new option added is simply never used by an integration that maps a fixed list.

Resolving the map from the fields endpoint at the start of each run handles the first two automatically. The third needs a deliberate check: compare the option labels returned against the set the mapping knows about, and log or alert when an option exists in Pipedrive that the workflow has no rule for. That converts a silent gap into a message on the day it appears.

Decide what an unmapped source value should do, and make it explicit. Failing the row is right when the field drives downstream logic. Writing a documented fallback option is right when it does not. Sending nothing at all is almost never right, because it produces a record that looks complete and is missing the field that someone will later report on.

Where these facts come from