Guides / n8n × Pipedrive / Authentication

Pipedrive API token vs OAuth: which one a private integration needs

An API token is one user's identity with that user's visibility. OAuth is an installable app with scopes and refresh. The concrete request differences, and the permission trap that makes a token look like it is losing data.

Illustrated troubleshooting diagram for Pipedrive API token vs OAuth: which one to use for a private integration.
401 Unauthorized on requests still using ?api_token= in the query string, or a workflow that reads fewer records than expected because the token's owner cannot see them.
Short answer: For an internal integration against your own Pipedrive company, a personal API token sent in the x-api-token header is correct and far simpler — but it inherits the visibility and permissions of the user who owns it, and it dies when that user is deactivated, so issue it from a dedicated service user rather than from a salesperson's account. For an app other companies install, OAuth is mandatory: scoped access, per-company tokens, refresh handling. The api_token query parameter is legacy and should not appear in new code.

An API token is a user, not an application

This is the fact that determines everything else. A Pipedrive personal API token authenticates as the user it belongs to and carries that user's permission set and visibility rules. Every call made with it sees exactly what that person sees when they log in — no more.

The failure this produces is not an error. A sync that reads deals with a token belonging to a sales rep whose visibility is limited to their own pipeline returns a smaller result set than expected and reports complete success. Records are not missing from Pipedrive; they were never visible to the identity doing the reading. Debugging this by examining the workflow finds nothing, because the workflow is behaving correctly.

The second consequence is lifecycle. When that user leaves and their account is deactivated, the token stops working and every integration built on it fails at once. A dedicated service user with an explicit owner, documented visibility settings and no human attached avoids both problems for the cost of one seat.

How each one authenticates a request

The token goes in a header. The older form put it in the query string as api_token, which leaked the credential into proxy logs, browser history and any error report echoing the failing URL; that form belongs to the sunset v1 API and should not appear in new code. OAuth sends a standard bearer token obtained through the usual authorization-code exchange, against a per-company base URL returned during that exchange.

# Personal API token — current form
curl https://COMPANY.pipedrive.com/api/v2/deals?limit=1 \
  -H "x-api-token: YOUR_TOKEN"

# Legacy, do not use in new code
curl "https://COMPANY.pipedrive.com/v1/deals?api_token=YOUR_TOKEN&limit=1"

# OAuth — bearer token, per installing company
curl https://api.pipedrive.com/api/v2/deals?limit=1 \
  -H "Authorization: Bearer ACCESS_TOKEN"

# Confirm which identity a token actually is, before debugging anything else:
curl https://COMPANY.pipedrive.com/api/v1/users/me -H "x-api-token: YOUR_TOKEN"
# -> { "data": { "id": 12345678, "name": "Integration Service",
#                "email": "ops+pipedrive@example.com",
#                "company_id": 7654321, "active_flag": true } }

Choosing between them

One company that you control means a token. Many companies that install your software means OAuth, and there is no way around it — there is no mechanism for a customer to hand you a token safely, and asking them to is asking for a credential that grants everything their user account can do with no scoping and no revocation short of deactivating the person.

The middle case — an internal integration you expect to productise later — is worth deciding deliberately. Token-based code is a handful of lines; OAuth is an authorization endpoint, a callback, per-company token storage and a refresh loop. Building OAuth up front is real work, and retrofitting it means rewriting the credential layer, the storage model and every assumption about a single base URL.

Personal API token vs OAuth app

Personal API tokenOAuth app
ServesOne company, yoursAny company that installs it
IdentityA specific user, with their visibilityThe app, within granted scopes
Sent asx-api-token headerAuthorization: Bearer
LifetimeUntil rotated or the user is deactivatedShort-lived access token + refresh token
ScopingNone — whatever that user can doExplicit scopes, revocable per company
Refresh flowNot neededMandatory
Base URLThe company's own domainPer-company, returned at install

Operating a token safely

Issue it from a dedicated user whose visibility settings are set deliberately rather than inherited from whoever happened to create it. Record the owner, the user it authenticates as, the systems that hold it and the rotation date, so a rotation is an operation rather than an archaeology exercise. Keep it server-side and out of URLs.

When rotating, regenerating the token immediately invalidates the old one — there is no overlap window the way there is with a second private app elsewhere. Schedule the switch, update every consumer in the same window, and restart long-lived workers that cached the value in an environment variable. The scheduled export nobody remembers is, as always, the last consumer to be found.

If a Pipedrive read returns fewer records than the UI shows, check the token's user and their visibility before touching the query. The API is not filtering — the identity behind the token simply cannot see the rest.

Visibility, in practice

The permission inheritance is worth making concrete, because it does not announce itself. Pipedrive's visibility groups control which records a user can see, and an API token sees exactly that set. A workflow reading deals with a token owned by a rep whose visibility is limited to their own items returns only those items, returns success, and gives no indication that a larger set exists.

The symptom is a count that does not match the UI — and specifically, does not match the UI as an administrator sees it. Comparing against what the token's own user sees when logged in will match perfectly and confirm nothing, which is how this survives a round of debugging.

Set the service user's visibility deliberately rather than inheriting whatever the creating admin had. Write down what it is, because six months later the difference between an integration that reads everything and one that reads most things is invisible from the code and expensive to rediscover.

Sync direction matters here too. Writes made by a token are attributed to its user, so deals created by the integration are owned by the service user unless the payload sets an owner explicitly. Reporting that groups by owner then shows a large bucket belonging to an account nobody recognises.

Rotating, revoking and knowing which credential failed

Regenerating a personal API token invalidates the previous value immediately, so there is no overlap window to cut over inside. Where a gap is unacceptable, the workaround is a second service user with its own token: move consumers across one at a time, then retire the first user's token. Where a brief gap is fine, schedule it, update every consumer in the same window, and restart workers that cached the value at start-up.

Log a credential alias rather than the token. A string such as pipedrive-prod-2026-09 identifies which credential a failing request used without putting any part of the secret into a log aggregator, and it makes the next rotation traceable in a way a masked value never is.

Keep the inventory honest about consumers. The integration everyone remembers gets updated; the quarterly export script and the dashboard someone built two years ago do not, and they are what fail silently a week after a rotation that appeared to go cleanly.

Where these facts come from