
# tdx api

Send an admin HTTP request.

**Reads or writes, by method** · any management route

Accepts origin-relative paths only; redirects and cross-origin requests are refused. Uses auth status host-bound bearer rules. Successful JSON bodies are printed after mandatory recursive masking, before selection/jq; █ marks masked fields or values. Names containing token, secret, password, key, credential, authorization or cookie are masked, including csrfToken and revealed tokens. Response-derived strings under those names, and response values learned from credential links, secret assignments and embedded JSON, become global echo aliases only at 8 characters or longer; shorter strings are masked in place but may remain visible under innocent names, preserving short public metadata such as live. Request-secret aliases, known bearers and recognized tokedex_\<family>_ credentials retain no minimum; a response Bearer value is masked in place and becomes an echo alias only at 8 characters or longer. Numbers, booleans and null under secret names are masked in place, not collected as global echo strings, except that a non-negative integer or null under a token-count name such as contextWindowTokens is public. RFC 3339 timestamps and gateway entity ids (such as ws_ and a ULID) under secret names are masked in place but never become echo aliases. CLI source labels do not feed name-based echo collection; known bearer echoes are still scrubbed there. Strings containing secret markers, credential links (#reset/#invite and secret parameters), any tokedex_\<family>_ credential, Bearer text, embedded secret JSON/assignments or known bearer echoes (even short values/property names) are replaced WHOLE, not partially reconstructed. Raw text and up to two tolerant percent-decoding rounds are checked independently; invalid sequences stay opaque and any ambiguous/failed decoding masks the whole string, including public literal percentages. Over-masking public values and key metadata is intentional; there is no off switch. Arbitrary unknown secrets under innocent names or beyond the inspected encodings cannot be inferred. Excessive depth, node/secret counts, masked-name collisions or masking work fail closed on the whole value with a fixed notice naming only the limit kind. Non-JSON/unreadable bodies are withheld with a notice, all response headers remain private, and gateway errors use safe mapped diagnostics. Revealing admin routes carry a credential-masked notice when output is masked. Inference-key creation points to api-keys create --token-file or --secretless; do not repeat an accepted write to recover a masked credential. GET/HEAD reject --input bodies. --dry-run reads explicit input files/stdin and shows the masked actual method/path/body without HTTP or saved-credential lookup; authentication and gateway acceptance remain unverified.

```bash
tdx api <METHOD> <path> [flags]
```

**Arguments**

| Argument | Type | Description |
|---|---|---|
| `METHOD` | one of `GET`, `HEAD`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS` | Required. HTTP method; GET, HEAD and OPTIONS are non-mutating; only GET/HEAD are bodyless. |
| `path` | string | Required. Origin-relative admin path, optionally with query parameters. |

**Optional flags**

| Flag | Type | Default | Description |
|---|---|---|---|
| `-F`, `--field` | string |  | Repeat key=value; booleans, null and safe integers are typed; @file or @- reads UTF-8 text; nested [key] and final [] arrays supported. Query parameters for GET/HEAD or with --input, otherwise JSON body. Repeatable. |
| `--input` | path |  | Read a JSON body from a regular file or - for stdin; UTF-8, at most 1 MiB; stdin limited to 3 seconds. |

**Output fields** (inside `data`)

| Field | Type | Description |
|---|---|---|
| `request` | masked-request | Actual masked method/path; body included only in dry-run, otherwise withheld; █ marks masking. |
| `response` | masked-response\|null | HTTP success status and masked JSON body, or withheld notice; no response headers. |
| `source` | masked-bearer-source | Masked connection provenance; dry-run origin may be unobserved. |
| `preview` | write-preview\|null | Preview of a request that is not sent, unchecked by the gateway; null after execution. |

Every command also takes the [global flags](/cli/reference#global-flags) and reads the [environment variables](/cli/reference#environment-variables) that the command reference lists once.
