Guides / n8n × Pipedrive / Field mapping

How to find a Pipedrive custom field's real API key

Pipedrive generates a 40-character hash when a custom field is created and that hash is the only key the API accepts. Both ways to find it, and why the UI label is never a substitute.

Illustrated troubleshooting diagram for How to find a Pipedrive custom field's real API key.
400 Bad Request — "Invalid field(s) in the payload: Website, LinkedIn" naming custom fields that plainly exist in the Pipedrive UI.
Short answer: Pipedrive allocates a 40-character hash key the moment a custom field is created, and that hash is the only identifier the API accepts for reading or writing the field. The display label you see in the UI is never valid in a payload. Find the hash from Company Settings → Data Fields → the field's menu → Copy API key, or by calling the object's fields endpoint and matching on the name property. Resolve keys at runtime rather than hardcoding them, because a deleted and recreated field gets a new hash and an unknown key is ignored rather than rejected.

Why the visible name is never accepted

Standard Pipedrive fields have predictable API keys — title, value, person_id — that match what you would expect. Custom fields do not. When a custom field is created, Pipedrive generates a unique 40-character hash unrelated to whatever the field is called, and that hash is the key the API uses forever after.

The Pipedrive web interface never shows this hash in normal use, so the entire human experience of the field is its label. No client, connector or node can translate "Website" into the correct key on your behalf, because nothing in the payload carries the mapping — you have to supply it.

One useful consequence: renaming a field in the UI does not change its hash. An integration that uses the correct key keeps working through any number of label changes, which is precisely the opposite of one built on labels.

The field being present and correctly named in Pipedrive's UI proves nothing about what key the API expects. Look up the hash before building the payload.

From the interface, for a one-off

In the Pipedrive web app, open Company Settings (Tools and Apps on some plans) → Data Fields, choose the tab for the object the field belongs to — Deal fields, Person fields, Organization fields — find the field in the list, open its three-dot menu and choose Copy API key. That places the exact hash on the clipboard, ready to paste.

This is the fastest route for a single field and the wrong one for a workflow that touches a dozen, because it produces a handful of opaque strings pasted into node parameters with nothing recording which is which.

From the API, for anything you will maintain

One call to the object's fields endpoint returns every field with its key, its name, its field_type and — for option fields — the full options array. That single response is enough to build the whole mapping for the object, including the value shapes each field expects.

The field_type is worth keeping alongside the key, because a correct key with a wrong value shape produces a different error that is easy to misdiagnose as a key problem. Date fields take YYYY-MM-DD, monetary fields need the amount plus a sibling currency key, and option fields take numeric option IDs rather than labels.

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

# -> data: [
#   { "key": "a1b2c3d4e5f6789012345678901234567890abcd",   <- the payload key
#     "name": "Website",                                    <- display label only
#     "field_type": "varchar" },
#   { "key": "9f8e7d6c5b4a...", "name": "Renewal date",
#     "field_type": "date" }
# ]

# personFields and organizationFields for the other objects.
# The hash is per company: never copy one between accounts.

Resolve at runtime and fail loudly

Hardcoding forty-character hashes across node parameters causes three problems at once. The value is unreadable, so nobody can review the workflow. It cannot be traced back to a field when something breaks. And if the field is ever deleted and recreated it gets a new hash, at which point the workflow keeps running and writes nothing — Pipedrive ignores an unknown key rather than rejecting it, so the request succeeds and the data goes nowhere.

One lookup at the start of the execution, cached for its duration, removes all three. Key the map on the human name so the rest of the workflow reads like the business, and throw when an expected field name is absent so the failure names the missing field instead of producing a hash nobody can trace.

Fetch the definitions once per execution, not once per item. Pipedrive meters usage against a daily token budget, and a metadata call inside a loop over a few thousand records is one of the easiest ways to spend that budget on work that produces nothing.

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

const required = ["Website", "Customer tier", "Renewal date"];
const missing = required.filter((n) => !byName[n]);
if (missing.length) throw new Error("Pipedrive fields missing: " + missing.join(", "));

return [{ json: { custom_fields: {
  [byName["Website"].key]:       $json.site,
  [byName["Customer tier"].key]: byName["Customer tier"].options[$json.tier],
  [byName["Renewal date"].key]:  $json.renewal          // YYYY-MM-DD
} } }];

The key is right and the value is still wrong

A correct key only gets the value to the right place; each field type then expects a specific shape, and a type error reads nothing like a key error. Date fields take an ISO date as YYYY-MM-DD and time fields take HH:MM:SS. Monetary fields need the numeric amount plus a sibling key — the same hash with a _currency suffix — carrying the three-letter currency code, or the amount is stored with no currency and displays oddly.

Single-option and multi-option fields take the numeric option ID rather than the visible label, with multi-option taking a comma-separated string of IDs. Relation fields for people, organizations and users expect the related record's numeric ID. Address fields accept a plain string, but only the Pipedrive UI geocodes an address into structured components — an API write stores the raw text as given.

The practical rule: if a value is rejected with a type complaint rather than an invalid-field complaint, the key is correct and the shape is not. Read field_type from the same fields response that gave you the key, and format accordingly rather than guessing from what the field looks like in the interface.

  • Date: YYYY-MM-DD. Time: HH:MM:SS.
  • Monetary: the amount, plus {hash}_currency set to the ISO currency code.
  • Single/multi-option: numeric option IDs, comma-separated for multi.
  • Person, organization and user relations: the related record's numeric ID.
  • Address: stored as the raw string; no geocoding happens on an API write.

Where these facts come from