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
- Pipedrive company
- Dedicated user
- Personal API token
- Encrypted Agent Secret
- pipedrive-work profile
Pipedrive company
│
▼
Dedicated Pipedrive user
│
├── Permission set
├── Data visibility
└── Personal API token
│
▼
Encrypted Agent Secret
│
▼
Built-in Pipedrive Skill
│
▼
pipedrive-work profile
│
▼
aai-cli pipedriveAt the end of this guide, the Agent will have:
- An encrypted
pipedrivecredential - The built-in Pipedrive Skill
- A generated
pipedrive-workprofile - 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 |
|---|---|---|
| Leads | List, search, get | Create, update, delete, convert to deal |
| Persons | List, search, get, combined view, activities, notes, mail history | Create, update, delete |
| Organizations | List, search, get, combined view, activities, notes, mail history | Create, update, delete |
| Deals | List, search, get, combined view, activities, notes, mail history | Create, update, delete |
| Lead labels | List | Create, update, delete |
| Person labels | List | None |
| Organization labels | List | None |
| Deal labels | List | None |
| Activities | List, get | None |
| Notes | List, get | None |
| Mailbox | Read messages and threads | None |
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:
One Pipedrive user
+
One Pipedrive companyA user has a different token for each company they belong to. The effective Agent boundary is the combination of these layers:
- Pipedrive user permissions Permission set, item visibility, and company membership
- Personal API token Inherits the user’s permissions — it has no scopes of its own
- Agent Barn Agent access Who may operate or configure the Agent
- Pipedrive Skill Which Pipedrive commands are documented to the Agent
- Agent instructions When the Agent should use read or write commands
| Layer | What it controls |
|---|---|
| Pipedrive user permissions | What the API token can read or change |
| Pipedrive visibility | Which CRM records the user can see |
| Agent Barn Agent Access | Which people can operate or configure the Agent |
| Pipedrive Skill | Which Pipedrive commands are documented to the Agent |
| Agent instructions | When the Agent should use read or write commands |
Prepare the Pipedrive user
Before copying a token:
- Decide whether the Agent should use an existing user, or a dedicated integration user.
- Place the user in the narrowest practical Pipedrive permission set.
- Limit the user’s data visibility to the records required by the Agent.
- Confirm whether the user may create, update, convert, or delete CRM records.
- Enable Use API for the user’s permission set.
- 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
- Sign in to Pipedrive as the intended integration user.
- Open the account menu.
- Open Company settings.
- Select Personal preferences.
- Select API.
- 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:
https://acme.pipedrive.comthe company domain is acme. Enter only the bare subdomain.
Correct
acmeIncorrect
https://acme.pipedrive.com
acme.pipedrive.com
https://acme.pipedrive.com/apiYou 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
- In Agent Barn, open Agents.
- Select the Agent that needs CRM access.
- Open the Agent’s Configuration.
- Select Keys & integrations.
- Select Edit.
- Under Integration credentials, add Pipedrive.
- Select Manual credential.
- Complete the Pipedrive fields.
- Apply the configuration.
| Agent Barn field | Required | Value |
|---|---|---|
| API token | Yes | The user’s personal Pipedrive API token |
| Company domain | No | A bare company subdomain such as acme |
Global endpoint
API token
••••••••••••••••
Company domain
Leave emptyTenant endpoint
API token
••••••••••••••••
Company domain
acmeThe 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.
- Open the Agent’s Skills configuration.
- Select Edit.
- Add the built-in Pipedrive Skill.
- Apply the change.
- Restart the Agent if prompted.
The Skill is mounted at:
./skills/aai-cli/pipedrive_skill.mdThe 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
- Return to Keys & integrations.
- Find the configured Pipedrive credential.
- Select Validate.
- 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:
{
"validation_status": "valid",
"validation_identity": "[email protected]",
"validation_error": null,
"missing_scopes": []
}An invalid token resembles:
{
"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:
aai-cli pipedrive deals list \
--status open \
--limit 5 \
--profile pipedrive-workSearch for a person:
aai-cli pipedrive persons search \
--term "Ada" \
--limit 5 \
--profile pipedrive-workList recent leads:
aai-cli pipedrive leads list \
--limit 5 \
--profile pipedrive-workList incomplete activities:
aai-cli pipedrive activities list \
--done false \
--limit 5 \
--profile pipedrive-workRead a combined deal view:
aai-cli pipedrive deals view 123 \
--limit 10 \
--include-labels \
--profile pipedrive-workSuccessful responses use Pipedrive’s response envelope:
{
"success": true,
"data": []
}List responses can also include pagination:
{
"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:
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 deleteLead labels also support create, update, and delete.
Before allowing an Agent to write:
- Define which record types it may change.
- Define whether it may create records.
- Define whether it may convert leads.
- Define whether it may delete records.
- Restrict the Pipedrive user’s permissions where possible.
- Add explicit Agent instructions.
- Require human confirmation for consequential changes.
- Test in a sandbox.
A safe Agent instruction can state:
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:
aai-cli pipedrive leads create \
--title "Agent Barn integration test" \
--profile pipedrive-workInspect the returned lead ID and confirm the record appears in the sandbox. Only remove it if deletion is explicitly authorized:
aai-cli pipedrive leads delete LEAD_ID \
--profile pipedrive-workAccess 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:
aai-cli pipedrive mailbox threads list \
--folder inbox \
--limit 10 \
--profile pipedrive-workaai-cli pipedrive mailbox threads get THREAD_ID \
--profile pipedrive-workaai-cli pipedrive mailbox threads messages THREAD_ID \
--profile pipedrive-workaai-cli pipedrive mailbox messages get MESSAGE_ID \
--include-body \
--profile pipedrive-workAssociated email history can also be added to combined views:
aai-cli pipedrive deals view DEAL_ID \
--include-mail \
--limit 10 \
--profile pipedrive-workThe current Skill does not send email or modify mailbox threads.
Runtime behavior
When the Agent starts, Agent Barn:
- Decrypts the Pipedrive credential.
- Stores the token in the encrypted
aai-clisecret store. - Generates the
pipedrive-workprofile. - Mounts the Pipedrive Skill.
- Adds Pipedrive to the Agent’s configured integration context.
Without a company domain
[profiles.pipedrive-work]
auth_type = "pipedrive_personal_token"
api_token_secret = "pipedrive.api_token"With a company domain
[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:
Encrypted Pipedrive token
│
▼
Agent start
│
├── Encrypted aai-cli secret
├── pipedrive-work profile
└── Pipedrive Skill
│
▼
aai-cli pipedrive
│
▼
Pipedrive APICredential 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:
- Create or locate the Pipedrive Shared Credential in the Organization.
- Open the Agent’s Keys & integrations configuration.
- Add Pipedrive.
- Switch from Manual credential to Shared Credential.
- Select the intended credential.
- Apply the change.
- Restart the Agent if prompted.
- 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:
- Inventory every integration using the current token.
- Schedule a short migration window.
- Open the user’s Personal preferences → API page.
- Generate a new token.
- Immediately replace the token in Agent Barn.
- Restart affected Agents.
- Validate the credential.
- Run a read-only CRM command.
- 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:
- Remove or replace any assigned Skill that requires Pipedrive.
- Stop the Agent, or use the website’s restart-aware apply flow.
- Open Keys & integrations.
- Mark the Pipedrive credential for removal.
- Apply the change.
- 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.
PATCH /api/v1/organizations/{organization_id}/agents/{agent_id}
Content-Type: application/jsonUsing the global endpoint:
{
"secrets": [
{
"provider": "pipedrive",
"content": {
"api_token": "REDACTED",
"domain": ""
}
}
]
}Using a company-specific endpoint:
{
"secrets": [
{
"provider": "pipedrive",
"content": {
"api_token": "REDACTED",
"domain": "acme"
}
}
]
}Attach a Shared Credential
{
"shared_credentials": [
{
"shared_credential_id": "00000000-0000-0000-0000-000000000000"
}
]
}Validate the credential
POST /api/v1/organizations/{organization_id}/agents/{agent_id}/integrations/pipedrive/validate{
"validation_status": "valid",
"validation_identity": "[email protected]",
"validation_error": null,
"missing_scopes": []
}Remove the credential
{
"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:
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