---
title: "HTTP API"
description: "Every endpoint the Desktop Notary serves, what each requires of the caller, and the errors a client should handle."
source: "EQTY Notary"
---
The notary serves one HTTP/1.1 API over its Unix socket and its loopback TCP listeners; see
[Listeners](../install/overview.mdx#listeners). It is the surface the EQTY Notary serves inside
a confidential VM, so the EQTY SDK's `Signer::vcomp_notary(url)` drives it unmodified. All request
and response bodies are JSON. Errors return a plain-text body with the status code; clients branch
on the code.

**The caller never names the key it signs under.** There is no `?binary=` selector. The
connection's PID is resolved to the binary that opened it, and that binary's key is the one that
answers. A caller the notary cannot attribute is refused with `403`, never served under the
notary's own key.

Two keys are in play:

| Key         | DID field    | What it is                                                                                                   |
| ----------- | ------------ | ------------------------------------------------------------------------------------------------------------ |
| **system**  | `executedOn` | The notary's own key, in the TPM or Secure Enclave, whose credential carries the platform evidence. Roots the chain. |
| **process** | `operatedBy`, `registeredBy` | Minted per registered binary and issued *by* the system key. What `/v1/sign` uses.         |

Over the Unix socket with `curl`, the hostname is ignored and only has to parse:

```sh
curl --unix-socket /var/run/eqty-notary/eqty-notary.sock http://x/v1/registrations
```

## Health

### `GET /`

Build info. No PID gate.

```json
{ "status": "ok", "backend": "Linux-TPM", "observer": "Linux-eBPF", "key_guard_active": true }
```

`backend` is `Linux-TPM`, `Linux-TPM-stub`, `macOS-SecureEnclave`, `Windows-PCP` or `none`;
`observer` is `Linux-eBPF`, `macOS-kqueue`, `macOS-EndpointSecurity`, `Windows-ETW` or `none`.
`/healthz` is an alias.

### `GET /v1/isReady`

`200 {"status":"ready","state":"READY"}` only after this daemon invocation produced its own
identity credential; `503 {"status":"pending",…}` otherwise. An old credential file cannot make a
failed startup appear ready. A configured listener that fails to come up terminates the service.

### `GET /v1/audit_status`

Audit completeness: `complete`, `droppedEvents`, `logFailures`, `storedBytes`, the configured
per-file, total-byte and retention limits, and on Linux the per-hook state of the key guard under
`keyGuard`. A nonzero loss count means the [audit logs](./audit-log.mdx) are incomplete; signing
can still be available.

## Keys and identity

### `GET /v1/public_key`

The key that would sign for this caller.

```json
{ "status": "ok", "public_key": "02…", "did": "did:key:z…",
  "curve": "SECP256r1", "alg": "ES256", "type": "process", "binary_hash": "…" }
```

`?key_type=system` returns the notary's own key instead. `public_key` is the SEC1-compressed
point, 33 bytes, lower-case hex.

### `GET /v1/system_public_key`

The notary's own key, read out of the identity credential so the two can never disagree.

### `GET /get_dids`

The DID triple a manifest uses. Alias `GET /v1/get_dids`. Requires an attributable caller.

```json
{ "executedOn": "did:key:z…", "operatedBy": "did:key:z…", "registeredBy": "did:key:z…" }
```

`executedOn` is the notary's key: what hardware this ran on. `operatedBy` is the caller's, unless
`EQTY_OPERATED_BY` overrides it; set but empty names no operator, and is emitted rather than
dropped because the SDK falls back to the signing key when the field is missing. `registeredBy`
always identifies the caller's signing key and is unaffected by the override.

### `GET /v1/credential`

The credential document: a `{version, contexts, statements, blobs}` manifest holding the notary's
own identity credential and, for a tracked caller, the credential issued for that caller's key. A
caller the notary cannot attribute still gets the notary's own credential. Alias
`GET /v1/did_registration`, kept because the SDK asks for that path.

**Nothing is registered by calling this.** The credentials carry their own evidence inline, so
the document stands on its own. See [Credentials](./credentials.mdx).

## Signing

### `POST /v1/sign`

PID-gated. Works over the Unix socket and loopback TCP alike.

```sh
curl -s -X POST http://127.0.0.1:8066/v1/sign \
     -H 'content-type: application/json' \
     -d '{"data":"68656c6c6f"}'
```

| Field  | Meaning                                       |
| ------ | --------------------------------------------- |
| `data` | **required**, the bytes to sign, lower-case hex |

```json
{ "status": "ok", "signature": "<hex r||s, 64 bytes>", "public_key": "02…",
  "did": "did:key:z…", "binary_hash": "…" }
```

The notary computes `SHA-256(data)` and signs the digest with the caller's binary key: raw P-256
ECDSA, `r` then `s`, 32 bytes each, no DER. `binary_hash` is the hash of the binary that backed
the signature, for audit logs.

Before signing, the notary checks three things about the caller, and returns `403` if any fails:
the PID is tracked; its start time still matches the value recorded at exec; and its live binary
(`/proc/<pid>/exe` on Linux, `proc_pidpath` on macOS, the image path and NTFS file id on Windows)
still hashes to the tracked binary.

The server self-verifies before returning, so a `200` is a valid signature. Clients that relay
signatures to third parties should still verify independently; see
[Verifying a signature](#verifying-a-signature).

## Registrations

### `POST /v1/registrations`

Declares a binary as eligible to sign and be tracked. Two body shapes:

```json
{ "binary_path": "/usr/bin/bash" }
```

```json
{ "hash": "<64 hex chars>", "inode": 1234567 }
```

The first is the common case: the daemon canonicalizes and hashes the file. Path registration
requires an attributable local caller and a regular executable file that caller can read and
execute; hashing uses a pinned descriptor, bounded chunks, a 256 MiB maximum and four concurrent
workers. The second is for a client that already hashed the file and knows the inode, such as a
binary inside a container. The daemon does not check that the hash matches the file; it trusts
the caller, and nothing will ever be tracked under a hash whose content never execs.

```json
{ "binary_hash": "…", "binary_path": "/usr/bin/bash", "inode": 1234567,
  "did": "did:key:z…", "public_key": "02…", "key_reused": false }
```

`inode` is what the kernel-side filter is keyed by. It changes when the file is replaced, by an
`apt upgrade` for example; re-register then. `key_reused` is `true` when the keystore already
held a key for this hash. The call is idempotent.

### `GET /v1/registrations`

```json
{ "registrations": [ { "binary_hash": "…", "binary_path": "/usr/bin/bash", "inode": 1234567,
  "did": "did:key:z…", "public_key": "02…", "tracked_pids": 3 } ] }
```

### `DELETE /v1/registrations/{hash}`

Removes the inode from the observer and decrements the keystore refcount. `204` on success,
`404` for an unknown hash. PIDs already tracked under the hash keep signing until they exit;
pulling the capability from an in-flight process would be surprising. The key blob stays on
disk, so re-registering the same hash reloads the same key.

### `GET /v1/processes`

The PIDs currently tracked.

```json
{ "processes": [ { "pid": 12345, "unique_tag": 987654, "binary_hash": "…",
  "did": "did:key:z…", "log_path": "/var/log/eqty-notary/pid-12345-987654.jsonl" } ] }
```

`unique_tag` is the process start time (clock ticks since boot on Linux), used to detect PID
reuse.

## vTPMs

Over the Unix socket only; over TCP every route answers `403`. Root may do everything. A vTPM's
owner, the `client` uid, may list, show, start and stop **that** vTPM; `EQTY_VTPM_OWNER_OPS`
narrows this. Create and delete are root-only. Another user's vTPM answers `404`.

| Route                           | What it does                                                                                    |
| ------------------------------- | ----------------------------------------------------------------------------------------------- |
| `POST /v1/vtpms`                | `{"id"?, "backing"?, "client"?: {"uid", "gid"}}`. Creates, provisions and starts a vTPM. `client` owns its sockets. |
| `GET /v1/vtpms`                 | Lists vTPMs.                                                                                    |
| `GET /v1/vtpms/{id}`            | One vTPM: sockets, emulator hashes, backing keys, `issuerChainPem`.                             |
| `POST /v1/vtpms/{id}/start`     | Starts it.                                                                                      |
| `POST /v1/vtpms/{id}/stop`      | Stops it.                                                                                       |
| `DELETE /v1/vtpms/{id}`         | Crypto-shreds it.                                                                               |

`eqty-notaryctl vtpm` wraps these. See [Hardware-rooted vTPMs](../../notary-backed-vtpm/index.mdx).

## Errors

| HTTP  | Body fragment                            | Meaning and action                                                                                           |
| ----- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `400` | `missing 'binary_path' or 'hash'`        | Bad registration body.                                                                                       |
| `400` | `raw-hash registration requires 'inode'` | Hash form without an inode.                                                                                  |
| `400` | `canonicalize <path>: …`                 | File not found or unreadable.                                                                                |
| `400` | `data must be hex`                       | The `data` field is missing or not hex.                                                                      |
| `403` | `caller pid not tracked`                 | The most common runtime error. The binary was not registered; or it was registered after the process started; or the file on disk no longer matches the registered hash; or the process exec'd an unregistered binary mid-run. With auto-registration on, this means the notary could not attribute the connection at all. |
| `403` | `live unique_tag mismatch`               | The PID was reused: the tracked process died and a new one took its PID. Reconnect from a fresh process.    |
| `404` | `no such registration`                   | `DELETE` on an unknown hash.                                                                                 |
| `500` | `mint_or_load: …`, `sign: …`             | A TPM or Secure Enclave error. Often transient; retry once with backoff.                                      |
| `500` | `observer register_binary: …`            | The observer's map is full (1024 slots by default). Unregister something or restart the daemon.             |

## Verifying a signature

The signature is raw `r||s`. Most ECDSA libraries take it directly or through a helper.

```python
from cryptography.hazmat.primitives.asymmetric import ec, utils
from cryptography.hazmat.primitives import hashes

def verify(pubkey_hex: str, sig_hex: str, data_hex: str) -> bool:
    sig = bytes.fromhex(sig_hex)
    der = utils.encode_dss_signature(int.from_bytes(sig[:32], "big"), int.from_bytes(sig[32:], "big"))
    pk = ec.EllipticCurvePublicKey.from_encoded_point(ec.SECP256R1(), bytes.fromhex(pubkey_hex))
    try:
        pk.verify(der, bytes.fromhex(data_hex), ec.ECDSA(hashes.SHA256()))
        return True
    except Exception:
        return False
```

### DID derivation

The DID is the W3C `did:key` for P-256: `did:key:z` followed by the base58btc encoding of the
multicodec prefix `0x80 0x24` and the 33-byte compressed public key. Clients can recompute it to
check that the DID the daemon returns matches its public key.

```python
import base58  # pip install base58

def derive_did(compressed_pubkey_hex: str) -> str:
    return "did:key:z" + base58.b58encode(b"\x80\x24" + bytes.fromhex(compressed_pubkey_hex)).decode()
```

## Operational notes

- **Binary updates.** When a file is replaced, its inode changes and usually its hash too. The
  old registration is stale: re-register. The old key is kept, keyed by the old hash, and is
  used again only if something with the old content ever execs.
- **Concurrency.** A TPM is serial, and signs on the order of tens of P-256 signatures per second
  on hardware. The daemon serializes callers; concurrent requests are safe but queue.
- **No API keys.** There is no authentication beyond the caller's PID. Any local process can
  register binaries and read the public endpoints. The notary does not protect against root on
  the host; see [Security](./security.mdx).