Integrations
How-to

Connect Pipedrive

Connect Pipedrive to an Agent with a personal API token for CRM records, activities, notes, and synced email history.

For
Pipedrive administrators, Agent operators, and Organization administrators
On this page
  1. What you will configure
  2. Supported operations
  3. Before you begin
  4. Understand the access boundary
  5. 1. Prepare the Pipedrive user
  6. 2. Find the API token
  7. 3. Find the company domain
  8. 4. Connect Pipedrive
  9. 5. Assign the Pipedrive Skill
  10. 6. Validate the connection
  11. 7. Verify Agent access
  12. Control write operations
  13. Access synced email history
  14. Runtime behavior
  15. Use a Shared Credential
  16. Rotate or remove the credential
  17. API reference
  18. Rate limits
  19. Troubleshooting
  20. Security practices
  21. Next steps
  • Integrations
  • 10–15 minutes
  • Requires a Pipedrive personal API token

Connect Pipedrive to let an Agent work with CRM leads, people, organizations, deals, activities, notes, labels, and synced email history.

Agent Barn encrypts the personal API token, and exposes supported operations through the built-in Pipedrive Skill and aai-cli.

What you will configure

  1. Pipedrive company
  2. Dedicated user
  3. Personal API token
  4. Encrypted Agent Secret
  5. pipedrive-work profile
Complete setup path
Pipedrive company


Dedicated Pipedrive user

        ├── Permission set
        ├── Data visibility
        └── Personal API token


       Encrypted Agent Secret


        Built-in Pipedrive Skill


         pipedrive-work profile


          aai-cli pipedrive

At the end of this guide, the Agent will have:

  • An encrypted pipedrive credential
  • The built-in Pipedrive Skill
  • A generated pipedrive-work profile
  • Access to CRM data visible to the token-owning Pipedrive user
  • Read and write commands for supported Pipedrive resources

Supported operations

The current Pipedrive Skill exposes these operations.

Resource Read operations Write operations
LeadsList, search, getCreate, update, delete, convert to deal
PersonsList, search, get, combined view, activities, notes, mail historyCreate, update, delete
OrganizationsList, search, get, combined view, activities, notes, mail historyCreate, update, delete
DealsList, search, get, combined view, activities, notes, mail historyCreate, update, delete
Lead labelsListCreate, update, delete
Person labelsListNone
Organization labelsListNone
Deal labelsListNone
ActivitiesList, getNone
NotesList, getNone
MailboxRead messages and threadsNone

The Skill does not expose every endpoint in the Pipedrive API. It provides the command surface documented above, and the token may allow more Pipedrive API operations than the Skill exposes.

Before you begin

You need:

  • An Agent Barn Organization
  • An existing Agent, or permission to hire one
  • Permission to update the Agent and manage its Secrets
  • A Pipedrive company account
  • A Pipedrive user with access to the intended CRM data
  • Permission to use the Pipedrive API
  • A personal API token for that user and company
  • Optional access to a Pipedrive sandbox for testing write operations

For production use, create a dedicated Pipedrive integration user where your plan and account structure allow it.

Official references:

Understand the access boundary

A personal API token is tied to:

Token binding
One Pipedrive user
        +
One Pipedrive company

A user has a different token for each company they belong to. The effective Agent boundary is the combination of these layers:

  1. Pipedrive user permissions Permission set, item visibility, and company membership
  2. Personal API token Inherits the user’s permissions — it has no scopes of its own
  3. Agent Barn Agent access Who may operate or configure the Agent
  4. Pipedrive Skill Which Pipedrive commands are documented to the Agent
  5. Agent instructions When the Agent should use read or write commands
Layer What it controls
Pipedrive user permissionsWhat the API token can read or change
Pipedrive visibilityWhich CRM records the user can see
Agent Barn Agent AccessWhich people can operate or configure the Agent
Pipedrive SkillWhich Pipedrive commands are documented to the Agent
Agent instructionsWhen the Agent should use read or write commands

Prepare the Pipedrive user

