---
title: "Upload a file for a customizable option"
method: POST
path: "/customizable-option-files"
tags: ["Cart"]
---

# Upload a file for a customizable option

`POST /customizable-option-files`

## Request

- Base URL: `http://localhost:8000/api/shop`
- URL: `http://localhost:8000/api/shop/customizable-option-files`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-shop-api/docs/customizable-option-files/post.ts> (a function with typed inputs; its response is checked against the schema)

Stages a file for a file-type customizable option and returns a token. Send the token on add-to-cart as customizableOptions: { "<optionId>": ["<token>"] }. Requires the storefront key and a cart/customer Bearer token.

## Headers

- `X-STOREFRONT-KEY` string, required
- `X-Locale` string
- `X-Channel` string
- `X-Currency` string

## Request body `multipart/form-data`

- object
  - `product_id` integer, required
  - `option_id` integer, required
  - `file` string, binary, required

## Response `201`

File staged. Returns a token to send on add-to-cart.

## Other responses

- `400`: Invalid input
- `403`: The file does not belong to your cart.
- `404`: Product not found.
- `422`: Option is not a file option, or the file is missing / wrong extension / too large.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-shop-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-shop-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-shop-api/revisions/f619df36bf29?raw)
