pydo.invoices.list()

Description

To retrieve a list of all invoices, send a GET request to /v2/customers/my/invoices.

Parameters

Name Type Required Description Default Value
per_page integer False Number of items returned per page 20
page integer False Which ‘page’ of paginated results to return. 1

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

balance = client.invoices.list()

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

The response will be a JSON object contains that contains a list of invoices under the invoices key, and the invoice preview under the invoice_preview key. Each element contains the invoice summary attributes.

Click to expand an example response.
{
  "invoices": [
    {
      "invoice_uuid": "22737513-0ea7-4206-8ceb-98a575af7681",
      "invoice_id": "12345678",
      "amount": "12.34",
      "invoice_period": "2019-12"
    },
    {
      "invoice_uuid": "fdabb512-6faf-443c-ba2e-665452332a9e",
      "invoice_id": "23456789",
      "amount": "23.45",
      "invoice_period": "2019-11"
    }
  ],
  "invoice_preview": {
    "invoice_uuid": "1afe95e6-0958-4eb0-8d9a-9c5060d3ef03",
    "invoice_id": "34567890",
    "amount": "34.56",
    "invoice_period": "2020-02",
    "updated_at": "2020-02-23T06:31:50Z"
  },
  "links": {
    "pages": {
      "next": "https://api.digitalocean.com/v2/customers/my/invoices?page=2&per_page=2",
      "last": "https://api.digitalocean.com/v2/customers/my/invoices?page=35&per_page=2"
    }
  },
  "meta": {
    "total": 70
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}