# Generate receipt upload URL

> Generates a secure upload URL for receipt documents

`POST https://api.light.inc/v1/card-transactions/{cardTransactionId}/receipt-upload-url`

## Note

The URL is valid for five minutes ; PUT the bytes with the declared Content-Type and every entry of metadata as a request header , or the upload is rejected (see Files (/docs/getting-started/pagination-filtering-errors files)). There is no follow-up call: Light picks the file up, converts it to PDF and sets receiptDocumentKey asynchronously — to the key of the converted PDF , not the key returned here — so poll GET /v1/card-transactions/{id} until it is non-null. If conversion fails, failureContext is set with CARD_TRANSACTION_PDF_RECEIPT_FAILED . While the transaction is unposted the receipt is also read by Light's document AI, which writes the account, tax code and custom properties it extracts onto every line — coding you set before the upload can be overwritten. The cardTransactionId is not checked at this step; a wrong id only fails later, inside the background job. Requires a user credential, not an API key.

## Authorization

- API key
- Bearer token

See https://light.inc/docs/getting-started/authentication.

## Path parameters

- `cardTransactionId` (string, uuid, required)

## Request body

`application/json;charset=UTF-8`


```json
{
  "filename": "string",
  "contentType": "string"
}
```

Values above are generated from the schema: the shapes and types are real, the values are placeholders, and fields that exclude each other are all shown. Do not send it unchanged.

## Response


```json
{
  "uploadUrl": "https://example.com",
  "key": "string",
  "metadata": null
}
```

Values above are generated from the schema: the shapes and types are real, the values are placeholders.

## Code

```bash
curl -X POST "https://api.light.inc/v1/card-transactions/3c90c3cc-0d44-4b50-8888-8dd25736052a/receipt-upload-url" \
  -H "Authorization: Basic YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "filename": "string",
  "contentType": "string"
}'
```

---

Full page: https://light.inc/docs/api-reference/v1--card-transactions/generate-receipt-upload-url · Index: https://light.inc/docs/llms.txt