Before copying a token:

  1. Decide whether the Agent should use an existing user, or a dedicated integration user.
  2. Place the user in the narrowest practical Pipedrive permission set.
  3. Limit the user’s data visibility to the records required by the Agent.
  4. Confirm whether the user may create, update, convert, or delete CRM records.
  5. Enable Use API for the user’s permission set.
  6. Sign in as that user and confirm the intended CRM records are visible.

If the Agent only needs reporting or research access, remove unnecessary create, update, and delete permissions from the Pipedrive user where the account’s permission model allows it.

Find the API token

  1. Sign in to Pipedrive as the intended integration user.
  2. Open the account menu.
  3. Open Company settings.
  4. Select Personal preferences.
  5. Select API.
  6. Copy the personal API token.

The token is unique to that user and company.

If the API page is missing, ask a Pipedrive administrator to enable Use API for the user’s permission set under Manage users.

Do not copy the token into source control, documentation, issues or support tickets, chat messages, Agent prompts, shell history, or screenshots.

Find the company domain

The company domain is optional in Agent Barn. For this Pipedrive URL:

Company URL
https://acme.pipedrive.com

the company domain is acme. Enter only the bare subdomain.

Correct

Accepted
acme

Incorrect

Not accepted
https://acme.pipedrive.com
acme.pipedrive.com
https://acme.pipedrive.com/api

You can also find the company domain through Pipedrive’s /users/me response.

When to leave the domain empty

Leave Company domain empty to use https://api.pipedrive.com. The personal token identifies its user and company, so the global endpoint works for ordinary Pipedrive Cloud accounts.

When to provide the domain

Provide the bare company subdomain when:

  • Your Pipedrive administrator requires tenant-specific routing
  • You are diagnosing a global-endpoint problem
  • Your deployment has been tested against the company-specific hostname

Supplying acme produces https://acme.pipedrive.com.

Connect Pipedrive

  1. In Agent Barn, open Agents.
  2. Select the Agent that needs CRM access.
  3. Open the Agent’s Configuration.
  4. Select Keys & integrations.
  5. Select Edit.
  6. Under Integration credentials, add Pipedrive.
  7. Select Manual credential.
  8. Complete the Pipedrive fields.
  9. Apply the configuration.
Agent Barn field Required Value
API tokenYesThe user’s personal Pipedrive API token
Company domainNoA bare company subdomain such as acme

Global endpoint

Completed fields
API token
••••••••••••••••

Company domain
Leave empty

Tenant endpoint

Completed fields
API token
••••••••••••••••

Company domain
acme

The API token is encrypted and write-only. Agent Barn displays credential metadata after saving, but does not return the original token.

If the Agent is running, use the website’s restart-aware apply flow. The new credential becomes available after restart.

Assign the Pipedrive Skill

The credential supplies authentication. The Skill supplies the supported commands and operating instructions.

  1. Open the Agent’s Skills configuration.
  2. Select Edit.
  3. Add the built-in Pipedrive Skill.
  4. Apply the change.
  5. Restart the Agent if prompted.

The Skill is mounted at:

Mounted Skill
./skills/aai-cli/pipedrive_skill.md

The supported command group is aai-cli pipedrive, and every command must include --profile pipedrive-work.

Agent Barn requires the pipedrive credential while the Pipedrive Skill is assigned.

Validate the connection

  1. Return to Keys & integrations.
  2. Find the configured Pipedrive credential.
  3. Select Validate.
  4. Review the status and identity.

Agent Barn validates the token by requesting the current Pipedrive user from GET /v1/users/me, sending the token through the x-api-token header.

Valid

Pipedrive accepted the token, and the current-user endpoint returned the user’s email or name as the identity.

Warning

Reserved for providers whose validators report partial results. Personal API tokens have no scopes, so missing_scopes stays empty for Pipedrive.

Invalid

Pipedrive rejected the token, the endpoint was unreachable, or the current-user request failed.

A successful response resembles:

Response
{
  "validation_status": "valid",
  "validation_identity": "[email protected]",
  "validation_error": null,
  "missing_scopes": []
}

An invalid token resembles:

Response
{
  "validation_status": "invalid",
  "validation_identity": null,
  "validation_error": "Invalid API token",
  "missing_scopes": []
}

