# v0/billing/invoices REST API Endpoint

#### Returns a list of invoices

### Parameters

This method does not accept any parameters

### Returns

data

object

The data object which contains the following fields:

- invoices
  - array
    - An array of invoices
  - id
    - string
      - The unique identifier for the invoice
  - status
    - string
      - The current state of the invoice
  - billing_reason
    - string
      - The reason for generating the invoice
  - amount_due
    - integer
      - The total amount that is due on the invoice
  - amount_paid
    - integer
      - The total amount that has been paid for the invoice
  - subtotal
    - integer
      - The total cost of the invoice
  - lines
    - array
      - An array of lines which contains the following fields:
        - description
          - string
            - A detailed description of each line item billed
        - amount
          - integer
            - The cost associated with each line item
        - period_end
          - integer
            - The end timestamp of the billing period for the invoice in second
        - period_start
          - integer
            - The start timestamp of the billing period for the invoice in second
        - created
          - integer
            - The timestamp when the invoice was created in second
        - error
          - string
            - An error message if any issue occurs

### Request

#### Curl Example

```bash
curl -X 'GET' \
  'https://api.quicknode.com/v0/billing/invoices' \
  -H 'accept: application/json' \
  -H 'x-api-key: YOUR_API_KEY'
```

#### JavaScript Example

```javascript
const myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://api.quicknode.com/v0/billing/invoices", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

#### Python Example

```python
import requests

url = "https://api.quicknode.com/v0/billing/invoices"

payload = {}
headers = {
  'accept': 'application/json',
  'x-api-key': 'YOUR_API_KEY'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

#### Ruby Example

```ruby
require "uri"
require "net/http"

url = URI("https://api.quicknode.com/v0/billing/invoices")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["x-api-key"] = "YOUR_API_KEY"

response = https.request(request)
puts response.read_body
```

#### Rust Example

```rust
use quicknode_sdk::{QuicknodeSdk, SdkFullConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let qn = QuicknodeSdk::new(&SdkFullConfig::builder().api_key("YOUR_API_KEY").build())?;
    let response = qn.admin.list_invoices().await?;

println!("{:?}", response);
    Ok(())
}
```
