> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch All Invoices

> Fetch the details of all Invoices using this endpoint.

Available in
🇮🇳 India
🇲🇾 Malaysia
🇸🇬 Singapore
🇺🇸 United States

Use this endpoint to retrieve the details of all invoices.

```bash Curl theme={null}
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X GET https://api.razorpay.com/v1/invoices/
```

```java Java theme={null}
RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

List<Invoice> invoice = razorpay.invoices.fetchAll();
```

```python Python theme={null}
import razorpay
client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

client.invoice.all()
```

```go Go theme={null}
import ( razorpay "github.com/razorpay/razorpay-go" )
client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

option := map[string]interface{}{
    "count" : 1,
}
body, err := client.Invoice.All(option, nil)
```

```ruby Ruby theme={null}
require "razorpay"
Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')

Razorpay::Invoice.all(options)
```

```php PHP theme={null}
$api = new Api($key_id, $secret);

$api->invoice->all();
```

```javascript Node.js theme={null}
var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

instance.invoices.all()
```

```csharp .NET theme={null}
RazorpayClient client = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

List<Invoice> invoice = client.Invoice.All();
```

```bash CLI theme={null}
razorpay invoices list --type invoice --customer-id cust_ABC123
```

```json Success theme={null}
{
  "entity": "collection",
  "count": 2,
  "items": [
    {
      "id": "inv_DAweOiQ7amIUVd",
      "entity": "invoice",
      "receipt": "#0961",
      "invoice_number": "#0961",
      "customer_id": "cust_DAtUWmvpktokrT",
      "customer_details": {
        "id": "cust_DAtUWmvpktokrT",
        "name": "<name>",
        "email": "<email>",
        "contact": "<phone>",
        "gstin": null,
        "billing_address": {
          "id": "addr_DAtUWoxgu91obl",
          "type": "billing_address",
          "primary": true,
          "line1": "Bakers Street",
          "line2": "Country Road",
          "zipcode": "400092",
          "city": "Mumbai",
          "state": "Maharashtra",
          "country": "in"
        },
        "shipping_address": null,
        "customer_name": "<name>",
        "customer_email": "<email>",
        "customer_contact": "<phone>"
      },
      "order_id": null,
      "line_items": [
        {
          "id": "li_DAweOizsysoJU6",
          "item_id": null,
          "name": "Book / English August - Updated name and quantity",
          "description": "150 points in Quidditch",
          "amount": 400,
          "unit_amount": 400,
          "gross_amount": 400,
          "tax_amount": 0,
          "taxable_amount": 400,
          "net_amount": 400,
          "currency": "MYR",
          "type": "invoice",
          "tax_inclusive": false,
          "hsn_code": null,
          "sac_code": null,
          "tax_rate": null,
          "unit": null,
          "quantity": 1,
          "taxes": []
        },
        {
          "id": "li_DAwjWQUo07lnjF",
          "item_id": null,
          "name": "Book / A Wild Sheep Chase",
          "description": null,
          "amount": 200,
          "unit_amount": 200,
          "gross_amount": 200,
          "tax_amount": 0,
          "taxable_amount": 200,
          "net_amount": 200,
          "currency": "MYR",
          "type": "invoice",
          "tax_inclusive": false,
          "hsn_code": null,
          "sac_code": null,
          "tax_rate": null,
          "unit": null,
          "quantity": 1,
          "taxes": []
        }
      ],
      "payment_id": null,
      "status": "draft",
      "expire_by": 1567103399,
      "issued_at": null,
      "paid_at": null,
      "cancelled_at": null,
      "expired_at": null,
      "sms_status": null,
      "email_status": null,
      "date": 1566891149,
      "terms": null,
      "partial_payment": false,
      "gross_amount": 600,
      "tax_amount": 0,
      "taxable_amount": 600,
      "amount": 600,
      "amount_paid": null,
      "amount_due": null,
      "currency": "MYR",
      "currency_symbol": "<currency_symbol>",
      "description": "This is a test invoice.",
      "notes": {
        "updated-key": "An updated note."
      },
      "comment": null,
      "short_url": null,
      "view_less": true,
      "billing_start": null,
      "billing_end": null,
      "type": "invoice",
      "group_taxes_discounts": false,
      "created_at": 1566906474,
      "idempotency_key": null
    },
    {
      "id": "inv_DAul2TA6zodukS",
      "entity": "invoice",
      "receipt": null,
      "invoice_number": null,
      "customer_id": "cust_DAuFux32LnIsqJ",
      "customer_details": {
        "id": "cust_DAuFux32LnIsqJ",
        "name": "<name>",
        "email": "<email>",
        "contact": "<phone>",
        "gstin": null,
        "billing_address": {
          "id": "addr_DAuFuz499I5mgk",
          "type": "billing_address",
          "primary": true,
          "line1": "L-16, The Business Centre,",
          "line2": "61, Wellfield Road",
          "zipcode": "110001",
          "city": "New Delhi",
          "state": "Delhi",
          "country": "in"
        },
        "shipping_address": null,
        "customer_name": "<name>",
        "customer_email": "<email>",
        "customer_contact": "<phone>"
      },
      "order_id": "order_DAul2V0vnGXIML",
      "line_items": [
        {
          "id": "li_DAul2TuV4fhwd3",
          "item_id": "item_DAqThJ7v09UO3n",
          "name": "Magic Beans",
          "description": "Beans that make you go kaput!",
          "amount": 2000,
          "unit_amount": 2000,
          "gross_amount": 2000,
          "tax_amount": 0,
          "taxable_amount": 2000,
          "net_amount": 2000,
          "currency": "MYR",
          "type": "invoice",
          "tax_inclusive": false,
          "hsn_code": null,
          "sac_code": null,
          "tax_rate": null,
          "unit": null,
          "quantity": 1,
          "taxes": []
        }
      ],
      "payment_id": null,
      "status": "cancelled",
      "expire_by": null,
      "issued_at": 1566899808,
      "paid_at": null,
      "cancelled_at": 1566973122,
      "expired_at": null,
      "sms_status": "sent",
      "email_status": "sent",
      "date": 1566994898,
      "terms": "Updated terms and conditions for Acme Corp",
      "partial_payment": false,
      "gross_amount": 2000,
      "tax_amount": 0,
      "taxable_amount": 2000,
      "amount": 2000,
      "amount_paid": 0,
      "amount_due": 2000,
      "currency": "MYR",
      "description": null,
      "notes": [],
      "comment": "Updated comment on the Invoice",
      "short_url": "https://rzp.io/i/F7EPd9Q",
      "view_less": true,
      "billing_start": null,
      "billing_end": null,
      "type": "invoice",
      "group_taxes_discounts": false,
      "created_at": 1566899808,
      "idempotency_key": null
    }
  ]
}
```

