Skip to main content

Pipedrive Destination

Create or update Pipedrive persons from warehouse rows. Pipedrive has no native upsert, so drt searches for an existing person first and then updates it or creates a new one.

Installation​

No extra package is needed:

pip install drt-core

YAML Example​

destination:
type: pipedrive
api_token_env: PIPEDRIVE_API_TOKEN
object: person
match_field: email
sync:
mode: full
match_policy: upsert
field_mappings:
customer_tier: 9d5bd2d0f3a3c5ee1b2c3d4e5f60718293a4b5c6 # Pipedrive custom-field key

Set PIPEDRIVE_API_TOKEN to your Pipedrive API token. In this example the model query returns the columns name, email and customer_tier.

Configuration​

FieldTypeDefaultDescription
type"pipedrive"—Required
api_tokenstring | nullnullAPI token. Prefer api_token_env so no secret sits in YAML
api_token_envstring | nullPIPEDRIVE_API_TOKENName of the environment variable that holds the API token
base_urlstring | nullhttps://api.pipedrive.com/api/v2Override the API base URL. Must use https (plain http is accepted only for localhost)
object"person"personPipedrive object to write. Only person is supported for now
match_fieldstringemailColumn used to find an existing person: email, name or phone. A list or {value, primary} object is reduced to one trimmed value (the primary entry, else the first)
retryobject | nullnullRetry settings; overrides sync.retry as a whole when set
rate_limitobject | nullnullRequest pacing; overrides sync.rate_limit as a whole when set

At least one of api_token and api_token_env is required.

Authentication​

The token is sent in the x-api-token request header and never in the URL, so it cannot end up in request logs. A Pipedrive API token belongs to one user in one company, and requests can do whatever that user is allowed to do. OAuth is not supported. base_url must use https; plain http is accepted only for localhost (for tests), so the token is never sent unencrypted to another host.

How matching works​

For every row, drt reads the value of the match_field column and searches Pipedrive for an exact match (GET /persons/search with exact_match=true; Pipedrive's exact match is not case sensitive):

Search resultmatch_policy: upsert (default)update_onlycreate_only
No person foundCreate a new person (POST)Skip the rowCreate a new person (POST)
One person foundUpdate that person (PATCH)Update that person (PATCH)Skip the row
Several foundRow error, nothing is writtenRow error, nothing is writtenRow error, nothing is written

drt never guesses which of several matching people to update. Skipped rows are counted as skipped, and the ones skipped because of the policy are also counted in skipped_no_match. A row with an empty match_field value is a row error, and so is a search response that drt cannot read: it does not write in that case, because it could create a duplicate.

If the match_field column holds structured data (for example a list of emails, or {"value": ..., "primary": true} objects), drt reduces it to one trimmed value, the primary entry or else the first, and uses that same value for the search, the memory described below and the create. An empty result is a row error.

Match values are remembered for the whole sync (case-insensitively). A later row with the same key, even in a later batch, updates the person that was found or created earlier instead of searching again or creating a duplicate; this also covers Pipedrive's search index not yet showing a person created moments ago. If Pipedrive ever answers a create without returning the new person's id, a later row with the same key becomes a row error rather than risking a duplicate. The memory holds one small entry per distinct match value in the run and is cleared when the run ends.

Mapping columns to Pipedrive fields​

sync.field_mappings renames columns, and the rename runs before the destination sees the rows. After that, drt maps each column like this:

ColumnBecomes
namename (required when a person is created)
owner_id, org_id, visible_to, label_idsThe Pipedrive field of the same name
email / emailsemails: [{value, primary}], only when a person is created. Accepts one value, a list of values, or Pipedrive objects. The first entry is marked primary if none is
phone / phonesphones: [{value, primary}], only when a person is created, same rules
any other columncustom_fields[<column name>]

Custom fields: Pipedrive stores custom fields under randomly generated 40-character keys. drt does not look these up for you, so field_mappings must rename every custom-field column to Pipedrive's key (see the example above; the keys are listed by Pipedrive's Person fields API). An unknown key is not dropped: it is sent as is, Pipedrive rejects it, and the API's message becomes a row error for that record.

A NULL in a custom-field column is sent as null, which Pipedrive treats as "clear this field". Filter or COALESCE such values in your model if you do not want existing values cleared.

When a person is updated, email, emails, phone and phones columns are never sent: Pipedrive replaces whole contact lists, so sending them would wipe the person's other addresses and numbers. These columns set the contact lists only when a person is created. The match_field column is also left out of an update, because it already matches. An update with nothing else to change is counted as skipped.

Sync modes​

full, incremental and upsert all run the search-then-write path above for each row. replace and mirror are rejected by the engine before anything is extracted, because Pipedrive cannot do those operations. sync.write_policy: fill_empty is not supported either and is rejected the same way. Pipedrive cannot be read back by drt, so drt plan reports "plan unavailable" for this destination.

Errors and retries​

  • Each failed row becomes a row error with the HTTP status and the first 500 characters of Pipedrive's response. With sync.on_error: fail (the default), drt stops at the first failed row and the remaining rows are not attempted; with on_error: skip, drt records the row error and continues with the next row.
  • Transient errors (HTTP 429 and 5xx) are retried with exponential backoff by drt's shared retry layer; configure it with retry. A 429 caused by an exhausted daily budget keeps failing until the budget resets.
  • A missing token raises an error for the whole batch. An empty batch returns immediately without contacting Pipedrive.

Rate limits and per-row cost​

Pipedrive charges each API call against a daily token budget that depends on your plan and number of seats, and it also limits bursts per token. According to Pipedrive's Persons API reference, a person search costs 20 tokens and a create or update costs 5, so each row costs about 25 tokens (1,000 rows are roughly 25,000 tokens). Rows skipped by match_policy still cost the 20-token search, and a repeated key within a batch costs only one search.

Use rate_limit.requests_per_second (on the destination or in sync) to stay below your plan's burst limit:

destination:
type: pipedrive
api_token_env: PIPEDRIVE_API_TOKEN
rate_limit:
requests_per_second: 5

References​