Validation confirms that Agent Barn can reach the selected Pipedrive endpoint, that Pipedrive accepts the token, and that the current-user endpoint returns an identity.

Validation does not confirm that the user can see every intended record, that every write operation is permitted, that email synchronization is configured, that the Agent’s operating instructions are safe, or that the company has sufficient API budget for the workflow.

Verify Agent access

Begin with read-only commands.

List open deals:

Shell
aai-cli pipedrive deals list \
  --status open \
  --limit 5 \
  --profile pipedrive-work

Search for a person:

Shell
aai-cli pipedrive persons search \
  --term "Ada" \
  --limit 5 \
  --profile pipedrive-work

List recent leads:

Shell
aai-cli pipedrive leads list \
  --limit 5 \
  --profile pipedrive-work

List incomplete activities:

Shell
aai-cli pipedrive activities list \
  --done false \
  --limit 5 \
  --profile pipedrive-work

Read a combined deal view:

Shell
aai-cli pipedrive deals view 123 \
  --limit 10 \
  --include-labels \
  --profile pipedrive-work

Successful responses use Pipedrive’s response envelope:

Response
{
  "success": true,
  "data": []
}

List responses can also include pagination:

Response
{
  "success": true,
  "data": [],
  "additional_data": {
    "pagination": {
      "start": 0,
      "limit": 5,
      "more_items_in_collection": false
    }
  }
}

Control write operations

The Pipedrive Skill includes write commands. Examples include:

Write commands
leads create
leads update
leads delete
leads convert

persons create
persons update
persons delete

organizations create
organizations update
organizations delete

deals create
deals update
deals delete

Lead labels also support create, update, and delete.

Before allowing an Agent to write:

  1. Define which record types it may change.
  2. Define whether it may create records.
  3. Define whether it may convert leads.
  4. Define whether it may delete records.
  5. Restrict the Pipedrive user’s permissions where possible.
  6. Add explicit Agent instructions.
  7. Require human confirmation for consequential changes.
  8. Test in a sandbox.

A safe Agent instruction can state:

Agent instruction
Use Pipedrive read operations without confirmation.

Before creating or updating a CRM record, summarize the intended change and
request confirmation.

Never delete a lead, person, organization, deal, or label.
Never convert a lead unless the user explicitly requests that exact conversion.

Optional sandbox write test

In a Pipedrive sandbox, create a clearly labeled test lead:

Shell
aai-cli pipedrive leads create \
  --title "Agent Barn integration test" \
  --profile pipedrive-work

Inspect the returned lead ID and confirm the record appears in the sandbox. Only remove it if deletion is explicitly authorized:

Shell
aai-cli pipedrive leads delete LEAD_ID \
  --profile pipedrive-work

Access synced email history

Mailbox commands require Pipedrive email synchronization or Smart BCC data. The token-owning user must have permission to view the relevant messages.

Supported commands include:

Shell
aai-cli pipedrive mailbox threads list \
  --folder inbox \
  --limit 10 \
  --profile pipedrive-work
Shell
aai-cli pipedrive mailbox threads get THREAD_ID \
  --profile pipedrive-work
Shell
aai-cli pipedrive mailbox threads messages THREAD_ID \
  --profile pipedrive-work
Shell
aai-cli pipedrive mailbox messages get MESSAGE_ID \
  --include-body \
  --profile pipedrive-work

Associated email history can also be added to combined views:

Shell
aai-cli pipedrive deals view DEAL_ID \
  --include-mail \
  --limit 10 \
  --profile pipedrive-work

The current Skill does not send email or modify mailbox threads.

Runtime behavior

When the Agent starts, Agent Barn:

  1. Decrypts the Pipedrive credential.
  2. Stores the token in the encrypted aai-cli secret store.
  3. Generates the pipedrive-work profile.
  4. Mounts the Pipedrive Skill.
  5. Adds Pipedrive to the Agent’s configured integration context.

Without a company domain

Generated profile
[profiles.pipedrive-work]
auth_type = "pipedrive_personal_token"
api_token_secret = "pipedrive.api_token"

