> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.afternoon.co/llms.txt.
> For full documentation content, see https://docs.afternoon.co/llms-full.txt.

# List invoices

GET https://api.afternoon.co/v1/invoices

Returns a paginated list of invoices. Supports optional customer_id, and status filters.

Reference: https://docs.afternoon.co/api-reference/afternoon-events-api/invoices/list

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Afternoon Events API
  version: 1.0.0
paths:
  /v1/invoices:
    get:
      operationId: list
      summary: List invoices
      description: >-
        Returns a paginated list of invoices. Supports optional customer_id, and
        status filters.
      tags:
        - subpackage_invoices
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: string
            default: '50'
        - name: cursor
          in: query
          required: false
          schema:
            type: string
        - name: customer_id
          in: query
          required: false
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/V1InvoicesGetParametersStatus'
        - name: Authorization
          in: header
          description: API key obtained from the Afternoon dashboard
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Invoices list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceListResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
servers:
  - url: https://api.afternoon.co
  - url: http://localhost:8787
components:
  schemas:
    V1InvoicesGetParametersStatus:
      type: string
      enum:
        - draft
        - open
        - paid
        - void
        - uncollectible
      description: Filter by invoice status
      title: V1InvoicesGetParametersStatus
    InvoiceStatus:
      type: string
      enum:
        - draft
        - open
        - paid
        - void
        - uncollectible
      title: InvoiceStatus
    InvoiceCollectionMethod:
      type: string
      enum:
        - charge_automatically
        - send_invoice
      title: InvoiceCollectionMethod
    InvoiceLineItem:
      type: object
      properties:
        id:
          type: string
        description:
          type:
            - string
            - 'null'
        quantity:
          type: integer
        unit_amount_cents:
          type: integer
        tax_amount_cents:
          type: integer
        total_amount_cents:
          type: integer
        period_start:
          type:
            - string
            - 'null'
        period_end:
          type:
            - string
            - 'null'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - description
        - quantity
        - unit_amount_cents
        - tax_amount_cents
        - total_amount_cents
        - period_start
        - period_end
        - created_at
        - updated_at
      title: InvoiceLineItem
    Invoice:
      type: object
      properties:
        id:
          type: string
        customer_id:
          type:
            - string
            - 'null'
        subscription_id:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        currency:
          type: string
        collection_method:
          $ref: '#/components/schemas/InvoiceCollectionMethod'
        invoice_number:
          type:
            - string
            - 'null'
        public_invoice_url:
          type:
            - string
            - 'null'
        due_date:
          type:
            - string
            - 'null'
        days_until_due:
          type:
            - integer
            - 'null'
        description:
          type:
            - string
            - 'null'
        customer_memo:
          type:
            - string
            - 'null'
        footer:
          type:
            - string
            - 'null'
        subtotal_cents:
          type: integer
        discount_cents:
          type: integer
        tax_cents:
          type: integer
        total_cents:
          type: integer
        finalized_at:
          type:
            - string
            - 'null'
        paid_at:
          type:
            - string
            - 'null'
        period_start:
          type:
            - string
            - 'null'
        period_end:
          type:
            - string
            - 'null'
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceLineItem'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - customer_id
        - subscription_id
        - status
        - currency
        - collection_method
        - invoice_number
        - public_invoice_url
        - due_date
        - days_until_due
        - description
        - customer_memo
        - footer
        - subtotal_cents
        - discount_cents
        - tax_cents
        - total_cents
        - finalized_at
        - paid_at
        - period_start
        - period_end
        - line_items
        - created_at
        - updated_at
      title: Invoice
    InvoiceListResponsePagination:
      type: object
      properties:
        has_more:
          type: boolean
          description: Whether there are more items after this page
        next_cursor:
          type:
            - string
            - 'null'
          description: Cursor to use for the next page, or null if no more items
      required:
        - has_more
        - next_cursor
      title: InvoiceListResponsePagination
    InvoiceListResponse:
      type: object
      properties:
        success:
          type: boolean
        invoices:
          type: array
          items:
            $ref: '#/components/schemas/Invoice'
        pagination:
          $ref: '#/components/schemas/InvoiceListResponsePagination'
        request_id:
          type: string
      required:
        - success
        - invoices
        - pagination
        - request_id
      title: InvoiceListResponse
    ErrorResponseError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          oneOf:
            - description: Any type
            - type: 'null'
      required:
        - code
        - message
      title: ErrorResponseError
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
        error:
          $ref: '#/components/schemas/ErrorResponseError'
        request_id:
          type: string
          description: Request ID for tracing
      required:
        - success
        - error
      title: ErrorResponse
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key obtained from the Afternoon dashboard

```

## SDK Code Examples

```typescript
import { AfternoonClient } from "afternoon-sdk";

async function main() {
    const client = new AfternoonClient({
        token: "YOUR_TOKEN_HERE",
    });
    await client.invoices.list({});
}
main();

```

```python
import requests

url = "https://api.afternoon.co/v1/invoices"

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

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

print(response.json())
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.afternoon.co/v1/invoices"

	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(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.afternoon.co/v1/invoices")

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
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.afternoon.co/v1/invoices")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.afternoon.co/v1/invoices', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.afternoon.co/v1/invoices");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.afternoon.co/v1/invoices")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```