godo.Invoices.List()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.Invoices.List(ctx context.Context, opt *godo.ListOptions) (*godo.InvoiceList, *godo.Response, error)

Description

List invoices for a customer

This method sends a GET request to /v2/customers/my/invoices.

Parameters

opt *godo.ListOptions

Fields of godo.ListOptions

ListOptions specifies the optional parameters to various List methods that support pagination.

Page int

For paginated result sets, page of results to retrieve.

PerPage int

For paginated result sets, the number of results to include per page.

WithProjects bool

Whether App responses should include project_id fields. The field will be empty if false or if omitted. (ListApps)

Deployed bool

This parameter is used to only list agents that are deployed in the response.

PublicOnly bool

This parameter is used to include models that are publicly available.

Usecases []string

This parameter is used to include models according to the use cases.

Returns

*godo.InvoiceList
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.InvoiceList

InvoiceList contains a paginated list of all of a customer’s invoices. The InvoicePreview is the month-to-date usage generated by DigitalOcean.

Invoices []godo.InvoiceListItem

JSON key: invoices

InvoicePreview godo.InvoiceListItem

JSON key: invoice_preview

Links *godo.Links

JSON key: links

Meta *godo.Meta

JSON key: meta

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.Invoices.List(ctx, &godo.ListOptions{Page: 1, PerPage: 50})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

Response Example

Show Response Example
{
  "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
  }
}

More Information

See GET /v2/customers/my/invoices in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.