API Reference

All routes are served by the Hono worker. Routes under /api/* require authentication via the requireAuth middleware unless otherwise noted. Webhook routes use HTTP Basic Auth for authentication.

OAuth – Pipedrive

Method Path Description
GET /auth/login Initiates Pipedrive OAuth2 flow. Redirects to Pipedrive authorization URL.
GET /auth/callback OAuth2 callback. Exchanges code for tokens, stores in D1, creates session.
GET /auth/status Returns current auth status. Supports session restoration via companyId query parameter.
GET /auth/logout Destroys session and clears cookie.

OAuth – Google Ads

Method Path Description
GET /auth/google-ads/login Initiates Google Ads OAuth2 flow. Redirects to Google authorization URL.
GET /auth/google-ads/callback Google OAuth2 callback. Exchanges code for tokens, stores in google_ads_tokens.
GET /auth/google-ads/status Returns Google Ads connection status for the current company.
POST /auth/google-ads/disconnect Removes stored Google Ads tokens for the current company.

Settings

Method Path Description
GET /api/settings Retrieve merge/webhook settings (webhook URL, field mappings, preserve fields).
POST /api/settings Save merge/webhook settings.
GET /api/settings/general Retrieve general settings (automation user, notification config).
POST /api/settings/general Save general settings.
POST /api/settings/automation-user Set the current user as the automation user.

Google Ads Settings

Method Path Description
GET /api/settings/adwords Retrieve Google Ads settings (enabled, MCC ID, GCLID field, currency, retry TTL).
POST /api/settings/adwords Save Google Ads settings.
GET /api/settings/adwords/groups List all conversion actions for the current company.
POST /api/settings/adwords/groups Create a new conversion action.
PUT /api/settings/adwords/groups/:id Update an existing conversion action.
DELETE /api/settings/adwords/groups/:id Delete a conversion action.
GET /api/settings/adwords/webhook-credentials Get or auto-generate webhook Basic Auth credentials for the current company.
POST /api/settings/adwords/webhook-credentials/regenerate Regenerate webhook credentials (invalidates existing automations).

Formidable Settings

Method Path Description
GET /api/settings/formidable Retrieve Formidable Forms integration settings.
POST /api/settings/formidable Save Formidable Forms integration settings.
GET /api/settings/formidable/forms Fetch available forms from the Formidable REST API.
GET /api/settings/formidable/form-fields/:formId Fetch fields for a specific Formidable form.
GET /api/settings/formidable/pd-fields Fetch Pipedrive person/deal fields for mapping configuration.

Deals and Merges

Method Path Description
GET /api/deals/search Search deals by query string.
GET /api/deals/:dealId Get deal details by ID.
GET /api/deals/by-person/:personId Get all deals associated with a person.
GET /api/persons/:personId Get person details by ID.
GET /api/persons/:personId/duplicates Find duplicate persons.
POST /api/deals/merge/preview Preview a merge between two deals (dry run).
POST /api/deals/merge Execute a deal/person merge with webhook handling.
POST /api/flip-merge Store flip-merge state (swap primary/secondary).
GET /api/flip-merge Retrieve pending flip-merge state.

Google Ads

Method Path Description
GET /api/google-ads/diagnose Diagnose Google Ads connection and configuration issues.
GET /api/google-ads/conversion-actions List available conversion actions from the Google Ads account.

SMTP2GO

Method Path Description
GET /api/smtp2go/senders Fetch verified sender domains and single senders from SMTP2GO.

Pipedrive Fields

Method Path Description
GET /api/pipedrive/person-fields Fetch person fields from Pipedrive API v2.
GET /api/pipedrive/deal-fields Fetch deal fields from Pipedrive API v2.

Logs

Method Path Description
GET /api/merge-logs Paginated list of merge log entries.
GET /api/merge-logs/:id Detailed merge log entry with full snapshot.
GET /api/adwords-logs Paginated list of Google Ads conversion log entries.
GET /api/adwords-logs/:id Detailed conversion log entry with request/response payloads.

Queue

Method Path Description
GET /api/queue List retry queue items for the current company.
POST /api/queue/reprocess Reset selected items to pending with immediate retry. Body: { ids: [1, 2, 3] }.
POST /api/queue/delete Delete selected queue items. Body: { ids: [1, 2, 3] }.

Campus Cloud

Method Path Description
POST /api/campus-cloud/push Push deal enrollment data to Campus Cloud SIS.

Webhooks

Webhook endpoints use HTTP Basic Auth (not session auth). They use the automation user’s stored tokens for Pipedrive API access. The automation user must be configured before webhooks will function.

Method Path Auth Description
POST /webhook/formidable/:companyId Bearer token (optional) Receives Formidable Forms submissions. Creates/updates Pipedrive persons and deals.
POST /webhook/adwords HTTP Basic Auth Receives Pipedrive Automation webhooks for Google Ads conversion tracking. Body: { "dealId": 123, "conversion": "name" }.

Pages

Method Path Description
GET /panel Deal sidebar panel (iframe).
GET /settings Settings page (iframe).
GET /field-modal Full-screen field comparison modal.
GET /help Redirects to /docs/index.html.
GET /docs/ Documentation site (docmd).
GET / Landing page.