# API

The CloudBit API allows you to manage resources within the CloudBit cloud in a simple, programmatic way using conventional HTTP requests. The endpoints are intuitive and powerful, allowing you to easily make calls to retrieve information or to execute actions.

All of the functionality that you are familiar with in the CloudBit control panel is also available through the API, allowing you to script the complex actions that your situation requires. Our API has predictable resource-oriented URLs, accepts and returns JSON-encoded content and uses standard HTTP response codes.

### Documentation <a href="#documentation" id="documentation"></a>

The latest API documentation is available here: <https://my.cloudbit.ch/#/doc/general>

### Authentication

Most of our requests are protected tough a user role management system and therefore require identification of the current user. This authentication system works by requesting an authentication token using a username and password and sending the generated token with each request in the X-Auth-Token header.

To generate such a token you have to make the following request:

```
POST https://api.cloudbit.ch/v3/auth
{
	"username": "…",
	"password": "…"
}
```

```
{
	"token": "…",
	"id": 1,
	"username": "my@cloudbit.ch"
}
```

Please find here more details about the authentication endpoints and models:\
<https://my.cloudbit.ch/#/doc/authentication>


---

# 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://doc.cloudbit.ch/developer-center/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.
