> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/server/web-interface/utilities/api-documentation.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# API documentation

Find the Devolutions Server REST API documentation in Help & tools, its main endpoints, and a sample bash script to log in, read an entry and log out.

The Devolutions Server REST API documentation is built into the Devolutions Server web interface: open ***Help & tools*** – ***Apps and companion tools*** – ***API documentation***. The page shows the interactive OpenAPI (Swagger) description of every endpoint, read from `swagger/v1/swagger.json` on the Devolutions Server.

The REST API uses the base path `/api/v1` and authenticates with an application identity (application key and application secret) created in Devolutions Server.

<table><thead><tr><th width="320">ENDPOINT</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><code>POST /api/v1/login</code></td><td>Logs in with <code>appKey</code> and <code>appSecret</code> in a JSON body, and returns a <code>tokenId</code> to send in the <code>tokenId</code> header of the following requests. A failed login returns HTTP 401 with a message.</td></tr><tr><td><code>POST /api/v1/logout</code></td><td>Ends the session of the token.</td></tr><tr><td><code>GET /api/v1/vault</code></td><td>Lists the vaults.</td></tr><tr><td><code>GET /api/v1/vault/{id}</code></td><td>Returns one vault.</td></tr><tr><td><code>POST /api/v1/vault</code></td><td>Creates a vault.</td></tr><tr><td><code>PUT</code>, <code>PATCH</code>, <code>DELETE</code> <code>/api/v1/vault/{id}</code></td><td>Replaces, updates or deletes a vault.</td></tr><tr><td><code>GET /api/v1/vault/{vaultId}/entry</code></td><td>Lists the entries of a vault, 25 per page by default (<code>pageNumber</code>, <code>pageSize</code>, <code>sortOrder</code> 1 = ascending or 0 = descending, <code>sortField</code> = <code>name</code> or <code>path</code>). Filters: <code>path</code> (with <code>exactPath</code> to exclude subfolders), <code>tag</code>, <code>name</code>, <code>username</code>, <code>description</code>, <code>connectionType</code> (one or more values).</td></tr><tr><td><code>GET /api/v1/vault/{vaultId}/entry/{id}</code></td><td>Returns one entry. Options: <code>includePasswords</code>, <code>includeSensitiveData</code>, <code>resolveVariables</code>, <code>resolveOverrides</code> (all true by default), <code>property</code> (returns only the value of that property), and <code>checkoutDuration</code> for a privileged account. HTTP 403 is returned when a checkout of the entry is required, or when the application is not allowed to view the entry, its password or its sensitive data.</td></tr><tr><td><code>POST /api/v1/vault/{vaultId}/entry</code></td><td>Creates an entry.</td></tr><tr><td><code>PUT</code>, <code>PATCH</code>, <code>DELETE</code> <code>/api/v1/vault/{vaultId}/entry/{id}</code></td><td>Replaces, updates or deletes an entry.</td></tr><tr><td><code>GET /api/v1/entry/definition</code></td><td>Lists the entry types and fields that the REST API supports.</td></tr></tbody></table>

To connect and use the REST API, refer to the sample bash script below. For each API call to the server, ensure the following:

* Replace `https://url` with the specific Devolutions Server URL.
* Replace `appkey` and `appsecret` with the application key and application secret of the application identity.
* Replace `GUID-OF-VAULT` and `GUID-OF-ENTRY` with the corresponding GUIDs.

{% hint style="info" %}
Entries of any type can be read through the REST API. Creating and editing through the REST API is limited to folders, several credential entry types (such as ***Username and password*** and ***Secret***) and some session types; the `GET /api/v1/entry/definition` endpoint lists them. Privileged accounts (PAM) cannot be created or edited through the REST API, and reading them requires that the PAM usage settings allow the REST API.
{% endhint %}

```bash

# Log in and get the token
authResponse=$(curl -s -X POST "https://url/api/v1/login" \
    -H "Content-Type: application/json" \
    -d '{
        "appKey": "appkey",
        "appSecret": "appsecret"
    }')
token=$(echo $authResponse | jq -r '.tokenId')

# Check if the token was successfully obtained
if [ -z "$token" ] || [ "$token" = "null" ]; then
  echo "Failed to login or obtain token."
  exit 1
fi

# Request data using the token
response=$(curl -s -X GET "https://url/api/v1/vault/GUID-OF-VAULT/entry/GUID-OF-ENTRY" \
    -H "Content-Type: application/json" \
    -H "tokenId: $token")

echo $response | jq

# Log out
curl -s -X POST "https://url/api/v1/logout" \
    -H "Content-Type: application/json" \
    -H "tokenId: $token" \
    -H "Content-Length: 0"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/server/web-interface/utilities/api-documentation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
