# How to find and display a user's available earnings

### What are DailyPay Available Earnings?

DailyPay Available Earnings is the portion of a user's balance that they can transfer before payday. The earnings available to transfer will never represent 100% of a user's earnings for a number of reasons, like tax or
other withholding.

DailyPay automatically determines the percentage of earnings a user can transfer early. On
payday, the user will receive the rest of their paycheck.

## Displaying Available Earnings

### Option 1: Load the Available Earnings Element

![Earnings](/assets/earnings.c62f6c743bec00e8fadb85ff373454d8cf3280a0cab53d606d1f9d87f9cbaddd.dcfb6bc6.svg)
See our [guide to embedding the available earnings element](/elements/available-earnings).

### Option 2: Query the accounts endpoint

#### Using a user token

Using an authorization token obtained on behalf of a user using [authorization code flow](/guides/auth/authorization-code-flow)  filter the
[accounts endpoint](/products/rest/reference/accounts/listaccounts) by account type:


```sh
curl -i -X GET \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'DailyPay-API-Version: 3' \
  'https://api.dailypay.com/rest/accounts?filter%5Baccount_type%5D=EARNINGS_BALANCE'
```


```json An available earnings of $120.00 USD:
{
  "data": [
    {
      "id": "45298626-591f-4f55-ab31-49d3b8e5760c",
      "type": "accounts",
      "attributes": {
        "name": "DailyPay Available Earnings",
        "account_type": "EARNINGS_BALANCE",
        "subtype": "ODP",
        "balances": {
          "available": 12000, // [!code highlight]
          "current": null,
          "currency": "USD"
        },
        ...
      },
      "relationships": {...},
      "links": {...}
    }
  ]
}
```

#### With client credentials

Using a [client credentials authorization token](/guides/auth/client-credentials-flow) filter the
[accounts endpoint](/products/rest/reference/accounts/listaccounts) by person id:


```sh
curl -i -X GET \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'DailyPay-API-Version: 3' \
  'https://api.dailypay.com/rest/accounts?filter%5Bperson.id%5D=b9fae0ef-4a19-4356-9e82-47b25bbe2f3a'
```

Results will automatically be limited to `EARNINGS_BALANCE` account types:


```json An available earnings of $120.00 USD:
{
  "data": [
    {
      "id": "45298626-591f-4f55-ab31-49d3b8e5760c",
      "type": "accounts",
      "attributes": {
        "name": "DailyPay Available Earnings",
        "account_type": "EARNINGS_BALANCE", // [!code highlight]
        "subtype": "ODP",
        "balances": {
          "available": 12000, // [!code highlight]
          "current": null,
          "currency": "USD"
        },
        ...
      },
      "relationships": {
        "data": {
          "type": "people",
          "id": "b9fae0ef-4a19-4356-9e82-47b25bbe2f3a"
        }
      },
      "links": {...}
    }
  ]
}
```