# Using the API

To use the API, you must get your personal API token. A token belongs to a user, and all user-rights (or limits) are applied to each transaction executed with the token.

From the settings menu in the top-right corner, select "API Token". Generate a new token. The token is displayed only once. If you lose the token, it can't be recovered. So store the token in a safe place.

<img src="https://1142160776-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MekeI9EovpQqbUTQSdM%2F-MieQmn4fxBtaIn1g2oA%2F-MieStByH_uFSaeevCO_%2Fimage.png?alt=media&#x26;token=c380505a-e1f9-43fc-9281-6af247b933b2" alt="" width="100%">

If you have command and/or scripts enabled on your clients, the API token can become very powerful. 🔥Taking full control over one or all clients might be possible with an API token.

* Never communicate with the API without encryption (HTTPs).
* Delete tokens that are not used anymore.

The **base URL** of the API is `https://<server-domain>/api/v1`. You must use **HTTP basic authentication** using your username and the API token as password.

Test the API connection by fetching the server status. Example:

```
curl -u john:740df110-8b06-4071-90c1-13645a023a85 \
https://example.users.rport.io/api/v1/status
```

You can read the API documentation online, nicely rendered via Swagger, [here](https://apidoc.openrport.io/). Alternatively, will find the full API documentation (raw swagger file) on our [GitHub repository](https://github.com/openrport/openrport/blob/master/api-doc/openapi/openapi.yaml).


---

# 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://kb.openrport.io/digging-deeper/using-the-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.