With a company domain

Generated profile
[profiles.pipedrive-work]
auth_type = "pipedrive_personal_token"
base_url = "https://acme.pipedrive.com"
api_token_secret = "pipedrive.api_token"

The token itself is not written into the profile. The profile references pipedrive.api_token.

The complete runtime path is:

Runtime path
Encrypted Pipedrive token


      Agent start

           ├── Encrypted aai-cli secret
           ├── pipedrive-work profile
           └── Pipedrive Skill


              aai-cli pipedrive


                 Pipedrive API

Credential changes take effect after the Agent restarts.

Use a Shared Credential

Pipedrive supports Organization-owned Shared Credentials. Use one when:

  • Multiple Agents should act as the same Pipedrive user
  • An Organization administrator should own token rotation
  • Individual Agent operators should not handle the token
  • The same company and Pipedrive permission boundary applies to several Agents

Manual credential

Owned by the Agent. Each Agent stores its own encrypted token, and whoever configures the Agent handles the value.

Rotation is per Agent.

Shared Credential

Owned by the Organization. Attached Agents reference it, and administrators rotate it centrally.

Every attached Agent receives the same provider identity.

To attach one:

  1. Create or locate the Pipedrive Shared Credential in the Organization.
  2. Open the Agent’s Keys & integrations configuration.
  3. Add Pipedrive.
  4. Switch from Manual credential to Shared Credential.
  5. Select the intended credential.
  6. Apply the change.
  7. Restart the Agent if prompted.
  8. Validate and run a read-only command.

An Agent can use either a manual Pipedrive credential or a Shared Pipedrive Credential, not both simultaneously.

Use separate Shared Credentials when Agents require different Pipedrive users, companies, visibility, or operational risk boundaries. Continue to Use shared credentials for the complete ownership model.

Rotate or remove the credential

Rotate the personal API token

Pipedrive allows one active personal API token per user and company. Before rotation:

  1. Inventory every integration using the current token.
  2. Schedule a short migration window.
  3. Open the user’s Personal preferences → API page.
  4. Generate a new token.
  5. Immediately replace the token in Agent Barn.
  6. Restart affected Agents.
  7. Validate the credential.
  8. Run a read-only CRM command.
  9. Update any other authorized integrations that shared the old token.

Generating the new token invalidates the old one.

Rotate a Shared Credential

Update the Organization-owned Shared Credential, validate it, and restart every attached Agent that must receive the regenerated runtime Secret.

Remove the credential

Before removal:

  1. Remove or replace any assigned Skill that requires Pipedrive.
  2. Stop the Agent, or use the website’s restart-aware apply flow.
  3. Open Keys & integrations.
  4. Mark the Pipedrive credential for removal.
  5. Apply the change.
  6. Restart and verify the Agent.

Agent Barn blocks removal while an assigned Skill still requires the pipedrive provider.

API reference

Add or replace a manual credential

The Agent must be stopped when using the raw update endpoint.

HTTP
PATCH /api/v1/organizations/{organization_id}/agents/{agent_id}
Content-Type: application/json

Using the global endpoint:

Request body
{
  "secrets": [
    {
      "provider": "pipedrive",
      "content": {
        "api_token": "REDACTED",
        "domain": ""
      }
    }
  ]
}

Using a company-specific endpoint:

Request body
{
  "secrets": [
    {
      "provider": "pipedrive",
      "content": {
        "api_token": "REDACTED",
        "domain": "acme"
      }
    }
  ]
}

Attach a Shared Credential

Request body
{
  "shared_credentials": [
    {
      "shared_credential_id": "00000000-0000-0000-0000-000000000000"
    }
  ]
}

Validate the credential

HTTP
POST /api/v1/organizations/{organization_id}/agents/{agent_id}/integrations/pipedrive/validate
Response
{
  "validation_status": "valid",
  "validation_identity": "[email protected]",
  "validation_error": null,
  "missing_scopes": []
}

Remove the credential

Request body
{
  "removed_secret_providers": [
    "pipedrive"
  ]
}

Credential operations require access to the Agent and the relevant update and secret-management permissions, including agent.secret.manage.

