Create expense
Creates an expense synchronously from a receipt uploaded with shouldAutoCreateExpense: false and the given line items. No OCR runs: the fields you send are what is stored. A PDF receipt is kept as-is; JPEG, PNG, HEIC and TIFF receipts are converted to PDF first. The expense is created as a draft for the authenticated user and is included in the next POST /v1/expenses/submit.
curl --request POST \
--url https://api.light.inc/v1/expenses \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"originalAmount": 123,
"billingAmount": 123,
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'import requests
url = "https://api.light.inc/v1/expenses"
payload = {
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"originalAmount": 123,
"billingAmount": 123,
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
receiptDocumentKey: '<string>',
originalCurrency: 'USD',
performedDate: '2023-12-25',
detailedDescription: '<string>',
lineItems: [
{
originalAmount: 123,
billingAmount: 123,
description: '<string>',
reimbursementCategoryId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
]
})
};
fetch('https://api.light.inc/v1/expenses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/expenses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'receiptDocumentKey' => '<string>',
'originalCurrency' => 'USD',
'performedDate' => '2023-12-25',
'detailedDescription' => '<string>',
'lineItems' => [
[
'originalAmount' => 123,
'billingAmount' => 123,
'description' => '<string>',
'reimbursementCategoryId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/expenses"
payload := strings.NewReader("{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.light.inc/v1/expenses")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/expenses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"billingCurrency": "USD",
"status": "CREATED",
"userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expenseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"originalAmount": 123,
"billingAmount": 123,
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
Headers
Body
Key returned by POST /v1/expenses/upload-url called with shouldAutoCreateExpense=false, once the file has been uploaded. A PDF is attached as-is; JPEG, PNG, HEIC and TIFF files are converted to PDF first.
"USD"
Date the expense was incurred; also the date of the exchange rate used when billingAmount is derived
Free-text description of the expense as a whole; each line carries its own description
At least one line. The reimbursement category of a line drives the GL account and tax code of the reimbursement.
Show child attributes
Show child attributes
Response
default response
"USD"
"USD"
⚠️ This enum is not exhaustive; new values may be added in the future.
CREATED, IN_DRAFT, SUBMITTED_FOR_REVIEW, CANCELLED Show child attributes
Show child attributes
curl --request POST \
--url https://api.light.inc/v1/expenses \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"originalAmount": 123,
"billingAmount": 123,
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'import requests
url = "https://api.light.inc/v1/expenses"
payload = {
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"originalAmount": 123,
"billingAmount": 123,
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
receiptDocumentKey: '<string>',
originalCurrency: 'USD',
performedDate: '2023-12-25',
detailedDescription: '<string>',
lineItems: [
{
originalAmount: 123,
billingAmount: 123,
description: '<string>',
reimbursementCategoryId: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
]
})
};
fetch('https://api.light.inc/v1/expenses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/expenses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'receiptDocumentKey' => '<string>',
'originalCurrency' => 'USD',
'performedDate' => '2023-12-25',
'detailedDescription' => '<string>',
'lineItems' => [
[
'originalAmount' => 123,
'billingAmount' => 123,
'description' => '<string>',
'reimbursementCategoryId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/expenses"
payload := strings.NewReader("{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.light.inc/v1/expenses")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/expenses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"receiptDocumentKey\": \"<string>\",\n \"originalCurrency\": \"USD\",\n \"performedDate\": \"2023-12-25\",\n \"detailedDescription\": \"<string>\",\n \"lineItems\": [\n {\n \"originalAmount\": 123,\n \"billingAmount\": 123,\n \"description\": \"<string>\",\n \"reimbursementCategoryId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"receiptDocumentKey": "<string>",
"originalCurrency": "USD",
"billingCurrency": "USD",
"status": "CREATED",
"userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"performedDate": "2023-12-25",
"detailedDescription": "<string>",
"lineItems": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expenseId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"originalAmount": 123,
"billingAmount": 123,
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"reimbursementCategoryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}