- 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:
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 definitions
GET /api/servertypes
Authorization: JWT partner_token
Example response (click to expand)
Example response (click to expand)
ui.fields in the response). This is needed to know which params are required to add a connection, e.g. for Hubspot or Pipedrive.
The response also includes a list of available tables (see available_streams) which can be used in the setting selected_tables when creating a new connection.
Full API documentation
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
Full API documentation
Connector with API key or login/password as credentials
Body (assuming the required fields for the connect form are “login”, “password”, “param1” and “param2”):selected_tables is optional. If omitted, all tables will be included. Use available_streams from the connector definition (see above) to get a list of available tables that can be included here.
Connector with oAuth2 flow
Initiate oAuth flow For connectors that use an oAuth flow, the response ofPOST /api/servers will contain a redirect URL.
Example redirect URL provided to the partner:
auth_uri) 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
Running a ELT pipeline in an end-customer account
GET https://app.eu.peliqan.io/api/servers/connection_id/syncdb
Authorization: JWT end_customer_token
Optional querystring parameters:
tables: comma-separated list of tables to syncis_async: boolean (true or false)is_async=true: Asynchronous run, API call will not wait for pipeline to completeis_async=false: API call will wait for pipeline to complete (only use for short-running pipelines)
pipeline: boolean (true or false)pipeline=true: run a sync pipeline for a SaaS source (use this to run an ELT pipeline)pipeline=false: discover tables, schemas, tables in a connected database
skip_refresh: boolean (true or false)skip_refresh=true: do not rediscover tables in target dchemaskip_refresh=false: do a rediscover of target schema
GET https://app.eu.peliqan.io/api/servers/connection_id/syncdb?tables=table_name&is_async=true&pipeline=true&skip_refresh=true
Authorization: JWT end_customer_token
Adding a new table to an existing connection in an end-customer account
1. Enable the new table for the connection A connection is called a “server” in the API. Get the details of the existing connection (server) to retrieveselected_tables:
GET https://app.eu.peliqan.io/api/servers/connection_id/
Authorization: JWT end_customer_token
See the section selected_tables from the response. Example:
selected_tables and update the connection (server):
PATCH https://app.eu.peliqan.io/api/servers/connection_id/
Authorization: JWT end_customer_token
Body:
POST https://app.eu.peliqan.io/api/servers/connection_id/pipeline/discover/
Authorization: JWT end_customer_token
Body:
GET https://app.eu.peliqan.io/api/servers/connection_id/syncdb?tables=new_table_name&is_async=true&pipeline=true&skip_refresh=true
Authorization: JWT end_customer_token