---
title: "Import giveaway codes into a giveaway pool"
method: POST
path: "/v1/giveaways/pools/{poolId}/import"
tags: ["Giveaways"]
---

# Import giveaway codes into a giveaway pool

`POST /v1/giveaways/pools/{poolId}/import`

## Request

- Base URL: `https://yourbaseurl.talon.one`
- URL: `https://yourbaseurl.talon.one/v1/giveaways/pools/{poolId}/import`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `Authorization`
- TypeScript: <https://skmtc.dev/talon/apis/management-api/docs/v1/giveaways/pools/:poolId/import/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 giveaway codes that should be created. Send
the file as multipart data.

The CSV file contains the following columns:

- `code` (required): The code of your giveaway, for instance, a gift card redemption code.
- `startdate`:  The start date in RFC3339 of the code redemption period.
- `enddate`: The last date in RFC3339 of the code redemption period.
- `attributes`: A JSON object describing _custom_ giveaway 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 `provider` associated with the giveaway entity, the object in the CSV file, when opened in a text editor, must be: `"{"provider": "myPartnerCompany"}"`.

The `startdate` and `enddate` have nothing to do with the _validity_ of the
codes. They are only used by the Rule Engine to award the codes or not.

You can use the time zone setting of your choice. The values are converted
to UTC internally by Talon.One.

> [!note] **Note**
> - We recommend limiting your file size to 500MB.
> - You can import the same code multiple times. Duplicate codes are treated and distributed to customers as unique codes.

## Example

```text
code,startdate,enddate,attributes
GIVEAWAY1,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,"{""provider"":
""Amazon""}"
GIVEAWAY2,2020-11-10T23:00:00Z,2022-11-11T23:00:00Z,"{""provider"":
""Amazon""}"
GIVEAWAY3,2021-01-10T23:00:00Z,2022-11-11T23:00:00Z,"{""provider"":
""Aliexpress""}"
```

## Path parameters

- `poolId` 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)
