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.
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.
You can find our API documentation at SwaggerHub:
We have also provided some examples of API usage.