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

# Oracle's API

## Attest with Commit

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8585/attest`

Request an attestation message body

#### Query Parameters

| Name    | Type   | Description                                                                        |
| ------- | ------ | ---------------------------------------------------------------------------------- |
| commit  | string | Commit ID of the committed data                                                    |
| cid     | string | ContractId of the recipient address                                                |
| pk      | string | Public key of the recipient address                                                |
| address | String | Address of the recipient (either a contract address or a public key hash address). |

{% tabs %}
{% tab title="200 Commit found" %}

```
{
    "root": "3e47241505bca37f3356fd8dda544c2a3c9c043601f147ea0c6da1362c85a472",
    "timestamp": "1600785099516",
    "commit": "2d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d3",
    "tx": "No TX",
    "messageBody": "{\n  \"dict\": [\n    [\n      \"Commit\",\n      {\n        \"hash\": \"2d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d3\"\n      }\n    ],\n    [\n      \"OraclePubKey\",\n      {\n        \"pk\": \"02ad784974b3f86ad97e008e20d2c107429041ed2d991ada2a1461b5077c11944c\"\n      }\n    ]\n  ]\n}",
    "messageBodyEncoded": "0c0206436f6d6d6974072d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d30c4f7261636c655075624b65790a02ad784974b3f86ad97e008e20d2c107429041ed2d991ada2a1461b5077c11944c"
}
`
```

{% endtab %}
{% endtabs %}

## Attest with Root and Timestamp

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8585/attest`

Request an attestation message body

#### Query Parameters

| Name      | Type   | Description                                                                        |
| --------- | ------ | ---------------------------------------------------------------------------------- |
| root      | string | Root of the Merkle Tree                                                            |
| timestamp | string | Time of the committed data (in millisecond in epoch format)                        |
| cid       | string | Contract ID of the recipient address                                               |
| pk        | string | ContractId of the Recipient address                                                |
| address   | String | Address of the recipient (either a contract address or a public key hash address). |

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

```
{
    "root": "3e47241505bca37f3356fd8dda544c2a3c9c043601f147ea0c6da1362c85a472",
    "timestamp": "1600785099516",
    "commit": "2d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d3",
    "tx": "No TX",
    "messageBody": "{\n  \"dict\": [\n    [\n      \"Commit\",\n      {\n        \"hash\": \"2d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d3\"\n      }\n    ],\n    [\n      \"OraclePubKey\",\n      {\n        \"pk\": \"02ad784974b3f86ad97e008e20d2c107429041ed2d991ada2a1461b5077c11944c\"\n      }\n    ]\n  ]\n}",
    "messageBodyEncoded": "0c0206436f6d6d6974072d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d30c4f7261636c655075624b65790a02ad784974b3f86ad97e008e20d2c107429041ed2d991ada2a1461b5077c11944c"
}
`
```

{% endtab %}
{% endtabs %}

## Query the Oracle

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8585/query`

Filter the commited data to find the commitment.

#### Query Parameters

| Name                                   | Type   | Description                                                         |
| -------------------------------------- | ------ | ------------------------------------------------------------------- |
| high                                   | string | filter the data with the higher timestamp bond                      |
| low                                    | string | Filter the data with the lower timestamp bond                       |
| key                                    | string | Filter by this ticker                                               |
| take<mark style="color:red;">\*</mark> | String | Take only the first  *\<n>* items (after the skip if there is one). |
| skip                                   | String | Skip the first *\<n>* items.                                        |

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

```
[{
    "item": {
        "APPL": "10"
    },
    "timestamp": "1600785099516",
    "commit": "2d1719fa333e615636dc074cb6ad03813a57c56cd91b73bffd7c12dd62fdb0d3",
    "hash": "0ecb254e1ff36f9b6a09f35926041a01a955171a29d8500775fb58a0acbff54c"
}]
```

{% endtab %}
{% endtabs %}

## Count commits

<mark style="color:blue;">`GET`</mark> `http://127.0.0.1:8585/count/`&#x20;

Count the number of items committed by the service.

#### Query Parameters

| Name | Type   | Description                                    |
| ---- | ------ | ---------------------------------------------- |
| high | String | filter the data with the higher timestamp bond |
| low  | String | Filter the data with the lower timestamp bond  |
| key  | String | Filter by this ticker                          |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Get the values&#x20;

<mark style="color:green;">`POST`</mark> `http://127.0.0.1:8585/getValues` &#x20;

#### Query Parameters

| Name | Type   | Description                                    |
| ---- | ------ | ---------------------------------------------- |
| key  | String | Filter by this ticker                          |
| high | String | filter the data with the higher timestamp bond |
| low  | String | Filter the data with the lower timestamp bond  |

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.zenprotocol.com/apps/oracle/oracles-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.
