UG-D-01 · Get started with the Piporex API
Book: Developers · Applies to: REST API · Since: v0.16 (phase P16)
What you'll get: an API key, and a first request that reads your contacts. The full list of endpoints is the generated API reference.
Before you start
- A Workspace on the Starter or Pro plan. On the Free plan the API answers
402 plan_required. - The Owner or Admin role. Only they can create and revoke API keys.
- A key acts as the member who created it, limited to its scopes and to that member's current role. If the member loses a permission, the key loses it too.
Steps
-
Go to Settings → Developers → API keys and click + Create API key. Give it a name, tick only the scopes the integration needs (see the table below) and, if you like, set an expiry date.
-
Copy the key now. It looks like
pk_live_<prefix>.<secret>and is shown once; Piporex stores only a hash. A Workspace can have 20 active keys. -
Send the key as a Bearer token. This lists five contacts:
curl "https://api.piporex.com/v1/contacts?limit=5" \ -H "Authorization: Bearer pk_live_<prefix>.<secret>" -
Lists are paged with a cursor. Each response has
itemsandnext_cursor; send the cursor back as?cursor=…to get the next page.next_cursorisnullon the last page. -
Create a record with a JSON body. The key needs the matching edit scope:
curl -X POST "https://api.piporex.com/v1/contacts" \ -H "Authorization: Bearer pk_live_<prefix>.<secret>" \ -H "Content-Type: application/json" \ -d '{"email":"ada@example.com","first_name":"Ada"}'
What the API covers
The public API is a documented subset of what the app does. These endpoints, and only these, work with an API key:
| Area | What you can do |
|---|---|
| Contacts | List, create, read, update, delete |
| Companies | List, create, read, update, delete |
| Deals | List, create, read, update, delete, and move a deal to another stage |
| Pipelines | List and read (read only) |
| Events | List, read, and list an event's attendees (bookings) |
| Notes | List, create, update, delete |
| Tasks | List, create, update, delete |
| Segments | List and read (read only) |
| Reports | Funnel, sources, conversion and events |
Everything else (members, billing, Workspace settings, API keys, webhooks, sites, full export) answers
403 api_key_not_allowed with a key, even when the key's scope would cover it. The machine-readable description is
at https://api.piporex.com/v1/openapi.json and needs no key.
Scopes
Pick the smallest set that works. Each endpoint in the API reference names the scope it needs.
| Scope | Lets the key |
|---|---|
contacts.read |
Read contacts, notes, tasks and segments |
contacts.edit |
Create and update contacts; create, update and delete notes and tasks |
contacts.assign |
Set a contact's owner (needs contacts.edit) |
contacts.bulk_delete |
Delete a contact (needs contacts.edit) |
companies.read |
Read companies |
companies.edit |
Create, update and delete companies |
deals.read |
Read deals and pipelines |
deals.edit |
Create, update, move and delete deals |
deals.assign |
Set a deal's owner (needs deals.edit) |
events.read |
Read events and their attendees |
event_financials.read |
Include money figures (revenue, amounts paid) in what the events endpoints return |
reports.read |
Read the four reports |
A scope you do not hold yourself cannot be given to a key: asking for it answers 403 forbidden.
Rate limits
Each key may send 300 requests a minute on Starter and 600 on Pro. Above that the API answers
429 rate_limited with a Retry-After header: wait that many seconds, then retry. Limits are per key, so give each
integration its own key.
Errors
Every error has the same shape:
{ "error": { "code": "rate_limited", "message": "…", "request_id": "…" } }
| Status | Code | What to do |
|---|---|---|
| 400 | validation_error |
Fix the field named in message. |
| 401 | unauthorized |
The key is missing, wrong, revoked or expired. Create a new one. |
| 402 | plan_required |
The Workspace is on Free. Upgrade to Starter or Pro. |
| 403 | forbidden, api_key_not_allowed |
Add the scope, or use an endpoint from the list above. |
| 429 | rate_limited |
Wait for Retry-After, then retry. |
Quote the request_id when you write to support.
What happens next
Writes made with a key are recorded in the Workspace's audit log under the member who created it, marked as coming from an API key. To react to changes as they happen instead of polling, use webhooks.
If you get stuck
401 unauthorizedwith a key I just created. Check you copied the whole key including the part before and after the dot, and that the header readsAuthorization: Bearer <key>with no quotes inside.402 plan_required. The Workspace is on the Free plan. Keys are kept when a Workspace goes back to Free, and work again after you upgrade.403 api_key_not_allowed. That endpoint is not part of the public API (see the table above).- I lost the key. It cannot be shown again. Revoke it and create a new one.
Related
- UG-D-02 · UG-D-03 · UG-O-13 · API reference
Release notes: v0.16 — article created.