> For the complete documentation index, see [llms.txt](https://docs.looplookup.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.looplookup.com/lookup-api/credits.md).

# Credits

This section described how to check or buy Lookup credits through the API.

## Balance

### Request to check balance

<mark style="color:blue;">`GET`</mark> `https://a.looplookup.com/customer/api/v1/credits/balance/`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | API Key          |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json |

{% tabs %}
{% tab title="200: OK Request accepted" %}
{% hint style="warning" %}
This response returns results from a cache storage. Updated results may be returned with some delay (10-15 seconds).
{% endhint %}

```json
{
  "credits": 100
}
```

{% endtab %}

{% tab title="400: Bad Request Request failed" %}

```json
{
    "success": false,
    "code": 100,
    "message": "Failed description",
}
```

{% endtab %}
{% endtabs %}

## Buy credits

### Check available lookup packages

<mark style="color:blue;">`GET`</mark> `https://a.looplookup.com/customer/api/v1/credits/packages/`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | API Key          |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json |

{% tabs %}
{% tab title="200: OK Request accepted" %}
{% hint style="warning" %}
This response returns results from a cache storage. Updated results may be returned with some delay (10-15 seconds).
{% endhint %}

```json
{
  "items": [
    {
      "id": "2BC4FD6A-CE49-439F-81DF-E895C09CA49C",
      "price": 10,
      "currency": "USD",
      "credits": 1000,
      "price_per_request": "0.01"
    }
  ]
}
```

{% endtab %}

{% tab title="400: Bad Request Request failed" %}

```json
{
    "success": false,
    "code": 100,
    "message": "Failed description",
}
```

{% endtab %}
{% endtabs %}

### Buy lookup package

{% hint style="warning" %}
To buy a package through an API request, you must have at least one active subscription. The billing method added to your subscription will be used to charge you for a purchase.

You can only submit 5 buy requests per hour.
{% endhint %}

<mark style="color:blue;">`POST`</mark> `https://a.looplookup.com/customer/api/v1/credits/buy/{package_id}/`

#### Path Parameters

| Name        | Type   | Description                                                       |
| ----------- | ------ | ----------------------------------------------------------------- |
| package\_id | String | The package ID that you can get from a list of available packages |

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | API Key          |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json |

{% tabs %}
{% tab title="200: OK Request accepted" %}

```json
{
  "success": true
}
```

{% endtab %}

{% tab title="400: Bad Request Request failed" %}

```json
{
    "success": false,
    "code": 100,
    "message": "Failed description",
}
```

{% endtab %}
{% endtabs %}
