List invoices
Retrieve a paginated list of invoices.
GET
/
invoices
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const invoiceListResponse of client.invoices.list()) {
console.log(invoiceListResponse.file_id);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.invoices.list()
page = page.data[0]
print(page.file_id)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Invoices.List(context.TODO(), telnyx.InvoiceListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.invoices.InvoiceListPage;
import com.telnyx.sdk.models.invoices.InvoiceListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
InvoiceListPage page = client.invoices().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.invoices.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->invoices->list(
pageNumber: 0, pageSize: 0, sort: 'period_start'
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx invoices list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/invoices \
--header 'Authorization: Bearer <token>'{
"meta": {
"total_results": 20,
"total_pages": 1,
"page_number": 1,
"page_size": 20
},
"data": [
{
"invoice_id": "48eff763-ea80-4345-b688-78249eb165a8",
"file_id": "454ea3b0-9eaa-4fa9-992e-6d9f31c0a37e",
"period_start": "2023-11-01",
"period_end": "2023-11-30",
"paid": true,
"url": "https://api.telnyx.com:443/v2/invoices/48eff763-ea80-4345-b688-78249eb165a8"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Specifies the sort order for results.
Available options:
period_start, -period_start Example:
"period_start"
Consolidated page parameter (deepObject style). Originally: page[number], page[size]
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const invoiceListResponse of client.invoices.list()) {
console.log(invoiceListResponse.file_id);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.invoices.list()
page = page.data[0]
print(page.file_id)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Invoices.List(context.TODO(), telnyx.InvoiceListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.invoices.InvoiceListPage;
import com.telnyx.sdk.models.invoices.InvoiceListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
InvoiceListPage page = client.invoices().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.invoices.list
puts(page)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$page = $client->invoices->list(
pageNumber: 0, pageSize: 0, sort: 'period_start'
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx invoices list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/invoices \
--header 'Authorization: Bearer <token>'{
"meta": {
"total_results": 20,
"total_pages": 1,
"page_number": 1,
"page_size": 20
},
"data": [
{
"invoice_id": "48eff763-ea80-4345-b688-78249eb165a8",
"file_id": "454ea3b0-9eaa-4fa9-992e-6d9f31c0a37e",
"period_start": "2023-11-01",
"period_end": "2023-11-30",
"paid": true,
"url": "https://api.telnyx.com:443/v2/invoices/48eff763-ea80-4345-b688-78249eb165a8"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}