```json Failure theme={null}
{
  "error": {
    "code": "BAD_REQUEST_ERROR",
    "description": "The api key provided is invalid",
    "source": "NA",
    "step": "NA",
    "reason": "NA",
    "metadata": {}
  }
}
```

## Query Parameters

**type** `string`

Here, it is `invoice`.

**payment\_id** `string`

The unique identifier of the payment made by the customer against the invoice.

**receipt** `string`

The unique receipt number that you entered for internal purposes.

**customer\_id** `string`

The unique identifier of the customer. When used, fetches all invoices generated for a customer.

## Response Parameters

**id** `string`

The unique identifier of the invoice.

**entity** `string`

Indicates the type of entity. Here, it is `invoice`.

**type** `string`

Here, it should be `invoice`.

**invoice\_number** `string`

Unique number you added for internal reference. The minimum character length is 1 and maximum is 40.

**customer\_id** `string`

The unique identifier of the customer. You can create `customer_id` using the [Customers API](https://razorpay.com/docs/my/api/customers.md). Alternatively, you can pass the customer object described in the below fields.

**customer\_details** `object`

Details of the customer.

**id** `string`

Unique identifier of the customer. For example, `cust_1Aa00000000004`.

**name** `string`

Customer's name. Alphanumeric, with period (.), apostrophe (') and parentheses allowed. The name must be between 3-50 characters in length. For example, `Gaurav Kumar`.

**email** `string`

The customer's email address. A maximum length of 64 characters. For example, `gaurav.kumar@example.com`.

**contact** `string`

The customer's phone number. A maximum length of 15 characters including country code. For example, `+919876543210`.

**billing\_address** `object`

Details of the customer's billing address.

**id** `string`

The unique identifier generated for the customer's billing address.

**type** `string`

The customer address type. Here it is `billing_address`.

**primary** `boolean`

Defines if this is the primary address.

* `true`: It is the customer's primary address.
* `false`: It is not the customer's primary address.

**line1** `string`

The first line of the customer's address.

**line2** `string`

The second line of the customer's address.

**city** `string`

The city.

**zipcode** `string`

The zipcode.

**state** `string`

The state.

**country** `string`

The country.

**shipping\_address** `object`

Details of the customer's shipping address.

**id** `string`

The unique identifier generated for the customer's shipping address.

**type** `string`

The customer address type. Here it is `shipping_address`.

**primary** `boolean`

Defines if this is the primary address.

* `true`: It is the customer's primary address.
* `false`: It is not the customer's primary address.

**line1** `string`

The first line of the customer's address.

**line2** `string`

The second line of the customer's address.

**city** `string`

The city.

**zipcode** `string`

The zipcode.

**state** `string`

The state.

**country** `string`

The country.

**order\_id** `string`

The unique identifier of the order associated with the invoice.

**line\_items** `object`

Details of the line item that is billed in the invoice. Maximum of 50 line items.

**id** `string`

Unique identifier that is generated if a new item has been created while creating the invoice.

