The Peliqan Partner API is used by SaaS software companies and ISVs to integrate data solutions running on the Peliqan platform into their own platform. The Partner API is used to automate the provisioning and hydration of end-customer tenants on Peliqan.io. With hydration we mean automatically adding data source, creating data pipelines, enabling automations etc. inside the tenant of the end-customer in Peliqan.
There are 2 options:
- Peliqan REST API for integration with external systems (e.g. a portal), see below
- Peliqan
pqfunctions to use in scripts running on Peliqan in the partner account. More info: pq functions for partners
Naming conventions
- Partner: SaaS company or ISV
- End-customer: the customer of the Partner
- Partner account: the Peliqan.io account to which the Partner logs in, also called the “parent” account
- End-customer account: a Peliqan account for the End-customer, als referred to as a “sub account”
Peliqan Partner REST API
Base URL
The base URL depends on your region, e.g. for the EU region, the base URL is:
https://app.eu.peliqan.io
Authentication
Use the JWT token from your Partner account, to create new end-customer accounts and to fetch a JWT token per end-customer tenant.
All other API calls (adding a connection inside a sub account etc.) will happen with the JWT token of the sub account.
List and create end-customer accounts
List sub accounts:
GET /api/partner/sub-accounts/
Authorization: JWT <partner_token>
Create a sub account:
POST /api/partner/sub-account/
Authorization: JWT <partner_token>
Example body payload:
{
"first_name": "John",
"last_name": "Doe",
"email": "john@woodsolutions.com",
"password": "l2AdN^PXO%Qxg$#I",
"language": "en",
"company_name": "Wood Solutions Ltd",
"external_id": "wood_123" # required, your unique customer id
}Get JWT token for end-customer account
For server-side implementations, a non-expiring JWT token can be requested:
Using the id of the sub account:
GET /api/partner/sub-account/identity/?account_id=1234
Using the external_id:
GET /api/partner/sub-account/identity?external_id=wood_123
Authorization: JWT <partner_token>
For client-side implementations (in JS), a short lived JWT token can be requested:
Using the id of the sub account:
POST /api/partner/sub-account/integrate/?account_id=1234
Using the external_id:
POST /api/partner/sub-account/integrate/?external_id=wood_123
Authorization: JWT <partner_token>
Get connector definition
GET /api/servertypes
Authorization: JWT <partner_token>
The response includes the “connect form” for each connector. This is needed to know which params are required to add a connection, e.g. for Hubspot or Pipedrive.
Add a connection
Get the “connect form” first (see above), and include the required connection fields when creating a new connection on behalve of an end-customer. A connection is called a “server” in the API.
API endpoint:
POST /api/servers
Authorization: JWT <end_customer_token>
Connector with API key or login/password as credentials
Body (assuming the required fields for the connect form are “login” and “password”):
{
"servertype_id": 123, # e.g. Pipedrive
"login": "xxx",
"password": "xxx"
}Connector with oAuth2 flow
Initiate oAuth flow
For connectors that use an oAuth flow, the response will contain a redirect URL.
Example redirect URL provided to the partner:
{
"id": 12345, # id of the connection, see below, needed to fetch status
"oauth_url": "https://api.some_crm.com/oauth2/authorize?..."
}The redirect URL (oauth_url) needs to be opened from the Partner UI, in a new browser tab or window, so that the end-customer can complete the oAuth flow. Make sure to provide a "Powered by Peliqan" message prior to the oAuth flow, because the user will be asked to allow Peliqan to access their data (unless you have configured a private oAuth app).
Continue after redirect
From the Partner UI, you need to listen to the window on close event, and when this event occurs, make an API call to Peliqan to check if the connection was added successfully:
GET /api/server/<connection_id>
Authorization: JWT <end_customer_token>
List connections
GET /api/servers
Authorization: JWT <end_customer_token>
Get status of a connection
GET /api/server/<connection_id>
Authorization: JWT <end_customer_token>
Get logs of a connection
GET /api/server/<connection_id>/logs
Authorization: JWT <end_customer_token>
Create a query table in an end-customer account
POST /table
Authorization: JWT <end_customer_token>
Click here for the full API documentation.
Add a scheduled Python script in an end-customer account
POST /interface
Authorization: JWT <end_customer_token>
{
"name": "Sync script",
"raw_code": "...", # copy this from a template
"schedule": 3600
}