# Retrieve an invoice

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Retrieve the invoice for the specified invoice id.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/invoices/__demo_inv__17 \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Invoice.Retrieve("__demo_inv__17").Request();

Invoice invoice = result.Invoice;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    invoiceAction "github.com/chargebee/chargebee-go/v3/actions/invoice"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := invoiceAction.Retrieve("__demo_inv__17", nil).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Invoice := res.Invoice
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.InvoiceRetrieveRequest{}
  res, err := client.Invoice.Retrieve("__demo_inv__17", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Invoice := res.Invoice
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Invoice.retrieve("__demo_inv__17").request();

        Invoice invoice = result.invoice();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.invoice.Invoice;
import com.chargebee.v4.models.invoice.params.InvoiceRetrieveParams;
import com.chargebee.v4.models.invoice.responses.InvoiceRetrieveResponse;

public class InvoiceRetrieve {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        InvoiceRetrieveResponse response = client.invoices().retrieve("__demo_inv__17");

        Invoice invoice = response.getInvoice();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.invoice.retrieve("__demo_inv__17");

    console.log(result);
    const invoice = result.invoice;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->invoice()->retrieve("__demo_inv__17");
$invoice = $result->invoice;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Invoice.retrieve("__demo_inv__17")
invoice = response.invoice
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Invoice.retrieve("__demo_inv__17")

invoice = result.invoice
```

## Sample Response

```json
{
  "invoice": {
    "adjustment_credit_notes": {},
    "amount_adjusted": 0,
    "amount_due": 0,
    "amount_paid": 500,
    "amount_to_collect": 0,
    "applied_credits": {},
    "base_currency_code": "USD",
    "billing_address": {
      "first_name": "Duncan",
      "last_name": "Walpole",
      "object": "billing_address",
      "validation_status": "not_validated"
    },
    "credits_applied": 0,
    "currency_code": "USD",
    "customer_id": "__test__8asyKSOcTKve4P",
    "date": 1517490277,
    "deleted": false,
    "due_date": 1517490277,
    "dunning_attempts": {},
    "exchange_rate": 1,
    "exchange_rates": [
      {
        "currency_code": "EUR",
        "rate": 1.154
      },
      {..}
    ],
    "first_invoice": true,
    "has_advance_charges": false,
    "id": "__demo_inv__17",
    "is_gifted": false,
    "issued_credit_notes": {},
    "line_items": [
      {
        "amount": 500,
        "customer_id": "__test__8asyKSOcTKve4P",
        "date_from": 1517490277,
        "date_to": 1517490277,
        "description": "SSL Charge USD Monthly",
        "discount_amount": 0,
        "entity_id": "ssl-charge-USD",
        "entity_type": "charge_item_price",
        "id": "li___test__8asyKSOcTL0N4X",
        "is_taxed": false,
        "item_level_discount_amount": 0,
        "object": "line_item",
        "pricing_model": "flat_fee",
        "quantity": 1,
        "tax_amount": 0,
        "tax_exempt_reason": "tax_not_configured",
        "unit_amount": 500
      },
      {..}
    ],
    "linked_orders": {},
    "linked_payments": [
      {
        "applied_amount": 500,
        "applied_at": 1517490277,
        "txn_amount": 500,
        "txn_date": 1517490277,
        "txn_id": "txn___test__8asyKSOcTL3o4Y",
        "txn_status": "success"
      },
      {..}
    ],
    "net_term_days": 0,
    "new_sales_amount": 500,
    "object": "invoice",
    "paid_at": 1517490277,
    "price_type": "tax_exclusive",
    "recurring": false,
    "resource_version": 1517490277579,
    "round_off_amount": 0,
    "status": "paid",
    "sub_total": 500,
    "tax": 0,
    "term_finalized": true,
    "total": 500,
    "updated_at": 1517490277,
    "write_off_amount": 0
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/invoices/{invoice-id}

## Input Parameters

- `line_items_limit` (optional, integer, default=100, min=1, max=300)
  Specify the maximum number of line items to include in the response.
  
  **Note:**
  
  -   Applicable only when Enterprise-scale Invoicing is enabled.
  -   Enterprise-scale Invoicing is currently in **Private Beta**. Please reach out to [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to enable this feature.

- `line_items_offset` (optional, string, max chars=1000)
  Specify the starting point for retrieving line items. Use the value from the `line_items_next_offset` attribute of the previous retrieve API response.
  
  **Note:**
  
  -   Applicable only when Enterprise-scale Invoicing is enabled.
  -   Enterprise-scale Invoicing is currently in **Private Beta**. Please reach out to [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to enable this feature.

## Returns

- `invoice` (Invoice object)
  Resource object representing invoice
