Using our Data Import API, you can import data into your program in bulk, the same way you can with the Data Importer.

There's a separate endpoint for each type of data you can import. All endpoints accept CSV files, and all endpoints use the same Basic Authentication as the other ones in this reference. The required columns in the CSV file are the same as the ones required when using the Data Importer in the application.

Endpoint URLs

Import TypeEndpoint URLRequired Columns
Partnershttps://api.partnerstack.com/v1/import/partnersPartner Import Schema
Customershttps://api.partnerstack.com/v1/import/customersCustomer Import Schema
Transactionshttps://api.partnerstack.com/v1/import/transactionsTransaction Import Schema
Rewardshttps://api.partnerstack.com/v1/import/rewardsReward Import Schema
Dealshttps://api.partnerstack.com/v1/import/dealsFollow the required columns you see when trying to import a deal on your PartnerStack dashboard

Endpoint Details

  • URL: https://api.partnerstack.com/v1/import/<import_type> (See table above for which URL to use)
  • Method: POST
  • Authentication: Basic Authentication
  • Body Content Type: multipart/form-data

In your Content-Disposition header, please set the name directive as file (e.g Content-Disposition: form-data; name="file"; filename="customers.csv")

Example Requests

In either example, please replace PUBLIC_KEY and SECRET_KEY with your PartnerStack Production API keys. Both examples assume a transaction import.

import requests
from requests.auth import HTTPBasicAuth

with open('transactions.csv', 'rb') as in_csv:
    r = requests.post(
        'https://api.partnerstack.com/v1/import/transactions',
        auth=HTTPBasicAuth('PUBLIC_KEY', 'SECRET_KEY'),
        files={
            'file': ('transactions.csv', in_csv, 'text/csv')
        }
    )
curl -X "POST" "https://api.partnerstack.com/v1/import/transactions" \
-u 'PUBLIC_KEY:SECRET_KEY' \
--form file='@transactions.csv'

Example Response

{
  "status": 200,
  "message": "File Accepted and processing. Import report will be sent to users with Import permissions.",
  "rdata": null,
  "adata": null,
  "bdata": null
}