Download an invoice PDF
curl --request POST \
--url https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf', 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.getlago.com/api/v2/invoices/{lago_id}/download_pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf"
req, _ := http.NewRequest("POST", 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.post("https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"number": "example",
"invoice_type": "contract",
"status": "generating",
"payment_status": "pending",
"billing_entity_code": "main",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"currency": "USD",
"issuing_date": null,
"payment_due_date": null,
"payment_overdue": false,
"purchase_order_number": "example",
"fees_amount_cents": 100,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 100,
"sub_total_including_taxes_amount_cents": 100,
"credit_notes_amount_cents": 100,
"total_amount_cents": 100,
"total_offsetted_credit_note_amount_cents": 0,
"total_paid_amount_cents": 100,
"total_due_amount_cents": 1000,
"pdf_url": "https://documents.example/invoice.pdf",
"xml_url": "https://documents.example/invoice.pdf",
"payment_dispute_lost_at": null,
"voided_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"fees": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"fee_type": "product",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "example",
"lago_contract_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "example",
"lago_product_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_code": "example",
"lago_product_category_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_category_code": "example",
"lago_product_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_filter_code": "example",
"lago_rate_card_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"rate_card_code": "example",
"lago_rate_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"rate_code": "example",
"lago_rate_override_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"event_transaction_id": "event_123",
"display_on_invoice": true,
"product_invoice_display_name": "example",
"product_category_invoice_display_name": "example",
"product_filter_invoice_display_name": "example",
"filters": {},
"billing_timing": "advance",
"grouped_by": {},
"currency": "USD",
"units": "1.5",
"total_aggregated_units": "1.5",
"events_count": 1,
"unit_amount_cents": 100,
"precise_unit_amount_cents": "1.5",
"amount_cents": 100,
"sub_total_excluding_taxes_amount_cents": 1000,
"taxes_amount_cents": 100,
"total_amount_cents": 1200,
"amount_details": {},
"pricing_unit_details": {
"lago_pricing_unit_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"pricing_unit_code": "tokens",
"short_name": "example",
"amount_cents": 100,
"precise_amount_cents": "1.5",
"unit_amount_cents": 100,
"precise_unit_amount": "1.5",
"conversion_rate": "1.5"
},
"payment_status": "pending",
"from_datetime": null,
"to_datetime": null,
"succeeded_at": null,
"failed_at": null,
"refunded_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"lago_wallet_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"wallet_code": "prepaid",
"lago_wallet_transaction_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"amount_cents": 100,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"invoice": "<unknown>",
"product": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "Example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_category_code": "compute",
"billable_metric_code": "api_requests",
"product_type": "metered",
"product_category": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"aggregation_type": "count_agg",
"weighted_interval": "seconds",
"recurring": false,
"rounding_function": "round",
"rounding_precision": 1,
"field_name": "example",
"expression": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
},
"product_filter": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_category_code": "compute",
"values": [
{
"key": "region",
"value": "eu"
}
]
},
"rate_card": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_filter_code": "eu",
"currency": "USD",
"billing_timing": "arrears",
"proration": false,
"display_on_invoice": false,
"regroup_paid_fees": "invoice",
"applied_pricing_unit_code": "example",
"active_rate": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"rates": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
],
"product": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "Example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_category_code": "compute",
"billable_metric_code": "api_requests",
"product_type": "metered",
"product_category": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"aggregation_type": "count_agg",
"weighted_interval": "seconds",
"recurring": false,
"rounding_function": "round",
"rounding_precision": 1,
"field_name": "example",
"expression": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
},
"product_filter": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_category_code": "compute",
"values": [
{
"key": "region",
"value": "eu"
}
]
}
},
"rate": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"contract": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "example",
"code": "initial",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"name": "example",
"plan_code": "standard",
"status": "pending",
"consolidate_invoice": false,
"purchase_order_number": "example",
"billing_anchor_date": null,
"effective_billing_anchor_date": null,
"skip_invoice_custom_sections": false,
"started_at": null,
"ended_at": null,
"terminated_at": null,
"canceled_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"applied_rate_cards": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
],
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"currency": "USD",
"created_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"name": "example",
"description": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
}
}
],
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"amount_cents": 100,
"fees_amount_cents": 100,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"contracts": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "example",
"code": "initial",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"name": "example",
"plan_code": "standard",
"status": "pending",
"consolidate_invoice": false,
"purchase_order_number": "example",
"billing_anchor_date": null,
"effective_billing_anchor_date": null,
"skip_invoice_custom_sections": false,
"started_at": null,
"ended_at": null,
"terminated_at": null,
"canceled_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"applied_rate_cards": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
],
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"currency": "USD",
"created_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"name": "example",
"description": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
}
],
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "not_provided",
"details": {},
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}Invoices
Download a PDF
For finalized invoices only.
POST
/
invoices
/
{lago_id}
/
download_pdf
Download an invoice PDF
curl --request POST \
--url https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf', 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.getlago.com/api/v2/invoices/{lago_id}/download_pdf",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf"
req, _ := http.NewRequest("POST", 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.post("https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/invoices/{lago_id}/download_pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"invoice": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"number": "example",
"invoice_type": "contract",
"status": "generating",
"payment_status": "pending",
"billing_entity_code": "main",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"currency": "USD",
"issuing_date": null,
"payment_due_date": null,
"payment_overdue": false,
"purchase_order_number": "example",
"fees_amount_cents": 100,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 100,
"sub_total_including_taxes_amount_cents": 100,
"credit_notes_amount_cents": 100,
"total_amount_cents": 100,
"total_offsetted_credit_note_amount_cents": 0,
"total_paid_amount_cents": 100,
"total_due_amount_cents": 1000,
"pdf_url": "https://documents.example/invoice.pdf",
"xml_url": "https://documents.example/invoice.pdf",
"payment_dispute_lost_at": null,
"voided_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"fees": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"fee_type": "product",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "example",
"lago_contract_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "example",
"lago_product_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_code": "example",
"lago_product_category_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_category_code": "example",
"lago_product_filter_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"product_filter_code": "example",
"lago_rate_card_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"rate_card_code": "example",
"lago_rate_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"rate_code": "example",
"lago_rate_override_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_parent_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_true_up_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"event_transaction_id": "event_123",
"display_on_invoice": true,
"product_invoice_display_name": "example",
"product_category_invoice_display_name": "example",
"product_filter_invoice_display_name": "example",
"filters": {},
"billing_timing": "advance",
"grouped_by": {},
"currency": "USD",
"units": "1.5",
"total_aggregated_units": "1.5",
"events_count": 1,
"unit_amount_cents": 100,
"precise_unit_amount_cents": "1.5",
"amount_cents": 100,
"sub_total_excluding_taxes_amount_cents": 1000,
"taxes_amount_cents": 100,
"total_amount_cents": 1200,
"amount_details": {},
"pricing_unit_details": {
"lago_pricing_unit_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"pricing_unit_code": "tokens",
"short_name": "example",
"amount_cents": 100,
"precise_amount_cents": "1.5",
"unit_amount_cents": 100,
"precise_unit_amount": "1.5",
"conversion_rate": "1.5"
},
"payment_status": "pending",
"from_datetime": null,
"to_datetime": null,
"succeeded_at": null,
"failed_at": null,
"refunded_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"lago_wallet_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"wallet_code": "prepaid",
"lago_wallet_transaction_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_fee_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"amount_cents": 100,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"invoice": "<unknown>",
"product": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "Example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_category_code": "compute",
"billable_metric_code": "api_requests",
"product_type": "metered",
"product_category": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"aggregation_type": "count_agg",
"weighted_interval": "seconds",
"recurring": false,
"rounding_function": "round",
"rounding_precision": 1,
"field_name": "example",
"expression": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
},
"product_filter": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_category_code": "compute",
"values": [
{
"key": "region",
"value": "eu"
}
]
},
"rate_card": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_filter_code": "eu",
"currency": "USD",
"billing_timing": "arrears",
"proration": false,
"display_on_invoice": false,
"regroup_paid_fees": "invoice",
"applied_pricing_unit_code": "example",
"active_rate": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"rates": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
],
"product": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "Example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_category_code": "compute",
"billable_metric_code": "api_requests",
"product_type": "metered",
"product_category": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"billable_metric": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"aggregation_type": "count_agg",
"weighted_interval": "seconds",
"recurring": false,
"rounding_function": "round",
"rounding_precision": 1,
"field_name": "example",
"expression": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
},
"product_filter": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"product_code": "api_requests",
"product_category_code": "compute",
"values": [
{
"key": "region",
"value": "eu"
}
]
}
},
"rate": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"rate_card_code": "compute_usd",
"status": "pending",
"rate_model": "standard",
"rate_properties": {
"amount": "1.5",
"free_units": 0,
"package_size": 100,
"rate": "1.5",
"fixed_amount": "1.5",
"free_units_per_events": 0,
"free_units_per_total_aggregation": "1.5",
"per_transaction_min_amount": "1.5",
"per_transaction_max_amount": "1.5",
"graduated_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"volume_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
],
"graduated_percentage_ranges": [
{
"to_value": null,
"flat_amount": "1.5",
"per_unit_amount": "1.5",
"rate": "1.5"
}
]
},
"min_amount_cents": 100,
"billing_interval_count": 1,
"billing_interval_unit": "day",
"applied_pricing_unit_conversion_rate": "1.5",
"effective_from": "2022-04-29T08:59:51.123456Z",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
},
"contract": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "example",
"code": "initial",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"name": "example",
"plan_code": "standard",
"status": "pending",
"consolidate_invoice": false,
"purchase_order_number": "example",
"billing_anchor_date": null,
"effective_billing_anchor_date": null,
"skip_invoice_custom_sections": false,
"started_at": null,
"ended_at": null,
"terminated_at": null,
"canceled_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"applied_rate_cards": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
],
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"currency": "USD",
"created_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"name": "example",
"description": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
}
}
],
"applied_taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_tax_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"tax_name": "example",
"tax_code": "example",
"tax_rate": 20,
"tax_description": "example",
"amount_cents": 100,
"fees_amount_cents": 100,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"contracts": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_id": "example",
"code": "initial",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"name": "example",
"plan_code": "standard",
"status": "pending",
"consolidate_invoice": false,
"purchase_order_number": "example",
"billing_anchor_date": null,
"effective_billing_anchor_date": null,
"skip_invoice_custom_sections": false,
"started_at": null,
"ended_at": null,
"terminated_at": null,
"canceled_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"applied_rate_cards": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_contract_id": "contract_123",
"rate_card_code": "compute_usd",
"product_code": "api_requests",
"product_filter_code": "eu",
"units": "1.5",
"effective_date": "2022-04-29",
"billing_anchor_date": "2022-04-29",
"next_billing_at": null,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"billing_scope": "cycle"
}
],
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "example",
"code": "example",
"description": "example",
"invoice_display_name": "example",
"currency": "USD",
"created_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
]
},
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"x402_agent_address": "0x0000000000000000000000000000000000000000"
},
"invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"name": "example",
"description": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
}
],
"applied_invoice_custom_sections": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_invoice_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "example",
"details": "example",
"display_name": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"error_details": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"error_code": "not_provided",
"details": {},
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.