API / Reference / Card Transactions
Generate receipt upload URL
POST
https://api.light.inc/v1/card-transactions/{cardTransactionId}/receipt-upload-url
Generates a secure upload URL for receipt documents
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). 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
Send one of these on every request. See Authentication for how to get credentials.
- API key
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
- Bearer token
Path parameters
-
cardTransactionIdstring · uuidrequired
Request body
application/json;charset=UTF-8
-
filenamestring -
contentTypestring
Response
-
uploadUrlstring · url -
keystring -
metadataobject