---
title: "Import loyalty cards"
method: POST
path: "/v1/loyalty_programs/{loyaltyProgramId}/import_cards"
tags: ["Loyalty cards"]
---

# Import loyalty cards

`POST /v1/loyalty_programs/{loyaltyProgramId}/import_cards`

## Request

- Base URL: `https://yourbaseurl.talon.one`
- URL: `https://yourbaseurl.talon.one/v1/loyalty_programs/{loyaltyProgramId}/import_cards`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `Authorization`
- TypeScript: <https://skmtc.dev/talon/apis/management-api/docs/v1/loyalty_programs/:loyaltyProgramId/import_cards/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 loyalty cards that you want to use in your
card-based loyalty program.

Send the file as multipart data.

It contains the following columns for each card:

- `identifier` (required): The identifier of the loyalty card,
which must match the regular expression `^[A-Za-z0-9._%+@-]+$`.
- `state` (required): The state of the loyalty card. It can be `active` or
`inactive`.
- `customerprofileids` (optional): An array of strings representing the
identifiers of the customer profiles linked to the loyalty card. The
identifiers should be separated with a semicolon (;).
- `attributes` (optional): A JSON object that contains the loyalty card's custom
attributes and their values. These attributes must be created and connected to this
loyalty program before they can be assigned to the cards through this endpoint.

> [!note] Your CSV file must contain less than 500,000 rows. Requests time out after 30 seconds.

## Example

```csv
identifier,state,customerprofileids,attributes
123-456-789AT,active,Alexa001;UserA,'{""my_attributes"": ""10_off""}"
```

## Path parameters

- `loyaltyProgramId` 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.

## Other responses

- `401`: Unauthorized
- `404`: Not found

---

[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)
