# OPI API

**Mainnet:** [**https://api.ordinalsbot.com/opi**](https://api.ordinalsbot.com/opi)

**Testnet:** <https://testnet-api.ordinalsbot.com/opi>

You can refer to official OPI documentation for all available endpoints.

{% embed url="<https://github.com/bestinslot-xyz/OPI/blob/main/modules/brc20_api/api.js>" %}

## Get BRC20 Ticker Info

<mark style="color:green;">`GET`</mark> `https://api.ordinalsbot.com/opi/v1/brc20/ticker_info`

#### Query Parameters

| Name                                     | Type   | Description                   |
| ---------------------------------------- | ------ | ----------------------------- |
| ticker<mark style="color:red;">\*</mark> | String | Ticker to get information for |

#### Headers

<table><thead><tr><th width="170">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>x-api-key<mark style="color:red;">*</mark></td><td>String</td><td>API Key</td></tr></tbody></table>

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

```json
{
    "error": null,
    "result": {
        "id": "10228",
        "original_tick": "TRIO",
        "tick": "trio",
        "max_supply": "21000000000000000000000000",
        "decimals": 18,
        "limit_per_mint": "10000000000000000000000",
        "remaining_supply": "0",
        "burned_supply": "0",
        "is_self_mint": false,
        "deploy_inscription_id": "c409d95ec5d858dcac9ef2e7b6bb57752b2e213f4e5443a252bdcc74625ec674i0",
        "block_height": 788143
    }
}
```

{% endtab %}
{% endtabs %}

## Get BRC20 Wallet Balance

<mark style="color:green;">`GET`</mark> `https://api.ordinalsbot.com/opi/v1/brc20/get_current_balance_of_wallet`

#### Query Parameters

| Name                                      | Type   | Description                      |
| ----------------------------------------- | ------ | -------------------------------- |
| address<mark style="color:red;">\*</mark> | String | Bitcoin address to check balance |
| ticker                                    | String | Ticker to get balance            |

#### Headers

<table><thead><tr><th width="170">Name</th><th width="246">Type</th><th>Description</th></tr></thead><tbody><tr><td>x-api-key<mark style="color:red;">*</mark></td><td>String</td><td>API Key</td></tr></tbody></table>

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

```json
{
    "error": null,
    "result": [
        {
            "overall_balance": "550000000000000000000",
            "available_balance": "50000000000000000000",
            "block_height": 840857,
            "tick": "trio"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get BRC20 Index Block Height

<mark style="color:green;">`GET`</mark> `https://api.ordinalsbot.com/opi/v1/brc20/block_height`

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| x-api-key<mark style="color:red;">\*</mark> | String | API Key     |

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

```json
838346
```

{% endtab %}

{% tab title="500: Internal Server Error " %}

```
{
    status: 'error',
    error: 'error reason'
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ordinalsbot.com/brc20-brc2.0prog/opi-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