**item\_id** `string`

Unique identifier of the item generated using Items API that has been billed in the invoice.

**name** `string`

The item's name.

**description** `string`

A brief description of the item.

**amount** `integer`

The price of the item.

**currency** `string`

The currency associated with the item. Default is `INR`. Know about the [list of supported international currencies](https://razorpay.com/docs/my/payments/international-payments#malaysian-businesses).

**type** `string`

Here, it is `invoice`.

**quantity** `integer`

The quantity of the item billed in the invoice. Defaults to `1`.

**payment\_id** `string`

Unique identifier of a payment made against this invoice.

**status** `string`

The status of the invoice. Know more about [Invoice States](https://razorpay.com/docs/my/payments/invoices/states.md). Possible values:

* `draft`
* `issued`
* `partially_paid`
* `paid`
* `cancelled`
* `expired`
* `deleted`

**expire\_by** `integer`

Timestamp, in Unix format, at which the invoice will expire.

**issued\_at** `integer`

Timestamp, in Unix format, at which the invoice was issued to the customer.

**paid\_at** `integer`

Timestamp, in Unix format, at which the payment was made.

**cancelled\_at** `integer`

Timestamp, in Unix format, at which the invoice was cancelled.

**expired\_at** `integer`

Timestamp, in Unix format, at which the invoice expired.

**sms\_status** `string`

The delivery status of the SMS notification for the invoice sent to the customer. Possible values:

* `pending`
* `sent`

**email\_status** `string`

The delivery status of the email notification for the invoice sent to the customer. Possible values:

* `pending`
* `sent`

**partial\_payment** `boolean`

Indicates whether the customer can make a partial payment on the invoice. Possible values:

* `true`:  The customer can make partial payments.
* `false` (default): The customer cannot make partial payments.

**amount** `integer`

Amount to be paid using the invoice. Must be in the smallest unit of the currency. For example, if the amount to be received from the customer is , pass the value as `30000`.

**amount\_paid** `integer`

Amount paid by the customer against the invoice.

**amount\_due** `integer`

The remaining amount to be paid by the customer for the issued invoice.

**currency** `string`

The currency associated with the invoice. You must mandatorily pass this parameter if accepting international payments. If you have passed `currency` as a sub-parameter in the `line_item` object, you must ensure that the same currency is passed in both places. Know about the [list of supported international currencies.](https://razorpay.com/docs/my/payments/international-payments#malaysian-businesses)

**description** `string`

A brief description of the invoice. The maximum character length is 2048.

**notes** `object`

Any custom notes added to the invoice. Maximum of 2048 characters.

**short\_url** `string`

The short URL that is generated. Share this link with customers to accept payments.

**date** `integer`

Timestamp, in Unix format, that indicates the issue date of the invoice.

**terms** `string`

Any terms to be included in the invoice. Maximum of 2048 characters.

**comment** `string`

Any comments to be added in the invoice. Maximum of 2048 characters.

**ref\_num** `string`

A unique reference number for the invoice, used for internal tracking and reconciliation.

**subscription\_id** `string`

Unique identifier of the subscription associated with this invoice.

**receipt** `string`

A unique receipt number that you can provide for the invoice, for your internal reference.

**currency\_symbol** `string`

For example, `₹`.

**idempotency\_key** `string`

A unique key used to ensure idempotency of the invoice creation request, preventing duplicate invoices.

**billing\_end** `integer`

Unix timestamp marking the end of the billing period for the invoice.

**gross\_amount** `integer`

The gross amount for this invoice, in the smallest currency unit (paise for INR). For example, `50000`.

## Errors

> [accordion] The API `\<key/secret\>
> ` provided is invalid.
>
> **Code:** `4xx`
>
> The API key or secret are not entered or an invalid API key is used.
>
> **Solution:** Use and enter the correct API details while executing the API.

> [accordion] The customer\_id provided is invalid.
>
> **Code:** `400`
>
> The `customer_id` query parameter is malformed (for example a string that doesn't match the `cust_<14 chars>` pattern, or a wrong-prefix id like `pay_...`). Note: a well-formed but non-existent `customer_id` returns an empty collection (HTTP 200, `count: 0`), not an error.
>
> **Solution:** Pass `customer_id` in the form `cust_<14 alphanumeric chars>`.

> [accordion] The payment id must be at least 14 characters.
>
> **Code:** `400`
>
> The `payment_id` query parameter is shorter than the expected 14-character payload (or otherwise malformed). A well-formed but non-existent `payment_id` returns an empty collection instead of an error.
>
> **Solution:** Pass `payment_id` in the form `pay_<14 alphanumeric chars>`.

> [accordion] Not a valid type.
>
> **Code:** `400`
>
> The value passed for the `type` query parameter is not one of the supported invoice types. The API echoes the rejected value, for example `Not a valid type: invoiceee`.
>
> **Solution:** Use a supported `type` value (for example `invoice`).
