# 3.2 Making API Requests

All endpoints below require a valid JWT in the `Authorization` header. See [3.1 Authentication](/key9-identity/jsonair/3-using-the-api/3.1-authentication.md) for how to obtain one.

***

## Get Configuration Data

Retrieves the stored configuration for a given type and name.

**Endpoint:** `GET /api/v1/jsonair/config`

**Request body:**

```json
{
  "type": "myapp",
  "name": "prod.yaml",
  "decode": false
}
```

| Field    | Type   | Required | Description                                                                             |
| -------- | ------ | -------- | --------------------------------------------------------------------------------------- |
| `type`   | string | Yes      | Configuration type (e.g. `suricata`, `nginx`, `myapp`)                                  |
| `name`   | string | Yes      | Configuration name (e.g. `prod.yaml`, `settings.json`)                                  |
| `decode` | bool   | No       | If `true`, the server Base64-decodes the data before returning it. Defaults to `false`. |

**Successful response (200 OK):**

When `decode` is `false` (default), the raw Base64-encoded configuration data is returned as plain text:

```
eyJrZXkiOiJ2YWx1ZSJ9
```

When `decode` is `true`, the decoded configuration is returned directly:

```json
{"key":"value"}
```

**Not found (404):**

```json
{
  "error": "not found"
}
```

***

## Get the Reload Key

Retrieves the `reload` field for a given configuration. This can be used by agents to determine whether to trigger a reload of the consuming application.

**Endpoint:** `GET /api/v1/jsonair/reload`

**Request body:**

```json
{
  "type": "myapp",
  "name": "prod.yaml"
}
```

**Successful response (200 OK):**

```json
{
  "reload": "RELOADKEY"
}
```

***

## Get the Debug Level

Retrieves the `debug` field for a given configuration. Agents can use this to dynamically adjust their logging verbosity without restarting.

**Endpoint:** `GET /api/v1/jsonair/debug`

**Request body:**

```json
{
  "type": "myapp",
  "name": "prod.yaml"
}
```

**Successful response (200 OK):**

```json
{
  "debug": "INFO"
}
```

***

## Error Responses

| HTTP Status                 | Meaning                                             |
| --------------------------- | --------------------------------------------------- |
| `400 Bad Request`           | Request body could not be read                      |
| `401 Unauthorized`          | Missing, expired, or invalid JWT                    |
| `404 Not Found`             | No configuration found for the given type/name/uuid |
| `429 Too Many Requests`     | Rate limit exceeded (auth endpoint only)            |
| `500 Internal Server Error` | Unexpected server error                             |


---

# 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://docs.k9.io/key9-identity/jsonair/3-using-the-api/3.2-make-api-requests.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.
