---
title: DSAR CLI
description: "@dsar/cli provides a command surface that maps to DSAR backend
  HTTP endpoints for agent and script usage."
group: reference-developer
---
> ⚠️ **Warning:** **Alpha**
> DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.

`@dsar/cli` provides a command surface that maps to DSAR backend HTTP endpoints for agent and script usage.

## Invocation

Local workspace:

```sh
dsar --help
```

Interactive wizard:

```sh
dsar
```

When launched without command args, the CLI enters interactive mode and guides:

1. API URL/output/token setup
2. command domain + command selection
3. required params/body fields
4. execute/edit/cancel confirmation

Published package flow:

```sh
npx dsar --help
```

## Environment and auth

* `DSAR_API_URL` (required unless overridden by `--api-url`)
* `DSAR_API_TOKEN` (optional bearer token)

Global flags:

* `--api-url`, `--token`, `--idempotency-key`, `--output`, `--json`

## CLI ↔ API mapping highlights

* `init` -> `POST /init`
* `status` -> `GET /status`
* `subjects get <subjectId>` -> `GET /subjects/{subjectId}`
* `policies list` -> `GET /policies`
* `policies custom register|activate|deactivate` -> custom policy endpoints
* `webhooks inbound resend` -> `POST /webhooks/inbound/resend`
* `requests create|capture` -> `POST /requests`, `POST /requests/capture`
* `requests clock explain <id>` -> `GET /requests/{id}/clock/explain`
* `requests verification ...` -> verification endpoints
* `requests fulfilment create <id>` -> `POST /requests/{id}/fulfilment`
* `requests delivery ...` -> delivery endpoints
* `requests manifest ...` -> manifest endpoints
* `requests appeals ...` -> appeals endpoints
* `requests notifications list|replay ...` -> notification history and replay
* `tenants retention get|put <tenantId>` -> retention endpoints
* `requests audit export|verify <id>` -> audit endpoints

Full parity route map lives in:

* `packages/cli/src/parity/route-map.ts`

## JSON output contract

When `--output json` is used:

* success: `{ ok: true, data, meta: { command } }`
* failure: `{ ok: false, error: { code, message }, meta? }`

Interactive mode still uses the same final output envelope after command execution.

## Notification replay

Notification replay is part of the current CLI surface:

* `dsar requests notifications list <request-id>`
* `dsar requests notifications replay <request-id> <event-id>`

## Parity policy

Any new backend OpenAPI path + method pair must include:

1. route parity entry in `packages/cli/src/parity/route-map.ts`
2. callable CLI command mapping
3. passing parity test
