Skip to main content
GET
/
api
/
v2
/
platform
/
organisation
/
billing
Get Billing Data
curl --request GET \
  --url http://localhost:3001/api/v2/platform/organisation/billing/ \
  --header 'Authorization: <api-key>' \
  --header 'Org-Handle: <org-handle>'
{
  "count": 12,
  "status_code": 200,
  "message": "Billing data fetched successfully",
  "results": [
    {
      "id": 101,
      "amount": "299.00",
      "currency": "USD",
      "status": "paid",
      "invoice_date": "2026-02-01T00:00:00Z"
    }
  ]
}
{
  "count": 12,
  "status_code": 200,
  "message": "Billing data fetched successfully",
  "results": [
    {
      "id": 101,
      "amount": "299.00",
      "currency": "USD",
      "status": "paid",
      "invoice_date": "2026-02-01T00:00:00Z"
    }
  ]
}

Get Billing Data

Retrieve invoices and payment history for your organization with pagination support. This endpoint returns billing records including invoice amounts, currency, payment status, and invoice dates.
Prerequisites: Make sure you have your API Token and Org-Handle ready. See Authentication for details.

Headers

NameTypeRequiredDescription
AuthorizationstringYesAPI Key format: Token <token>
Org-HandlestringYesOrganization domain handle
You can get the Org-Handle by hitting the Get All Organizations API. The domain_handle field in the response is your Org-Handle.

Query Parameters

NameTypeRequiredDescription
pageintegerNoPage number for pagination (default = 1)
page_sizeintegerNoNumber of records per page (default = 20)

Response Fields

FieldTypeDescription
countintegerTotal number of billing records
status_codeintegerHTTP status code
messagestringResponse message
resultsarrayArray of invoice/billing objects

Invoice Object Fields

FieldTypeDescription
idintegerUnique invoice identifier
amountstringInvoice amount as decimal string
currencystringCurrency code (e.g., USD, INR)
statusstringPayment status: paid, pending, failed
invoice_datestringInvoice creation date (ISO 8601)

Common Error Codes

Status CodeDescription
200Success - Billing data fetched successfully
400Bad Request - Invalid parameters provided
401Unauthorized - Invalid or missing API token
403Forbidden - Invalid organization handle
404Not Found - Organization not found
500Internal Server Error - Server-side error

Code Examples

const axios = require('axios');

const headers = {
  'Authorization': 'Token your-api-token',
  'Org-Handle': 'your-org-handle'
};

// Get billing data with pagination
const getBillingData = async (page = 1, pageSize = 20) => {
  const response = await axios.get(
    'https://unpod.dev/api/v2/platform/organisation/billing/',
    {
      headers,
      params: { page, page_size: pageSize }
    }
  );
  console.log(`Total invoices: ${response.data.count}`);
  response.data.results.forEach(invoice => {
    console.log(`Invoice #${invoice.id}: ${invoice.currency} ${invoice.amount} - ${invoice.status}`);
  });
  return response.data.results;
};

// Example usage
getBillingData(1, 20);

Best Practices

  1. Pagination: Use page and page_size to retrieve billing records in manageable chunks
  2. Status Monitoring: Watch for pending or failed invoice statuses that may require action
  3. Currency Handling: Always check the currency field before displaying amounts to users
  4. Org-Handle: Ensure the correct organization handle is used for accurate billing records
  5. Reconciliation: Use invoice_date alongside id for billing reconciliation workflows
  6. Security: Keep API tokens secure and rotate them regularly

Authorizations

Authorization
string
header
required

Format: Token

Headers

Org-Handle
string
required

Organization domain handle

Example:

"unpod"

Query Parameters

page
integer
Example:

1

page_size
integer
Example:

10

Response

Billing data