Get all invoices
Route
GET
/api/v1/invoices?page=2&per_page=20&external_customer_id=hooli_1234
Usage
- Curl
- Python
- Ruby
- Javascript
- Go
- C#
- PHP
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/invoices?page=2&per_page=20&external_customer_id=hooli_1234" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.invoices.find_all({'per_page': 2, 'page': 1})
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new({api_key: '__YOUR_API_KEY__'})
client.invoices.get_all({ per_page: 2, page: 3 })
await client.invoices.findAllInvoices({ perPage: 2, page: 3 });
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
invoiceListInput := &lago.InvoiceListInput{
PerPage: 1,
Page: 1,
IssuingDateFrom: "2022-01-01",
IssuingDateTo: "2022-01-01",
}
invoiceResult, err := lagoClient.Invoice().GetList(invoiceListInput)
if err != nil {
// Error is *lago.Error
panic(err)
}
// invoiceResult is *lago.InvoiceResult
fmt.Println(invoiceResult)
}
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class FindAllInvoicesExample
{
public static void Main()
{
Configuration.Default.BasePath = "https://api.getlago.com/api/v1";
// Configure HTTP bearer authorization: bearerAuth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new InvoicesApi(Configuration.Default);
var page = 2; // int? | Number of page (optional)
var perPage = 20; // int? | Number of records per page (optional)
var externalCustomerId = "12345"; // string | External customer ID (optional)
var issuingDateFrom = 2022-07-08; // string | Date from (optional)
var issuingDateTo = 2022-08-09; // string | Date to (optional)
var status = draft; // string | Status (draft or finalized) (optional)
try
{
// Find all invoices
Invoices result = apiInstance.FindAllInvoices(page, perPage, externalCustomerId, issuingDateFrom, issuingDateTo, status);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling InvoicesApi.FindAllInvoices: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: bearerAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new OpenAPI\Client\Api\InvoicesApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$page = 2; // int | Number of page
$per_page = 20; // int | Number of records per page
$external_customer_id = "12345"; // string | External customer ID
$issuing_date_from = 2022-07-08; // string | Date from
$issuing_date_to = 2022-08-09; // string | Date to
$status = "draft"; // string | Status (draft or finalized)
try {
$result = $apiInstance->findAllInvoices($page, $per_page, $external_customer_id, $issuing_date_from, $issuing_date_to, $status);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling InvoicesApi->findAllInvoices: ', $e->getMessage(), PHP_EOL;
}
Arguments
Attributes | Type | Description |
---|---|---|
per_page | String Optional | Number of records per page. |
page | String Optional | Page number |
issuing_date_from | String Optional | Filter results by FROM date. Format example: 2022-02-15 |
issuing_date_to | String Optional | Filter results by TO date. Format example: 2022-02-15 |
external_customer_id | String Optional | Filter results by CUSTOMER unique identifier in your application |
status | String Optional | Filter results by status (draft or finalized ) |
payment_status | String Optional | Filter results by payment status (pending , failed or succeeded ) |
Responses
- HTTP 200
- HTTP 401
Invoices were successfully found.
Returns a list of invoice objects.
{
"status": 401,
"error": "Unauthorized"
}
Access to the API endpoint is unhautorized.
Possible reasons are:
- The
Authorization
header is missing - The
Authorization
header does not contain the API key - The Api key is invalid or expired