# List invoices

## Request

```bash
curl -X POST https://api.bitsby.app/invoices/list \
  -H "Authorization: Token MSvL2ltaDZdWVjmZURURMVWhqSJLT2NURjhL2Fla1Z1T1IxQTltKs1T3Ay" \
	-F "startDate=2000-01-01" \
	-F "endDate=2030-01-01" \
	-F "offset=0" \
	-F "limit=10"
```

## Request parameters

| Parameter    | Data type | Description                                                     | Example                              | Required? | Default |
| ------------ | --------- | --------------------------------------------------------------- | ------------------------------------ | --------- | ------- |
| `invoiceId`  | UUID      | Invoice ID in UUID format                                       | 1c48b092-9878-48f5-b441-07a8a48e7b54 | no        |         |
| `invoiceUid` | String    | Invoice ID (for the customer)                                   | F7ncQviM1N92                         | no        |         |
| `projectId`  | UUID      | Project ID in UUID format                                       | 1c48b092-9878-48f5-b441-07a8a48e7b54 | no        |         |
| `startDate`  | String    | Start date of invoice creation, in Y-m-d format                 | 2000-01-01                           | no        |         |
| `endDate`    | String    | End date of invoice creation, in Y-m-d format                   | 2030-01-01                           | no        |         |
| `status`     | String    | Invoice status. Allowed values: unpaid, canceled, paid, expired | paid                                 | no        |         |
| `offset`     | Integer   | Index of the first record to return                             | 0                                    | no        | 0       |
| `limit`      | Integer   | Number of records you want to receive                           | 50                                   | no        | 10      |

## Response example

```json
{
    "result": "success",
    "data": [
        {
            "id": "59302b02-d1be-4e10-960f-d6ec24bfcaaf",
            "uid": "F7nYgvxM1N92",
            "projectId": "9deea1e2-0c08-41a3-bdc2-a34eada3892d",
            "createDatetime": "2024-02-29 10:49:56",
            "timeToPayDatetime": "2024-02-29 22:49:56",
            "commissionFiatUSD": 1,
            "amountFiatUSD": 100,
            "amountFiat": 100,
            "currencyFiat": "USD",
            "description": null,
            "serviceData": null,
            "views": 0,
            "status": "canceled"
        },
        {
            "id": "f31c61f6-407f-4999-95cf-56477eff06d4",
            "uid": "riUZBnNvd2rX",
            "projectId": "9deea1e2-0c08-41a3-bdc2-a34eada3892d",
            "createDatetime": "2024-02-27 20:57:23",
            "timeToPayDatetime": "2024-02-28 08:57:23",
            "commissionFiatUSD": 0.12,
            "amountFiatUSD": 12,
            "amountFiat": 12,
            "currencyFiat": "USD",
            "description": null,
            "serviceData": "orderId:2444",
            "views": 3,
            "status": "paid",
            "payment": {
                "id": "f986ad8d-2298-473d-982a-efbc817b975d",
                "amount": 12,
                "hash": "f09352627039c088688806821b864895ff237558612d834861621fc026de5f68",
                "transactionDatetime": "2024-02-27 21:05:36"
            },
            "wallet": {
                "id": "47aa71e2-07a0-482e-9172-7114d7376ba0",
                "name": "usdt-tron",
                "blockchain": "tron",
                "cryptocurrency": "usdt",
                "address": "TKbstUwMzLrfTAGL4erYb7gc7ghmHQ9zG7"
            }
        }
    ]
}
```

## Response parameters

| Parameter                     | Description                                                                                                                                                                                                                                                                              |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                          | Invoice ID in UUID format                                                                                                                                                                                                                                                                |
| `uid`                         | Invoice ID (for the customer)                                                                                                                                                                                                                                                            |
| `projectId`                   | Project ID in UUID format                                                                                                                                                                                                                                                                |
| `createDatetime`              | Invoice creation date and time (UTC)                                                                                                                                                                                                                                                     |
| `timeToPayDatetime`           | Date and time until which the invoice is valid (UTC). The customer must pay the invoice before this time                                                                                                                                                                                 |
| `commissionFiatUSD`           | Service fee amount. Calculated from the `amountFiatUSD` amount                                                                                                                                                                                                                           |
| `amountFiatUSD`               | The invoice amount converted to USD. At invoice creation it is calculated from `amountFiat` at the current exchange rate. At the moment of payment it is overwritten with the amount actually received, converted to USD at the rate at that moment. The fee in `commissionFiatUSD` is recalculated from it as well |
| `amountFiat`                  | The original invoice amount in fiat currency. Does not change                                                                                                                                                                                                                            |
| `currencyFiat`                | Fiat currency                                                                                                                                                                                                                                                                            |
| `description`                 | The description set at invoice creation. Shown to the customer                                                                                                                                                                                                                           |
| `serviceData`                 | The service data set at invoice creation. Not shown to the customer. Used to identify the invoice and payment in the merchant's store                                                                                                                                                    |
| `views`                       | Number of payment page views                                                                                                                                                                                                                                                             |
| `status`                      | Invoice status                                                                                                                                                                                                                                                                           |
| `payment`                     | Block with the payment parameters. Present if the invoice was paid                                                                                                                                                                                                                       |
| `payment.id`                  | Payment ID in UUID format                                                                                                                                                                                                                                                                |
| `payment.amount`              | Payment amount in cryptocurrency                                                                                                                                                                                                                                                         |
| `payment.hash`                | The on-chain transaction hash                                                                                                                                                                                                                                                            |
| `payment.transactionDatetime` | Date and time of the on-chain transaction (UTC)                                                                                                                                                                                                                                          |
| `wallet`                      | Block with the parameters of the wallet that received the payment. Present if the invoice was paid                                                                                                                                                                                       |
| `wallet.id`                   | Wallet ID in UUID format                                                                                                                                                                                                                                                                 |
| `wallet.name`                 | Wallet name                                                                                                                                                                                                                                                                              |
| `wallet.blockchain`           | The crypto wallet's blockchain                                                                                                                                                                                                                                                           |
| `wallet.cryptocurrency`       | The wallet's cryptocurrency                                                                                                                                                                                                                                                              |
| `wallet.address`              | The crypto wallet's address                                                                                                                                                                                                                                                              |
