Skip to main content
On this page

REST API

Use the REST API under /api/v1 for scripts and integrations. Interactive session traffic uses WebSockets. Both apply the authenticated user’s permissions.

OpenAPI contract

The OpenAPI 3.1 document is embedded into the backend binary at compile time:

GET /api/v1/openapi/piping.openapi.yaml

Use it to inspect routes and generate typed clients (the web frontend derives its TypeScript API layer from this file).

Tip: Interactive session I/O (SSH/RDP/VNC) and playbook run streaming use WebSocket endpoints under /api/v1/ws/..., which sit outside the OpenAPI contract. See Connections and Jobs and runs.

Swagger UI in the product

Open API Docs in the sidebar (route /api-docs) for an embedded Swagger UI rendered from the same contract. It runs same-origin, so "Try it out" requests execute against your own instance with your current browser session — what works there is exactly what your RBAC policy allows (see Access control).

Authentication

MethodCarrierIntended for
Personal API tokenAuthorization: Bearer pat_... headerScripts, CI, AI agents
Session cookiepiping_session cookie (default name)Web UI, interactive use

When an Authorization: Bearer header is present, invalid tokens return 401 without falling back to cookie authentication.

Health probes (GET /api/v1/health, /api/v1/live, /api/v1/ready) require no authentication.

POST /api/v1/auth/login opens a session and sets the cookie; POST /api/v1/auth/logout ends it. OIDC sign-in lands in the same session model. Cookie name, TTL, and flags are configurable — see Configuration.

curl -c jar.txt -X POST https://piping.example.com/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"identifier": "admin", "password": "..."}'

curl -b jar.txt https://piping.example.com/api/v1/auth/me

Personal API tokens

Create tokens in Account → Settings → API Tokens (see User settings) or via POST /api/v1/user/settings/api-tokens. The full token value — pat_<token-id>_<secret> — is returned exactly once, at creation; afterwards only the prefix is visible.

Tokens are scoped: each scope is an action + resource-type pair with an optional resource pattern, narrowing what the token may do within the owner's own permissions. Expiry is optional per token; when set, it is clamped to a configurable range (60 seconds to 1 year by default). By default a user may hold up to 20 active tokens. Token auth can be disabled instance-wide with PIPING_AUTH__API_TOKENS__ENABLED=false.

curl -H "Authorization: Bearer pat_..." \
  "https://piping.example.com/api/v1/inventory/devices?limit=10"

Personal API tokens are also the only credential accepted by the MCP endpoint.

Conventions

Versioning. All routes live under /api/v1.

Errors. Every 4XX/5XX response body is the same envelope:

{
  "code": "NOT_FOUND",
  "message": "Device not found",
  "reasonCode": "NOT_FOUND",
  "traceId": "019ac3f1-8d2b-7c4e-9f10-2b6d5a7e8c01",
  "otelTraceId": "4bf92f3577b34da6a3ce929d0e0e4736"
}

code is the error class. reasonCode refines it, or equals code when no refinement applies. traceId matches the x-request-id header; otelTraceId matches trace_id in spans and logs when trace export is enabled (see Observability). Optional details carries recovery data; for example, 409 with code: "DELETE_BLOCKED" includes the blocking references.

Pagination. List endpoints take limit (default 50, maximum 1000) and offset query parameters and return { items, total, limit, offset }.

API areas

Operations are grouped by OpenAPI tag:

TagsCovers
inventoryInventory CRUD — devices, IPAM, DCIM, tenancy and virtualization. See Inventory.
custom-fieldsCustom-field definitions, reusable choice sets, and the reveal route for secret-valued fields. See Inventory
connections, connection-config, config-contexts, proxy-nodesSession launch, lifecycle, and file transfer; connection records and assignments; config contexts; proxy fleet. See Connections, Connection config, Proxy nodes
cctvCamera and recorder control for one target — capabilities, channels, live view, snapshots, archive search, playback, export, PTZ, and on-device user accounts. See CCTV
devicesFleet-wide CCTV device-user operations. Despite the tag name these are not inventory devices, and they have no dedicated screen. See CCTV
playbooksPlaybook definitions, runs, and jobs. See Jobs and runs
monitoringMonitoring configuration — exporters, metric sets, query sources, service-discovery settings
access-control, auth, oidcUsers, groups, roles, policies; login and sessions; OIDC settings. See Access control
providers, provider-registry, mapping-specs, sync-jobsExternal inventory sources and synchronization. See Inventory sync
user-settingsProfile preferences, personal API tokens, credential sets. See User settings
webhook-subscriptions, webhooksOutbound webhook subscriptions and the inbound NetBox webhook receiver. See Webhooks
secrets, secret-fieldsSecrets engine. See Secrets
assistant, mcpAI assistant sessions; the MCP JSON-RPC endpoint. See Assistant, MCP
auditAudit event queries. See Audit log
licenseLicense state, activation, refresh. See Licensing
settings, admin-settings, instance-branding, setup-wizardEffective and default platform settings, branding, first-run wizard. See Platform settings, Branding
administrationFull-instance backup export and import. See Inventory transfer
healthHealth probe

CCTV operations under /api/v1/cctv/{target_id}/... use the connection-target UUID, not an inventory device ID. Fleet user operations are at /api/v1/device-fleet/users:preview, :create and :delete under the devices tag. Required permissions are listed in CCTV.

For the exact request and response schema of any operation, open the embedded API Docs page or download the contract YAML — both always reflect your installed version.