curl --request GET \
--url https://app.synthetic.ai/api/v1/invoices/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.synthetic.ai/api/v1/invoices/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.synthetic.ai/api/v1/invoices/{id}', 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://app.synthetic.ai/api/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.synthetic.ai/api/v1/invoices/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.synthetic.ai/api/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.synthetic.ai/api/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerName": "<string>",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"status": "DRAFT",
"notes": "<string>",
"approvedByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedByUser": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"role": "ADMIN"
},
"approvedByApiKeyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedAt": "<string>",
"issuedAt": "<string>",
"dueAt": "<string>",
"paymentTermsDays": 0,
"lastPaidAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"voidedAt": "<string>",
"periodStartAt": "2023-11-07T05:31:56Z",
"periodEndAt": "2023-11-07T05:31:56Z",
"lastSentAt": "<string>",
"deliveryMethod": "EMAIL",
"totalAmount": {
"value": 0,
"currencyCode": "USD"
},
"appliedAmount": {
"value": 0,
"currencyCode": "USD"
},
"pendingPaymentAmount": {
"value": 0,
"currencyCode": "USD"
},
"remainingAmount": {
"value": 0,
"currencyCode": "USD"
},
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractBillableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"billingStartAt": "2023-11-07T05:31:56Z",
"billingEndAt": "2023-11-07T05:31:56Z",
"amount": {
"value": 0,
"currencyCode": "USD"
},
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Input validation failed",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Unauthorized",
"issues": []
}{
"code": "NOT_FOUND",
"message": "The record does not exist for your business.",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred.",
"issues": []
}Get an invoice
One invoice by id, a voided one included, with every one of its lines. An invoice of another entity is not found. Needs a key holding invoices:read.
curl --request GET \
--url https://app.synthetic.ai/api/v1/invoices/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.synthetic.ai/api/v1/invoices/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.synthetic.ai/api/v1/invoices/{id}', 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://app.synthetic.ai/api/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.synthetic.ai/api/v1/invoices/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.synthetic.ai/api/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.synthetic.ai/api/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customerName": "<string>",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"number": "<string>",
"status": "DRAFT",
"notes": "<string>",
"approvedByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedByUser": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"role": "ADMIN"
},
"approvedByApiKeyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"approvedAt": "<string>",
"issuedAt": "<string>",
"dueAt": "<string>",
"paymentTermsDays": 0,
"lastPaidAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"voidedAt": "<string>",
"periodStartAt": "2023-11-07T05:31:56Z",
"periodEndAt": "2023-11-07T05:31:56Z",
"lastSentAt": "<string>",
"deliveryMethod": "EMAIL",
"totalAmount": {
"value": 0,
"currencyCode": "USD"
},
"appliedAmount": {
"value": 0,
"currencyCode": "USD"
},
"pendingPaymentAmount": {
"value": 0,
"currencyCode": "USD"
},
"remainingAmount": {
"value": 0,
"currencyCode": "USD"
},
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractBillableId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"billingStartAt": "2023-11-07T05:31:56Z",
"billingEndAt": "2023-11-07T05:31:56Z",
"amount": {
"value": 0,
"currencyCode": "USD"
},
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"createdAt": "<string>",
"updatedAt": "<string>"
}{
"code": "BAD_REQUEST",
"message": "Input validation failed",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Unauthorized",
"issues": []
}{
"code": "NOT_FOUND",
"message": "The record does not exist for your business.",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred.",
"issues": []
}Authorizations
An API key created in Settings, sent as Authorization: Bearer <key>.
Path Parameters
The invoice id.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Response
Successful response
A bill the entity raises for a customer for one period of a contract: what it charges, how far it has got towards being issued, and how much of it has been paid.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$The customer's name on the invoice. Issuing copies it onto the invoice, so renaming the customer later leaves an issued invoice as it was; until then it is the customer's current name.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$The invoice number, unique among the entity's invoices, voided ones included. It can change up to the moment the invoice is issued, and not after.
DRAFT: not approved yet. APPROVED: approved before periodStartAt, the day Synthetic will issue it. ISSUING: being issued; it becomes ISSUED shortly. ISSUED: issued; what it charges no longer changes. VOIDED: withdrawn before it was issued; nothing is owed on it. Until an invoice is issued, Synthetic may change or void it when the contract's terms change. Whether it has been paid is not a status: compare appliedAmount with totalAmount.
DRAFT, APPROVED, ISSUING, ISSUED, VOIDED A note for the entity's own staff. It is never printed on the invoice, and can change until the invoice is issued.
The id of the person who approved the invoice, if a person did; otherwise null.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$The person who approved the invoice, if a person did; otherwise null. Their role is their current one, not the one they had when they approved.
Show child attributes
Show child attributes
The API key that approved the invoice, if one did; otherwise null.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$When the invoice was approved; null when it has not been.
When the invoice was issued; null until it is. An invoice issued backdated carries the earlier date it was issued with, and has it already while ISSUING. An invoice not issued yet is planned to issue on periodStartAt.
When payment is due: issuedAt plus paymentTermsDays days. Null while issuedAt is.
How many days the customer has to pay once the invoice is issued, from the contract terms the invoice bills.
-9007199254740991 <= x <= 9007199254740991The calendar date the latest payment with status POSTED applied to this invoice was received, carried at UTC midnight; null when none has been applied. The time is not data.
Once payments with status POSTED cover totalAmount, the calendar date the latest of them was received, carried at UTC midnight; null while anything is owed or no payment has been applied. The time is not data.
When the invoice was voided; null unless its status is VOIDED.
The first calendar day the invoice bills for, carried at UTC midnight. The time is not data.
The calendar date the billed period ends, carried at UTC midnight: it covers the days before this date, not the date itself. The time is not data.
When Synthetic last started emailing the invoice to the customer, whether or not the email went out; null if it never has.
How the invoice reaches the customer. EMAIL: Synthetic emails it when it is issued. MANUAL: the entity sends it itself. The person who approves the invoice chooses; an invoice Synthetic issues on its own, under a contract with autoIssue on, is EMAIL. Null when no delivery method was recorded, such as an invoice that is not approved yet or one issued with a backdated date; Synthetic does not email those.
EMAIL, MANUAL The sum of the invoice's lines. Its value is a whole number of the currency's smallest unit, so { "value": 200000, "currencyCode": "USD" } is $2,000.00.
Show child attributes
Show child attributes
How much of the total payments with status POSTED have paid, a bank fee charged on one of them included.
Show child attributes
Show child attributes
How much of the total card payments with status PENDING will pay once their money arrives. It is not part of appliedAmount.
Show child attributes
Show child attributes
totalAmount less appliedAmount and pendingPaymentAmount. Payments apply only to issued invoices, so it equals totalAmount until then, and stays equal to it on a voided invoice, though nothing is owed on one.
Show child attributes
Show child attributes
Every line of the invoice when it is read by id; null in a list.
Show child attributes
Show child attributes