# Cloud API reference

The API of Aegis Cloud, the hosted Free and Pro editions of Aegis by qblackbit. Programs and AI agents call it with an API key (`Authorization: Bearer agk_…`) that an organisation admin makes in the app under API keys; the key acts with its role, `developer` or `auditor`. JSON in and out; binary values are standard base64 with padding; a body carries at most 1 MiB of data. Each organisation's keys live in its own tenant of Aegis Core, under its own key-encryption key. Call the API from servers, scripts and agents, never from a web page: the key would be exposed, and cross-site requests are refused.

Base URL: `https://aegis.qblackbit.com`. In the examples, `AEGIS_URL` holds it and `AEGIS_API_KEY` holds an API key you made in the app (never paste a key into a chat or a page).

## Public settings

`GET /api/config`

The service's public settings: Google sign-in, the minimum password length, where data is held, and every plan's limits.

- Authentication: none
- Metered: no

Response `200` (`application/json`): [Config](#schema-config)

```json
{
  "data_location": "Contabo GmbH data centre in the European Union",
  "google": true,
  "password_min_length": 12,
  "plans": {
    "free": {
      "algorithms": [
        "ml-dsa-65",
        "x25519-ml-kem-768"
      ],
      "export": "wrapped",
      "hashes": [
        "sha2-256",
        "sha2-384",
        "sha2-512",
        "sha3-256",
        "sha3-512"
      ],
      "max_keys": 10,
      "monthly_operations": 10000,
      "rate_per_minute": 60
    },
    "pro": {
      "algorithms": [
        "ml-kem-512",
        "ml-kem-768",
        "ml-kem-1024",
        "ml-dsa-44",
        "ml-dsa-65",
        "ml-dsa-87",
        "slh-dsa-sha2-128s",
        "slh-dsa-sha2-128f",
        "slh-dsa-sha2-192s",
        "slh-dsa-sha2-256s",
        "slh-dsa-shake-128s",
        "slh-dsa-shake-256s",
        "x25519-ml-kem-768",
        "p256-ml-kem-768",
        "p384-ml-kem-1024"
      ],
      "export": "wrapped",
      "hashes": [
        "sha2-256",
        "sha2-384",
        "sha2-512",
        "sha3-256",
        "sha3-512"
      ],
      "max_keys": 1000,
      "monthly_operations": 1000000,
      "rate_per_minute": 1200
    }
  },
  "turnstile_site_key": null
}
```

Example:

```bash
curl -sS "$AEGIS_URL/api/config"
```

## Algorithms your plan allows

`GET /api/v1/algorithms`

The key algorithms, hash functions and export KEMs the organisation's plan allows.

- Authentication: API key, role `auditor` or higher
- Metered: no

Response `200` (`application/json`): [Algorithms](#schema-algorithms)

```json
{
  "plan": "free",
  "algorithms": [
    "ml-dsa-65",
    "x25519-ml-kem-768"
  ],
  "hashes": [
    "sha2-256",
    "sha2-384",
    "sha2-512",
    "sha3-256",
    "sha3-512"
  ],
  "export_kems": [
    "hpke-mlkem768-x25519",
    "hpke-mlkem1024-p384"
  ]
}
```

Errors: `401` · `403` · `429` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS "$AEGIS_URL/api/v1/algorithms" \
  -H "Authorization: Bearer $AEGIS_API_KEY"
```

## Usage this month

`GET /api/v1/usage`

Operations used this calendar month (UTC), what remains of the plan's allowance, and the prepaid balance (Pro). Never blocked.

- Authentication: API key, role `auditor` or higher
- Metered: no

Response `200` (`application/json`): [Usage](#schema-usage)

```json
{
  "month": "2026-12",
  "plan": "free",
  "included": 10000,
  "used": {
    "included": 42,
    "from_balance": 0
  },
  "remaining": 9958,
  "balance": 0
}
```

Errors: `401` · `403` · `429` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS "$AEGIS_URL/api/v1/usage" \
  -H "Authorization: Bearer $AEGIS_API_KEY"
```

## Hash

`POST /api/v1/hash`

A digest of the data with one of the plan's hash functions.

- Authentication: API key, role `developer` or higher
- Metered: counts as one operation

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `algorithm` | string, required | A hash function the plan allows: `sha2-256`, `sha2-384`, `sha2-512`, `sha3-256` or `sha3-512`. Example: `"sha3-256"`. |
| `data` | string (base64), required | The data, at most 1 MiB. Example: `"aGVsbG8gYWVnaXM="`. |

```json
{
  "algorithm": "sha3-256",
  "data": "aGVsbG8gYWVnaXM="
}
```

Response `200` (`application/json`): [HashResult](#schema-hashresult)

Errors: `400` · `401` · `403` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/hash" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"algorithm":"sha3-256","data":"aGVsbG8gYWVnaXM="}'
```

## Encapsulate

`POST /api/v1/encapsulate`

Encapsulates to a public key: a fresh shared secret, and the ciphertext that carries it to the holder of the matching private key.

The private key's holder recovers the same shared secret by decapsulating the ciphertext. The cloud API does not decapsulate: decapsulation happens where the private key is held. `x25519-ml-kem-768`, `p256-ml-kem-768` and `p384-ml-kem-1024` are the TLS 1.3 hybrid groups, which rely on the TLS handshake transcript; outside TLS, prefer `ml-kem-768` or `ml-kem-1024` (Pro), or bind the ciphertext and the recipient's public key into your key derivation (see Post-quantum and hybrids).

- Authentication: API key, role `developer` or higher
- Metered: counts as one operation

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `algorithm` | string, required | A KEM the plan allows, such as `x25519-ml-kem-768` (Free and Pro) or `ml-kem-768` (Pro). Example: `"x25519-ml-kem-768"`. |
| `public_key` | string (base64), required | The recipient's public key, for example from `GET /api/v1/keys/{name}/public`. Example: `"<base64 public key>"`. |

```json
{
  "algorithm": "x25519-ml-kem-768",
  "public_key": "<base64 public key>"
}
```

Response `200` (`application/json`): [Encapsulation](#schema-encapsulation)

Errors: `400` · `401` · `403` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/encapsulate" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"algorithm":"x25519-ml-kem-768","public_key":"<base64 public key>"}'
```

## List keys

`GET /api/v1/keys`

The organisation's keys, without secrets.

- Authentication: API key, role `auditor` or higher
- Metered: no

Response `200` (`application/json`): [KeyList](#schema-keylist)

```json
{
  "keys": [
    {
      "name": "release-signing",
      "algorithm": "ml-dsa-65",
      "created": 1764806400,
      "by": "<account id>"
    }
  ]
}
```

Errors: `401` · `403` · `429` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS "$AEGIS_URL/api/v1/keys" \
  -H "Authorization: Bearer $AEGIS_API_KEY"
```

## Create a key

`POST /api/v1/keys`

Makes a key pair in the organisation's tenant of Aegis Core. The private key stays in the vault.

- Authentication: API key, role `developer` or higher
- Metered: counts as one operation

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `name` | string, required | 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit; unique in the organisation. Example: `"release-signing"`. |
| `algorithm` | string, required | An algorithm the plan allows: `ml-dsa-65` or `x25519-ml-kem-768` on Free; on Pro, every set `GET /api/v1/algorithms` lists. Example: `"ml-dsa-65"`. |

```json
{
  "name": "release-signing",
  "algorithm": "ml-dsa-65"
}
```

Response `201` (`application/json`): [CreatedKey](#schema-createdkey)

```json
{
  "name": "release-signing",
  "algorithm": "ml-dsa-65",
  "version": 1
}
```

Errors: `400` · `401` · `403` · `409` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/keys" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"release-signing","algorithm":"ml-dsa-65"}'
```

## Get a key

`GET /api/v1/keys/{name}`

One key: its algorithm, when it was made, its state and its current version.

- Authentication: API key, role `auditor` or higher
- Metered: no

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `name` | path | string, required | The key's name: 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit. |

Response `200` (`application/json`): [KeyDetail](#schema-keydetail)

```json
{
  "name": "release-signing",
  "algorithm": "ml-dsa-65",
  "created": 1764806400,
  "state": "active",
  "version": 1
}
```

Errors: `401` · `403` · `404` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS "$AEGIS_URL/api/v1/keys/release-signing" \
  -H "Authorization: Bearer $AEGIS_API_KEY"
```

## Get a public key

`GET /api/v1/keys/{name}/public`

The current version's public key.

- Authentication: API key, role `auditor` or higher
- Metered: no

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `name` | path | string, required | The key's name: 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit. |

Response `200` (`application/json`): [PublicKey](#schema-publickey)

Errors: `401` · `403` · `404` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS "$AEGIS_URL/api/v1/keys/release-signing/public" \
  -H "Authorization: Bearer $AEGIS_API_KEY"
```

## Sign

`POST /api/v1/keys/{name}/sign`

Signs the message with the key's current version (pure, hedged, no context string). The signature is verified before it is returned.

- Authentication: API key, role `developer` or higher
- Metered: counts as one operation

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `name` | path | string, required | The key's name: 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit. |

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `message` | string (base64), required | The message, at most 1 MiB. Example: `"aGVsbG8gYWVnaXM="`. |

```json
{
  "message": "aGVsbG8gYWVnaXM="
}
```

Response `200` (`application/json`): [Signature](#schema-signature)

Errors: `400` · `401` · `403` · `404` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/keys/release-signing/sign" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"aGVsbG8gYWVnaXM="}'
```

## Verify

`POST /api/v1/keys/{name}/verify`

Checks a signature over the message with one of the key's versions.

- Authentication: API key, role `developer` or higher
- Metered: counts as one operation

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `name` | path | string, required | The key's name: 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit. |

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `message` | string (base64), required | The message that was signed, at most 1 MiB. Example: `"aGVsbG8gYWVnaXM="`. |
| `signature` | string (base64), required | The signature, as `sign` returned it. Example: `"<base64 signature>"`. |
| `version` | integer | The key version that signed (`sign` returns it). Defaults to 1. Example: `1`. |

```json
{
  "message": "aGVsbG8gYWVnaXM=",
  "signature": "<base64 signature>",
  "version": 1
}
```

Response `200` (`application/json`): [Verification](#schema-verification)

Errors: `400` · `401` · `403` · `404` · `429` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/keys/release-signing/verify" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"aGVsbG8gYWVnaXM=","signature":"<base64 signature>","version":1}'
```

## Export a key, wrapped

`POST /api/v1/keys/{name}/export`

> **Not available yet:** The route exists, but exporting a key made by the cloud does not complete in the current release (Aegis Core 0.13.0).

Exports the key wrapped with HPKE to your own hybrid post-quantum public key, so only you can open it. Never metered and never blocked by the quota.

Only hybrid KEMs are accepted for the wrapping key, so an export is never weaker than the key it carries.

- Authentication: a signed-in session of an organisation `admin` or `owner`, from the app; API keys are refused
- Metered: no

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `name` | path | string, required | The key's name: 1 to 64 letters, digits, `-` or `_`, starting with a letter or digit. |

Request body, required (`application/json`):

| Field | Type | Description |
| --- | --- | --- |
| `kem` | string, one of `hpke-mlkem768-x25519`, `hpke-mlkem1024-p384`, required | The HPKE KEM of your public key. Example: `"hpke-mlkem768-x25519"`. |
| `public_key` | string (base64), required | Your public key for that KEM. Example: `"<base64 public key>"`. |

```json
{
  "kem": "hpke-mlkem768-x25519",
  "public_key": "<base64 public key>"
}
```

Response `200` (`application/json`): [WrappedExport](#schema-wrappedexport)

Errors: `400` · `401` · `403` · `404` · `503` ([what each means](https://docs.qblackbit.com/api/index.md#errors)).

Example:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/keys/release-signing/export" \
  -H "Authorization: Bearer $AEGIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kem":"hpke-mlkem768-x25519","public_key":"<base64 public key>"}'
```

## Schemas

### Algorithms

What the plan allows.

| Field | Type | Description |
| --- | --- | --- |
| `plan` | string | `free`, `pro` or `enterprise`. |
| `algorithms` | array of string | Key algorithms. |
| `hashes` | array of string | Hash functions. |
| `export_kems` | array of string | The hybrid KEMs a key may be exported to. |

### Config

The service's public settings.

| Field | Type | Description |
| --- | --- | --- |
| `data_location` | string | Where customer data is held. |
| `google` | boolean | Whether Google sign-in is on. |
| `password_min_length` | integer (int64) | The shortest password accepted. |
| `plans` | object | Every plan's limits. |
| `plans.free` | [PlanLimits](#schema-planlimits) |  |
| `plans.pro` | [PlanLimits](#schema-planlimits) |  |
| `turnstile_site_key` | string, nullable | The bot-check site key, when the public forms ask for one. |

### CreatedKey

A new key.

| Field | Type | Description |
| --- | --- | --- |
| `name` | string | The name. |
| `algorithm` | string | The algorithm. |
| `version` | integer (int64) | The current version: 1 for a new key. |

### Encapsulation

An encapsulation (passed through from Aegis Core).

| Field | Type | Description |
| --- | --- | --- |
| `algorithm` | string | The KEM. |
| `ciphertext` | string (base64) | The ciphertext to send to the private key's holder. |
| `shared_secret` | string (base64) | The shared secret. Treat it as a key: never log it. |
| `caution` | string, nullable | A caution Aegis adds for a retired or broken algorithm; absent for the algorithms the cloud offers. |

### HashResult

A digest (passed through from Aegis Core).

| Field | Type | Description |
| --- | --- | --- |
| `algorithm` | string | The hash function. |
| `digest` | string (base64) | The digest. |
| `caution` | string, nullable | A caution Aegis adds for a retired or broken algorithm; absent for the algorithms the cloud offers. |

### KeyDetail

One key.

| Field | Type | Description |
| --- | --- | --- |
| `name` | string | The name. |
| `algorithm` | string | The algorithm. |
| `created` | integer (int64) | When it was made, in seconds since the Unix epoch. |
| `state` | string | The key's state in Aegis Core, such as `active`. |
| `version` | integer (int64) | The current version. |

### KeyList

The organisation's keys.

| Field | Type | Description |
| --- | --- | --- |
| `keys` | array of [KeyEntry](#schema-keyentry) | Every key. |

### PublicKey

A public key (passed through from Aegis Core).

| Field | Type | Description |
| --- | --- | --- |
| `version` | integer (int64) | The current version. |
| `public_key` | string (base64) | The public key: its raw bytes, in base64. |

### Signature

A signature (passed through from Aegis Core).

| Field | Type | Description |
| --- | --- | --- |
| `algorithm` | string | The algorithm. |
| `version` | integer (int64) | The version that signed; send it to `verify`. |
| `signature` | string (base64), nullable | The signature. |
| `envelope` | string (base64), nullable | Not used by the cloud API (always absent). |
| `caution` | string, nullable | A caution Aegis adds for a retired or broken algorithm; absent for the algorithms the cloud offers. |

### Usage

This month's usage.

| Field | Type | Description |
| --- | --- | --- |
| `month` | string | The calendar month (UTC), `YYYY-MM`. |
| `plan` | string | The plan. |
| `included` | integer (int64) | Operations the plan includes this month. |
| `used` | object | Operations used. |
| `used.included` | integer (int64) | Within the monthly allowance. |
| `used.from_balance` | integer (int64) | Drawn from the prepaid balance (Pro). |
| `remaining` | integer (int64) | What remains of the allowance. |
| `balance` | integer (int64) | The prepaid balance, in operations (Pro). |

### Verification

Whether the signature verifies (passed through from Aegis Core).

| Field | Type | Description |
| --- | --- | --- |
| `valid` | boolean | `true` when the signature is valid for this message and key version. |
| `caution` | string, nullable | A caution Aegis adds for a retired or broken algorithm; absent for the algorithms the cloud offers. |

### WrappedExport

The key wrapped to your public key with HPKE (RFC 9180), passed through from Aegis Core. Open it with your private key and the `info` given.

| Field | Type | Description |
| --- | --- | --- |
| `kem` | string, nullable | The HPKE KEM. |
| `kdf` | string, nullable | The HPKE KDF. |
| `aead` | string, nullable | The HPKE AEAD. |
| `enc` | string (base64), nullable | The encapsulated key. |
| `ciphertext` | string (base64), nullable | The wrapped key material. |
| `info` | string (base64), nullable | The HPKE info, which binds the key's terms. |
| `algorithm` | string, nullable | The key's algorithm. |
| `version` | integer (int64), nullable | The version wrapped. |
| `export` | string, nullable | The key's export policy. |
| `state` | string, nullable | The key's state. |
| `usages` | array of string | The key's usages. |
| `caution` | string, nullable | A caution Aegis adds for a retired or broken algorithm; absent for the algorithms the cloud offers. |

### PlanLimits

What a plan allows.

| Field | Type | Description |
| --- | --- | --- |
| `monthly_operations` | integer (int64) | Metered operations included each calendar month (UTC). |
| `algorithms` | array of string | Algorithms keys may be made with. |
| `hashes` | array of string | Hash functions `hash` accepts. |
| `rate_per_minute` | integer (int64) | Requests per minute for the organisation. |
| `max_keys` | integer (int64) | Keys the organisation may hold. |
| `export` | string, one of `wrapped`, `none` | How keys may leave the cloud: `wrapped` (to your own hybrid public key) or `none`. |

### KeyEntry

A key as the organisation's index lists it.

| Field | Type | Description |
| --- | --- | --- |
| `name` | string | The name. |
| `algorithm` | string | The algorithm. |
| `created` | integer (int64) | When it was made, in seconds since the Unix epoch. |
| `by` | string | The account that made it. |
