# Retrieve an invoice

Source: https://developers.swell.is/backend-api/invoices/retrieve-an-invoice

Retrieve an existing invoice using the ID that was returned when created.

## Arguments

- `id` (objectId, required): ID of the invoice to retrieve.
- `expand` (string): Expanding link fields and child collections is performed using the expand argument.

  - For example, `expand=account` would return a related customer account if one exists.

  When the field represents a collection, you can specify the query limit.

  - For example, `expand=variants:10` would return up to 10 records of the variants collection.

  See [expanding](https://developers.swell.is/backend-api/querying/expanding) for more details.
- `fields` (string): Return only the specified fields in the result. For example `fields=name,slug` would return only the fields `name` and `slug` in the response. Supports nested object and array fields using dot-notation. For example, `items.product_id`. The gift card `id` is always returned.
- `include` (string): Include one or more arbitrary queries in the response, possibly related to the main query.

  See [including ](https://developers.swell.is/backend-api/querying/including)for more details.

## Example request

`GET /invoices/:id`

**cURL**

```bash
$ curl https://api.swell.store/invoices/60f199509111e70000000037 \
  -u store-id:secret-key
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.get('/invoices/{id}', {
  id: '60f199509111e70000000037'
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->get('/invoices/{id}', [
  'id' => '60f199509111e70000000037'
]);
```

## Example response

```json
{
  "id": "60f199509111e70000000037",
  "account_id": "60f199509111e70000000038",
  "currency": "USD",
  "date_created": "2021-07-16T14:36:00.194Z",
  "date_updated": "2021-07-16T14:36:00.194Z",
  "items": [
    {
      "id": "5ca537326a0ec32a521139dd",
      "product_id": "5c524166f4e8f3446a10331b",
      "variant_id": "5c524166f4e8f3446a10331f",
      "quantity": 2,
      "price": 19.99,
      "price_total": 38.98,
      "orig_price": 19.99,
      "options": [
        {
          "id": "5becb84fac207653a4816ee5",
          "name": "Size",
          "value": "Small"
        },
        {
          "id": "5becb84fac207653a4816ee6",
          "name": "Color",
          "value": "Yellow"
        }
      ],
      "discounts": [
        {
          "id": "coupon-0",
          "amount": 5
        }
      ],
      "discount_each": 2.5,
      "discount_total": 5,
      "taxes": [
        {
          "id": "sales-tax",
          "amount": 2
        }
      ],
      "tax_each": 1,
      "tax_total": 2
    }
  ],
  "number": 117266,
  "paid": false,
  "pastdue": false,
  "status": "pending"
}
```
