Quick Start

Our quick start guide is a quick and easy way to get familiarized with Endgrate's platform.

In this guide, we'll set up a full integration workflow example for pulling and pushing CRM contact and CRM company data.

🚧

Note

Make sure you've read our Documentation Overview and Core Concepts before diving in.

🚧

Note

In the code examples below, you'll see capitalized values such as API_KEY, SESSION_ID, and TRANSFER_ID. These are placeholders and must be replaced with valid values.

Setup

Retrieve your API key from the settings page of your dashboard.


Initiate Session

First, initiate a session using the POST api/session/initiate endpoint. Specify the schemas you want to work with. In this quick start example, we'll be taking advantage of Endgrate's default common data model schemas for CRM contact and CRM company data.

curl --request POST \
     --url https://endgrate.com/api/session/initiate \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY' \
     --header 'content-type: application/json' \
     --data '
{
  "schema": [
    {
    	"endgrate_type": "crm-contact"
    },
    {
    	"endgrate_type": "crm-company"
    }
  ]
}
'
import requests

url = "https://endgrate.com/api/session/initiate"

payload = { "schema": [{ "endgrate_type": "crm-contact" }, { "endgrate_type": "crm-company" }] }
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    authorization: 'Bearer API_KEY'
  },
  body: JSON.stringify({schema: [{endgrate_type: 'crm-contact'}, {endgrate_type: 'crm-company'}]})
};

fetch('https://endgrate.com/api/session/initiate', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

You'll receive a session_id in return:

{
  "success": true,
  "session_id": "SESSION_ID"
}

Redirect End User

Then, redirect your end user to the GET /session page in a new tab or pop-up window so that they can choose an integration provider, authenticate, and configure the session.

<a href="https://endgrate.com/session?session_id=SESSION_ID" target="_blank">

Trigger Transfers

Last, you can trigger transfers using the POST /api/pull/transfer endpoint and the POST /api/push/transfer endpoint.

Pull Data

To pull data, trigger a transfer for a given endgrate_type schema.

curl --request POST \
     --url https://endgrate.com/api/pull/transfer \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY' \
     --header 'content-type: application/json' \
     --data '
{
  "session_id": "SESSION_ID",
  "endgrate_type": "crm-contact",
  "synchronous": true
}
'
import requests

url = "https://endgrate.com/api/pull/transfer"

payload = {
    "session_id": "SESSION_ID",
    "endgrate_type": "crm-contact",
    "synchronous": True
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    authorization: 'Bearer API_KEY'
  },
  body: JSON.stringify({
    session_id: 'SESSION_ID',
    endgrate_type: 'crm-contact',
    synchronous: true
  })
};

fetch('https://endgrate.com/api/pull/transfer', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

You'll receive a transfer_id in return:

{
  "success": true,
  "transfer_id": "TRANSFER_ID",
  "statistics": "https://endgrate.com/statistics?transfer_id=TRANSFER_ID"
}

Then, query for fetched data using the GET /api/pull/data endpoint:

curl --request GET \
     --url https://endgrate.com/api/pull/data?endgrate_type=crm-contact&transfer_id=TRANSFER_ID \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY'
import requests

url = "https://endgrate.com/api/pull/data?endgrate_type=crm-contact&transfer_id=TRANSFER_ID"

headers = {
    "accept": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.get(url, headers=headers)

print(response.text)
const options = {
  method: 'GET',
  headers: {accept: 'application/json', authorization: 'Bearer API_KEY'}
};

fetch('https://endgrate.com/api/pull/data?endgrate_type=crm-contact&transfer_id=TRANSFER_ID', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

The data returned will be in accordance with Endgrate's default common data model schema.

Push Data

To push data, trigger a transfer for a given endgrate_type schema. Specify your transfer data in accordance with Endgrate's default common data model schema.

curl --request POST \
     --url https://endgrate.com/api/push/transfer \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY' \
     --header 'content-type: application/json' \
     --data '
{
  "session_id": "SESSION_ID",
  "endgrate_type": "crm-company",
  "transfer_data": [
    {
      "data": {
        "company_name": "Endgrate",
        "website": "https://endgrate.com"
      }
    }
  ]
}
'
import requests

url = "https://endgrate.com/api/push/transfer"

payload = {
    "session_id": "SESSION_ID",
    "endgrate_type": "crm-company",
    "transfer_data": [{ "data": {
                "company_name": "Endgrate",
                "website": "https://endgrate.com"
            } }]
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    authorization: 'Bearer API_KEY'
  },
  body: JSON.stringify({
    session_id: 'SESSION_ID',
    endgrate_type: 'crm-company',
    transfer_data: [{data: {company_name: 'Endgrate', website: 'https://endgrate.com'}}]
  })
};

fetch('https://endgrate.com/api/push/transfer', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

You'll receive a transfer_id in return:

{
  "success": true,
  "transfer_id": "TRANSFER_ID",
  "statistics": "https://endgrate.com/statistics?transfer_id=TRANSFER_ID"
}

Then, query for result data using the GET /api/push/data endpoint:

curl --request GET \
     --url https://endgrate.com/api/push/data?endgrate_type=crm-company&transfer_id=TRANSFER_ID \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY'
import requests

url = "https://endgrate.com/api/pull/data?endgrate_type=crm-contact&transfer_id=TRANSFER_ID"

headers = {
    "accept": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.get(url, headers=headers)

print(response.text)
const options = {
  method: 'GET',
  headers: {accept: 'application/json', authorization: 'Bearer API_KEY'}
};

fetch('https://endgrate.com/api/pull/data?endgrate_type=crm-contact&transfer_id=TRANSFER_ID', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

The data returned will be in accordance with Endgrate's default common data model schema.


Delete Session

We recommend deleting unused sessions and all of their accompanying data using the POST /api/session/delete endpoint. This can also be done through the 'Sessions' tab in your dashboard.

curl --request POST \
     --url https://endgrate.com/api/session/delete \
     --header 'accept: application/json' \
     --header 'authorization: Bearer API_KEY' \
     --header 'content-type: application/json' \
     --data '
{
  "session_id": "SESSION_ID"
}
'
import requests

url = "https://endgrate.com/api/session/delete"

payload = { "session_id": "SESSION_ID" }
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer API_KEY"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    authorization: 'Bearer API_KEY'
  },
  body: JSON.stringify({session_id: 'SESSION_ID'})
};

fetch('https://endgrate.com/api/session/delete', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));