Skip to main content
GET
/
v2
/
invoices
/
{id}
/
lineItems
Get Line Items
curl --request GET \
  --url https://api.paygentic.io/v2/invoices/{id}/lineItems \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.paygentic.io/v2/invoices/{id}/lineItems"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.paygentic.io/v2/invoices/{id}/lineItems', 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.paygentic.io/v2/invoices/{id}/lineItems",
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://api.paygentic.io/v2/invoices/{id}/lineItems"

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://api.paygentic.io/v2/invoices/{id}/lineItems")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.paygentic.io/v2/invoices/{id}/lineItems")

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
{
  "invoiceId": "inv_r1s2t3u4v5w6x7y8",
  "lineItems": [
    {
      "eventType": "usage",
      "eventId": "usg_a1b2c3d4e5f6g7h8",
      "eventSourceId": "bm_l5m6n7o8p9q0r1s2",
      "invoiceDisplayName": "Claude Token Consumption",
      "lineItemType": "charge",
      "meterEventId": "me_x9y0z1a2b3c4d5e6",
      "metricDescription": "Language model token consumption",
      "metricName": "Token Usage",
      "metricUnit": "tokens",
      "quantity": 2500,
      "taxRate": 0.085,
      "totalAmount": "0.05425",
      "totalPrice": "0.05",
      "totalTax": "0.00425",
      "unitPrice": "0.00002"
    },
    {
      "eventType": "fee",
      "eventId": "fee_b2c3d4e5f6g7h8i9",
      "eventSourceId": "fee_h3i4j5k6l7m8n9o0",
      "invoiceDisplayName": "Platform Fee",
      "meterEventId": "",
      "metricDescription": "Monthly platform fee",
      "metricName": "Platform Fee",
      "metricUnit": "charge",
      "quantity": 1,
      "taxRate": 0.1,
      "totalAmount": "5.50",
      "totalPrice": "5.00",
      "totalTax": "0.50",
      "unitPrice": "5.00"
    }
  ],
  "nextPageToken": null,
  "totalCount": 3
}
{
"message": "The requested resource was not found",
"error": "not_found"
}
{
"message": "The requested resource was not found",
"error": "not_found"
}
{
"message": "The requested resource was not found",
"error": "not_found"
}

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

The invoice ID

Query Parameters

limit
integer
default:100

Maximum number of line items to return

Required range: 1 <= x <= 1000
pageToken
string

Token for pagination to fetch the next page of results

Response

Paginated list of invoice line items

invoiceId
string
required

The invoice ID

lineItems
object[]
required

Array of line items for this page

totalCount
integer
required

Total number of line items across all pages

nextPageToken
string | null

Token for fetching the next page, null if no more pages