# APIs

The public APIs made available by Ontology serve as communication bridges between `dApps` and **nodes**.

The APIs provide methods that can be used to fetch data from the chain using various parameters such as user **ONT ID**, **transaction hash**, **block height** etc.

There are two different APIs available publicly for developers to start using:

1. **HTTP API -** `RPC` interface, `Restful` interface, `Websocket` interface
2. **Explorer API**

Both these APIs are used to fetch data from the chain, but there are slight differences between the two, described in respective sections.

Generally speaking, it is a very tedious task for developers to run and maintain a node, but also a necessity since it is required for testing before deployment on the MainNet. Thus, to make things simpler for developers, Ontology provides public test nodes all of which use the RPC, Restful and Websocket API with default ports, thereby allowing developers to test their smart contracts and business logic.

## Using public nodes

All the nodes support`RPC`, `RESTful`, and `WebSocket` APi calls, and use default port numbers.

{% hint style="success" %}
HTTPS is supported on `port 10334` of the **Polaris TestNet** node <http://polaris1.ont.io> and **Ontology MainNet** node <http://dappnode1.ont.io>.
{% endhint %}

### Polaris TestNet

The public TestNet nodes are:

* <http://polaris1.ont.io>
* <http://polaris2.ont.io>
* <http://polaris3.ont.io>
* <http://polaris4.ont.io>
* <http://polaris5.ont.io>

{% hint style="info" %}
When working on the **TestNet**, you'll need TestNet **ONG**, which can be applied for [here](https://developer.ont.io/applyOng).
{% endhint %}

### Ontology MainNet

The public MainNet nodes are :

* <http://dappnode1.ont.io>
* <http://dappnode2.ont.io>
* <http://dappnode3.ont.io>
* <http://dappnode4.ont.io>

A **private node** can also be set up on the local machine. This can be done by directly compiling and running the [source code](https://github.com/ontio/ontology), but for the convenience of developers, Ontology provides a method to directly download and run a private node. Please follow [this](/ontology-node/interact-with-public-node.md) link to find the guide.

{% hint style="info" %}
Follow [**this**](/developer-tools/api/ont-id-contract-api.md) link to navigate to the **ONT ID** public API.&#x20;
{% endhint %}

{% hint style="info" %}
To find out how to deploy your own Ontology node follow [this](/ontology-node/node-deployment.md) link.
{% endhint %}


---

# 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.ont.io/developer-tools/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.
