> For the complete documentation index, see [llms.txt](https://docs.enclaive.cloud/vault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.enclaive.cloud/vault/api/secrets-engines/rabbitmq-secrets-engine-api.md).

# RabbitMQ secrets engine (API)

This is the API documentation for the Vault RabbitMQ secrets engine. For general information about the usage and operation of the RabbitMQ secrets engine, please see the RabbitMQ documentation.

This documentation assumes the RabbitMQ secrets engine is enabled at the `/rabbitmq` path in Vault. Since it is possible to enable secrets engines at any location, please update your API calls accordingly.

### Configure connection <a href="#configure-connection" id="configure-connection"></a>

This endpoint configures the connection string used to communicate with RabbitMQ.

| Method | Path                          |
| ------ | ----------------------------- |
| `POST` | `/rabbitmq/config/connection` |

#### Parameters <a href="#parameters" id="parameters"></a>

* `connection_uri` `(string: <required>)` – Specifies the RabbitMQ connection URI.
* `username` `(string: <required>)` – Specifies the RabbitMQ management administrator username.
* `password` `(string: <required>)` – Specifies the RabbitMQ management administrator password.
* `verify_connection` `(bool: true)` – Specifies whether to verify connection URI, username, and password.
* `password_policy` `(string: "")` - Specifies a password policy to use when creating dynamic credentials. Defaults to generating an alphanumeric password if not set.
* `username_template` `(string)` - Template describing how dynamic usernames are generated.

#### Sample payload <a href="#sample-payload" id="sample-payload"></a>

```json
{
  "connection_uri": "https://...",
  "username": "user",
  "password": "password",
  "password_policy": "rabbitmq_policy"
}
```

#### Sample request <a href="#sample-request" id="sample-request"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/rabbitmq/config/connection
```

### Configure lease <a href="#configure-lease" id="configure-lease"></a>

This endpoint configures the lease settings for generated credentials.

| Method | Path                     |
| ------ | ------------------------ |
| `POST` | `/rabbitmq/config/lease` |

#### Parameters <a href="#parameters-1" id="parameters-1"></a>

* `ttl` `(int: 0)` – Specifies the lease ttl provided in seconds.
* `max_ttl` `(int: 0)` – Specifies the maximum ttl provided in seconds.

#### Sample payload <a href="#sample-payload-1" id="sample-payload-1"></a>

```json
{
  "ttl": 1800,
  "max_ttl": 3600
}
```

#### Sample request <a href="#sample-request-1" id="sample-request-1"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/rabbitmq/config/lease
```

### Create role <a href="#create-role" id="create-role"></a>

This endpoint creates or updates the role definition.

| Method | Path                    |
| ------ | ----------------------- |
| `POST` | `/rabbitmq/roles/:name` |

#### Parameters <a href="#parameters-2" id="parameters-2"></a>

* `name` `(string: <required>)` – Specifies the name of the role to create. This is specified as part of the URL.
* `tags` `(string: "")` – Specifies a comma-separated RabbitMQ management tags.
* `vhosts` `(string: "")` – Specifies a map of virtual hosts to permissions.
* `vhost_topics` `(string: "")` – Specifies a map of virtual hosts and exchanges to topic permissions. This option requires RabbitMQ 3.7.0 or later.

#### Sample payload <a href="#sample-payload-2" id="sample-payload-2"></a>

```json
{
  "tags": "tag1,tag2",
  "vhosts": "{\"/\": {\"configure\":\".*\", \"write\":\".*\", \"read\": \".*\"}}",
  "vhost_topics": "{\"/\": {\"amq.topic\": {\"write\":\".*\", \"read\": \".*\"}}}"
}
```

#### Sample request <a href="#sample-request-2" id="sample-request-2"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --data @payload.json \
    http://127.0.0.1:8200/v1/rabbitmq/roles/my-role
```

### Read role <a href="#read-role" id="read-role"></a>

This endpoint queries the role definition.

| Method | Path                    |
| ------ | ----------------------- |
| `GET`  | `/rabbitmq/roles/:name` |

#### Parameters <a href="#parameters-3" id="parameters-3"></a>

* `name` `(string: <required>)` – Specifies the name of the role to read. This is specified as part of the URL.

#### Sample request <a href="#sample-request-3" id="sample-request-3"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    http://127.0.0.1:8200/v1/rabbitmq/roles/my-role
```

#### Sample response <a href="#sample-response" id="sample-response"></a>

```json
{
  "data": {
    "tags": "",
    "vhosts": "{\"/\": {\"configure\":\".*\", \"write\":\".*\", \"read\": \".*\"}}",
    "vhost_topics": "{\"/\": {\"amq.topic\": {\"write\":\".*\", \"read\": \".*\"}}}"
  }
}
```

### Delete role <a href="#delete-role" id="delete-role"></a>

This endpoint deletes the role definition.

| Method   | Path                    |
| -------- | ----------------------- |
| `DELETE` | `/rabbitmq/roles/:name` |

#### Parameters <a href="#parameters-4" id="parameters-4"></a>

* `name` `(string: <required>)` – Specifies the name of the role to delete. This is specified as part of the URL.

#### Sample request <a href="#sample-request-4" id="sample-request-4"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    --request DELETE \
    http://127.0.0.1:8200/v1/rabbitmq/roles/my-role
```

### Generate credentials <a href="#generate-credentials" id="generate-credentials"></a>

This endpoint generates a new set of dynamic credentials based on the named role.

| Method | Path                    |
| ------ | ----------------------- |
| `GET`  | `/rabbitmq/creds/:name` |

#### Parameters <a href="#parameters-5" id="parameters-5"></a>

* `name` `(string: <required>)` – Specifies the name of the role to create credentials against. This is specified as part of the URL.

#### Sample request <a href="#sample-request-5" id="sample-request-5"></a>

```shell-session
$ curl \
    --header "X-Vault-Token: ..." \
    http://127.0.0.1:8200/v1/rabbitmq/creds/my-role
```

#### Sample response <a href="#sample-response-1" id="sample-response-1"></a>

```json
{
  "data": {
    "username": "root-4b95bf47-281d-dcb5-8a60-9594f8056092",
    "password": "e1b6c159-ca63-4c6a-3886-6639eae06c30"
  }
}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.enclaive.cloud/vault/api/secrets-engines/rabbitmq-secrets-engine-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
