# API documentation

Portainer exposes an HTTP API that you can use to automate everything you do via the Portainer UI. You can also use Portainer as a gateway (HTTP queries against the Portainer API) to the underlying Docker/Kubernetes API.

{% hint style="info" %}
You will need an access token in order to use the Portainer API. If you have not already set up an access token for the API, we have [instructions on how to do so](https://docs.portainer.io/api/access).
{% endhint %}

You can find our API documentation here:

* [Business Edition (BE) 2.39.1 API Documentation](https://api-docs.portainer.io/?edition=ee\&version=2.39.1)&#x20;
* [Community Edition (CE) 2.39.1 API Documentation](https://api-docs.portainer.io/?edition=ce\&version=2.39.1)

We have also provided some examples of API usage.

{% content-ref url="examples" %}
[examples](https://docs.portainer.io/api/examples)
{% endcontent-ref %}


---

# 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.portainer.io/api/docs.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.