Rate limits

Pipedrive uses token-based API budgets and burst limits. Important characteristics include:

  • API calls consume different numbers of budget tokens
  • List and search operations can cost more than single-record reads
  • The daily budget is shared at the Pipedrive company level
  • Burst limits apply per API token
  • A depleted budget can produce HTTP 429
  • Continued high-volume traffic after rate-limit responses can result in temporary blocking

Reduce avoidable usage by:

  • Using narrow list limits
  • Applying server-side filters
  • Avoiding repeated full-record scans
  • Caching stable identifiers in an approved workflow
  • Stopping retries after a rate-limit error
  • Spacing scheduled Agent jobs
  • Monitoring the company’s API Usage Dashboard

Troubleshooting

The API page is missing in Pipedrive

Use API is not enabled

The user’s permission set may not allow API use. Ask a Pipedrive administrator to enable Use API under:

Pipedrive path
Manage users → Permission sets

Validation reports “Invalid API token”

Token replaced, disabled, or wrong type

Check that:

  • The token was copied completely
  • It belongs to the intended user and company
  • Another integration or administrator did not generate a replacement token
  • API access remains enabled for the user
  • You did not paste an OAuth access token

Copy the current token from the user’s Pipedrive API settings.

Validation succeeds but records are missing

Visibility, not authentication

Validation only checks the current user endpoint. Check the token-owning user’s:

  • Company membership
  • Permission set
  • Record visibility
  • Team or ownership restrictions
  • Access to archived or deleted records
  • Filters supplied to the command

The company-domain endpoint fails

Use the bare subdomain

Confirm that Company domain contains only the bare subdomain. For https://acme.pipedrive.com, enter acme.

If tenant-specific routing is unnecessary, clear the field to use https://api.pipedrive.com.

Read commands work but write commands fail

The user lacks the permission

The Pipedrive user may lack permission for the requested operation. Check:

  • The user’s permission set
  • Whether the record is visible and editable
  • Required Pipedrive fields
  • Pipeline or stage restrictions
  • Whether the record was already deleted or converted

Do not broaden the user’s permissions without reviewing the Agent’s intended responsibilities.

Mailbox commands return no data

Email sync or message permissions

Check that:

  • Email synchronization or Smart BCC is configured in Pipedrive
  • The token-owning user has permission to view the messages
  • The requested folder contains synced threads
  • The CRM record is associated with the expected email message
  • The account plan supports the required email feature

--include-mail fails

The record is visible; its mail is not

The base person, organization, or deal may be accessible while its associated email history is not.

Retry without --include-mail. Then review email synchronization and mailbox permissions separately.

Commands return HTTP 429

Budget or burst limit reached

Stop automatic retries, reduce request frequency, lower list limits, and review the Pipedrive API Usage Dashboard.

A token rotation broke another integration

One active token per user and company

Pipedrive permits one active personal API token per user and company. Generating a new token invalidates the previous one.

Update every authorized integration that used the old token, or move Agent Barn to a dedicated Pipedrive user.

The credential cannot be removed

A Skill still requires it

A remaining assigned Skill requires Pipedrive. Remove the Pipedrive Skill before removing the credential.

Updated credentials are not being used

Artifacts are produced at startup

Restart the Agent. Encrypted runtime Secrets, the pipedrive-work profile, mounted Skills, and generated tool context are created during startup.

Security practices

  • Use a dedicated Pipedrive integration user where possible
  • Restrict that user’s permission set
  • Restrict record visibility
  • Do not treat Agent instructions as the only write boundary
  • Require confirmation for consequential CRM writes
  • Prohibit deletion unless explicitly needed
  • Test write workflows in a sandbox
  • Use separate credentials for separate companies or authorization boundaries
  • Prefer Shared Credentials when administrators should own rotation
  • Do not reuse the token across unrelated integrations
  • Keep the token out of source control, logs, screenshots, and conversations
  • Validate after every credential change
  • Run a real read operation after validation
  • Monitor API usage and rate-limit errors
  • Review Agent activity and logs for unexpected CRM mutations

Next steps

Documentation