---
title: "Import referrals"
method: POST
path: "/v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals"
tags: ["Referrals"]
---

# Import referrals

`POST /v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals`

## Request

- Base URL: `https://yourbaseurl.talon.one`
- URL: `https://yourbaseurl.talon.one/v1/applications/{applicationId}/campaigns/{campaignId}/import_referrals`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `Authorization`
- TypeScript: <https://skmtc.dev/talon/apis/management-api/docs/v1/applications/:applicationId/campaigns/:campaignId/import_referrals/post.ts> (a function with typed inputs; its response is checked against the schema)

> [!note] Management API endpoints are **not** meant to be used in real-time integrations that directly serve your end users. Rate limit: 3 requests per second.

Upload a CSV file containing the referrals that should be created.

The file should be sent as multipart data.

The CSV file contains the following columns:

- `code` (required): The referral code.
- `advocateprofileintegrationid` (required): The profile ID of the advocate.
- `startdate`: The start date in RFC3339 of the code redemption period.
- `expirydate`: The end date in RFC3339 of the code redemption period.
- `limitval`: The maximum number of redemptions of this code. Defaults to `1` when left blank.
- `attributes`: A JSON object describing _custom_ referral attribute names and their values, enclosed with double quotation marks.<br />
  For example, if you created a [custom attribute](https://docs.talon.one/docs/dev/concepts/attributes#custom-attributes)
  called `category` associated with the referral entity, the object in the CSV file, when opened in a text editor, must be: `"{"category": "10_off"}"`.

You can use the time zone of your choice. It is converted to UTC internally by Talon.One.

> [!important] When you import a CSV file with referrals,
> a [customer profile](https://docs.talon.one/docs/dev/concepts/entities/customer-profiles)
> is **not** automatically created for each `advocateprofileintegrationid`
> column value. Use the [Update customer profile](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfileV2)
> endpoint or the [Update multiple customer profiles](https://docs.talon.one/integration-api#tag/Customer-profiles/operation/updateCustomerProfilesV2)
> endpoint to create the customer profiles.

> [!note] We recommend limiting your file size to 500 MB.

## Example

```text
code,startdate,expirydate,advocateprofileintegrationid,limitval,attributes
REFERRAL_CODE1,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid_4,1,"{""my_attribute"":
""10_off""}"
REFERRAL_CODE2,2020-11-10T23:00:00Z,2021-11-11T23:00:00Z,integid1,1,"{""my_attribute"":
""20_off""}"
```

## Path parameters

- `applicationId` integer, required
- `campaignId` integer, required

## Request body `multipart/form-data`

- object
  - `upFile` string, binary: The CSV file containing the data that is being imported.

## Response `200`

OK

- Import
  - `id` integer, required: The internal ID of this entity.
  - `created` string, date-time, required: The time this entity was created.
  - `accountId` integer, required: The ID of the account that owns this entity.
  - `userId` integer, required: The ID of the user associated with this entity.
  - `entity` string, required: The name of the entity that was imported.
  - `amount` integer, required: The number of values that were imported.

---

[API](https://skmtc.dev/talon/apis/management-api.md) - [All operations](https://skmtc.dev/talon/apis/management-api/llms.txt) - [OpenAPI document](https://skmtc.dev/talon/apis/management-api/revisions/7ef1b9504c3a?raw)
