For the complete documentation index, see llms.txt. This page is also available as Markdown.

Import voucher codes from Excel/CSV

Starts an asynchronous import of voucher codes for a basket offer from an uploaded Excel/CSV file and returns a cache_key that is polled on GET /bulk_voucher_codes/excel_import_status/ until the result is ready.

The file must contain exactly the column headers voucher_code and user_email, in that order. Each row creates the code (in active status) or, when the code already exists for the offer, assigns it to the user with the given email. Rows with problems — duplicate codes or emails within the file, unknown users, codes already assigned, or users already holding a code for the offer — are skipped and reported per row in the import result.

The target basket offer must be of type bulk_voucher_code.

post
/bulk_voucher_codes/excel_import/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

The payload of a spreadsheet import request.

basket_offerintegerRequired

Identifier of the target basket offer. The offer must be of type bulk_voucher_code.

filestringRequired

Base64-encoded Excel or CSV file with exactly the column headers voucher_code and user_email.

Responses
202

The import job was queued.

application/json

The status envelope of an asynchronous Excel/CSV import.

cache_keystring · uuidOptional

The job key used to poll the import status.

is_readybooleanOptional

Whether the import has finished.

error_messagestring · nullableOptional

A human-readable error message when the import failed or was not found.

post/bulk_voucher_codes/excel_import/
POST /api/remote/1/bulk_voucher_codes/excel_import/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 32

{
  "basket_offer": 1,
  "file": "text"
}
{
  "cache_key": "123e4567-e89b-12d3-a456-426614174000",
  "is_ready": true,
  "result": {
    "assigned_count": 1,
    "errors": [
      {
        "voucher_code": "text",
        "user_email": "text",
        "error": "text"
      }
    ],
    "summary": {
      "total_rows": 1,
      "successful": 1,
      "failed": 1
    }
  },
  "error_message": null
}

Last updated

Was this helpful?