# Integration Guide

{% hint style="info" %} <mark style="color:blue;">We wrote these docs assuming you are familiar with APIs and can make API calls</mark>.
{% endhint %}

## API Keys

In order to integrate with Duplo, you are required to have a Duplo account and an API key.

:point\_right: [Click here to create an account on Duplo](https://app.tryduplo.com/auth/welcome), if you don't have one.&#x20;

:point\_right: Follow the steps below to get your API key.

* On your dashboard, you'll notice you're automatically in *Test* mode.
* Select the [settings menu](https://app.tryduplo.com/app/settings) on your dashboard.
* Click on the `Developer` tab.

<figure><img src="https://3240640353-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz6pUuKn4YJfnLrGRaudp%2Fuploads%2F3iv9QS1Cu9SdktC828Kk%2FScreen%20Shot%202023-01-26%20at%2011.43.59%20AM.png?alt=media&#x26;token=4ded029e-a888-41dc-8479-343fd32f9e99" alt=""><figcaption></figcaption></figure>

* Click the copy button beside your API key on the dashboard.

<figure><img src="https://3240640353-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz6pUuKn4YJfnLrGRaudp%2Fuploads%2FsHtTnAw5eErIp12r9YSm%2FScreen%20Shot%202023-01-26%20at%2011.52.45%20AM.png?alt=media&#x26;token=e6a55333-9c85-43d8-85af-02ad66c3dea4" alt=""><figcaption></figcaption></figure>

## Business ID

When making API calls, you may need to supply the `business_id` . This is an alphanumeric key we automatically generate for new businesses.

:point\_right: Follow the steps below to get your `business_id`.

1. On your dashboard, click on *"Settings"* and then *on "Developer"*
2. Click on the copy icon to copy your `business_id` to the clipboard.

<figure><img src="https://3240640353-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz6pUuKn4YJfnLrGRaudp%2Fuploads%2FTUPFlZHZpcGCONnjnu3J%2Fimage.png?alt=media&#x26;token=622579f8-f04e-4619-b4ca-47e41a491578" alt=""><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:blue;">We have two environments:</mark> <mark style="color:blue;"></mark>*<mark style="color:blue;">live</mark>* <mark style="color:blue;"></mark><mark style="color:blue;">and</mark> <mark style="color:blue;"></mark>*<mark style="color:blue;">test</mark>* <mark style="color:blue;"></mark><mark style="color:blue;">mode. Please ensure that your account is on test mode when making use of the Test API key. Once you are done with your test, complete our compliance requirements so you can switch your account to live to get your live API key.</mark>
{% endhint %}

## Authentication

Duplo uses API keys to authenticate requests. You can view and manage your API keys on the [Duplo Dashboard](https://app.tryduplo.com/app/settings). Test mode secret keys have the prefix `dp_test` and live mode secret keys have the prefix `dp_live`.

{% hint style="danger" %} <mark style="color:red;">Treat your API keys like your credit card because they carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub or Bitbucket, client-side code, and so forth.</mark>
{% endhint %}

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Authorization headers should be in the following format:\
`Authorization: Bearer SECRET_KEY`

{% hint style="info" %}
**Sample authorization header**

<mark style="background-color:green;">`Authorization: Bearer dp_test_P2tH90snfuQB0qlPopnhdgkOpbs...`</mark>
{% endhint %}
