---
updatedAt: 2026-09-09T03:52:54.000Z
agentTools:
  projectIndex: https://docs.vouchery.io/llms.txt
---

# Batch create vouchers for customers CSV file

Batch create vouchers for customers CSV file

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "email": "hello@vouchery.io"
    },
    "description": "Vouchery API",
    "license": {
      "name": "Commercial",
      "url": "https://www.vouchery.io"
    },
    "title": "Vouchery",
    "version": "dev-vouchery-go"
  },
  "paths": {
    "/api/v2.1/campaigns/{campaign_id}/vouchers/batch-by-customers-csv": {
      "post": {
        "description": "Batch create vouchers for customers CSV file",
        "operationId": "postApiV21CampaignsCampaignidVouchersBatchbycustomerscsv",
        "parameters": [
          {
            "description": "Campaign ID",
            "in": "path",
            "name": "campaign_id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "description": "File to import",
                    "type": "string",
                    "format": "binary"
                  },
                  "random_part_length": {
                    "description": "Random part length, must be greater than 2",
                    "type": "integer"
                  },
                  "gift_card_value": {
                    "description": "Gift card value",
                    "type": "number"
                  },
                  "code_type": {
                    "description": "Code type (letters|digits|mixed|funny_words)",
                    "type": "string"
                  },
                  "prefix": {
                    "description": "Prefix",
                    "type": "string"
                  }
                },
                "required": [
                  "file",
                  "random_part_length",
                  "code_type",
                  "prefix"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Created object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseCreateTaskResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_BadRequest"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_Forbidden"
                }
              }
            }
          },
          "404": {
            "description": "Not found error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_NotFound"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable entity error. Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseValidationError_Example"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. Try again in a few minutes or contact support.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/responseError_Example_InternalServerError"
                }
              }
            }
          }
        },
        "security": [
          {
            "app_auth": [
              "admin"
            ]
          }
        ],
        "summary": "Batch create vouchers for customers CSV file",
        "tags": [
          "Vouchers"
        ]
      }
    }
  },
  "tags": [
    {
      "description": "",
      "externalDocs": {
        "description": "",
        "url": "https://docs.vouchery.io"
      },
      "name": "Vouchers"
    }
  ],
  "servers": [
    {
      "url": "https://admin.sandbox.vouchery.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "app_auth": {
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    },
    "schemas": {
      "responseCreateTaskResponse": {
        "properties": {
          "task_id": {}
        },
        "required": [
          "task_id"
        ],
        "type": "object"
      },
      "responseError_Example_BadRequest": {
        "properties": {
          "code": {
            "example": "bad_request",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "Error message",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "error",
          "message",
          "type",
          "code"
        ],
        "type": "object"
      },
      "responseError_Example_Forbidden": {
        "properties": {
          "code": {
            "example": "forbidden",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "You are not permitted to access this resource",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "message",
          "type",
          "code",
          "error"
        ],
        "type": "object"
      },
      "responseError_Example_InternalServerError": {
        "properties": {
          "code": {
            "example": "unknown_error",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "Unknown error. Trace ID 1b477920d09147d9bce22cce8f405e98.",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "message",
          "type",
          "code",
          "error"
        ],
        "type": "object"
      },
      "responseError_Example_NotFound": {
        "properties": {
          "code": {
            "example": "not_found",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "Object was not found",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "type",
          "code",
          "error",
          "message"
        ],
        "type": "object"
      },
      "responseError_Example_Unauthorized": {
        "properties": {
          "code": {
            "example": "not_authorized",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "message": {
            "example": "Not authorized",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "code",
          "error",
          "message",
          "type"
        ],
        "type": "object"
      },
      "responseValidationError_Example": {
        "properties": {
          "code": {
            "example": "invalid",
            "type": "string"
          },
          "error": {
            "example": "true",
            "type": "boolean"
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/responseValidationSubError_Example"
            },
            "type": "array"
          },
          "message": {
            "example": "Object is invalid",
            "type": "string"
          },
          "type": {
            "example": "Error",
            "type": "string"
          }
        },
        "required": [
          "code",
          "error",
          "message",
          "type",
          "errors"
        ],
        "type": "object"
      },
      "responseValidationSubError_Example": {
        "properties": {
          "attribute": {
            "description": "Name of the property which is invalid",
            "example": "name",
            "type": "string"
          },
          "code": {
            "example": "must_be_unique",
            "type": "string"
          },
          "message": {
            "example": "Name must be unique",
            "type": "string"
          }
        },
        "required": [
          "attribute",
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```