DocsAPI ReferenceAssets API

Assets API

Read, create, update, soft-delete and export infrastructure assets, with filtering, pagination, merged-asset redirects, criticality and classification. Reads are open to every role (and to API tokens with read:inventory); writes need a manager or admin.


List Assets

Retrieve a paginated list of all assets in the inventory. The response includes standard pagination fields (count, next, previous) and an array of asset objects in the results field. All query parameters are optional and can be combined to narrow the result set.

GET /api/v1/assets/

# Example: active VMs of deployment environment 2, sorted by name
curl -X GET "https://idp.example.com/api/v1/assets/?asset_type=vm&environment=2&ordering=name" \
  -H "Authorization: Bearer {access_token}"

# Response (excerpt)
{
  "count": 142,
  "next": "https://idp.example.com/api/v1/assets/?page=2",
  "previous": null,
  "results": [
    {
      "id": 412,
      "uid": "azure-vm-abc123",
      "name": "web-server-01",
      "asset_type": "vm",
      "status": "running",
      "discovery_zone": 1,
      "discovery_zone_name": "Azure Production",
      "environment": 2,
      "environment_name": "Production",
      "region": "westus2",
      "owner_ref_name": "Alice Chen",
      "team_ref_name": "Platform Engineering",
      "effective_criticality": "high",
      "internet_exposed": false,
      "is_active": true,
      "last_seen": "2025-06-01T14:22:00Z",
      "tags": ["frontend"]
    }
  ]
}

Filters & Ordering

Filters are query parameters and can be combined. Without is_active the list returns only active assets. search is a case-insensitive match on name, display_name, owner, team, external_id and uid.

  • asset_type: exact asset type (see List Asset Types)
  • discovery_zone: id of a discovery zone; returns the assets seen by that zone, including assets merged into an asset of another zone (cross-zone deduplication)
  • environment_type: discovery zone type (azure, gcp, kubernetes, agent, ...), with the same "seen by" rule
  • environment (alias deployment_environment): id of a deployment environment, or none for assets without one
  • region, status: case-insensitive exact match; name, owner, team: case-insensitive substring
  • owner_ref, team_ref: id of the owning operator or team; owner_locked, team_locked: true/false
  • tag: assets whose tags list contains the value
  • has_parent: true/false
  • is_active: true/false (false lists soft-deleted assets)
  • last_seen_after, last_seen_before, created_after, created_before: ISO 8601 date-times
  • search: free text (see above)

Note: Ordering: ?ordering= with name, created_at, last_seen, asset_type or status (prefix - for descending); the default is -last_seen. Pagination: ?page= and ?page_size=.

Get Asset Detail

Retrieve the full details of a single asset by its unique identifier (UID); UIDs may contain colons. Soft-deleted assets are found too. When the UID belongs to an asset that was merged into another one (cross-zone deduplication), the surviving asset is returned with redirected_from set to the requested UID; writes through an old UID get 404 naming the current one.

GET /api/v1/assets/{uid}/

# Example
curl -X GET https://idp.example.com/api/v1/assets/azure-vm-abc123/ \
  -H "Authorization: Bearer {access_token}"

Create Asset

Manually create a new asset (manager or admin). Writable fields: uid (unique), external_id, name, display_name, asset_type, discovery_zone, environment, parent, region, zone, tags, labels, attributes, owner, team, status, discovered_by and source_data.

POST /api/v1/assets/

curl -X POST https://idp.example.com/api/v1/assets/ \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "uid": "manual-db-prod-01",
    "name": "Primary PostgreSQL",
    "asset_type": "database",
    "environment": 2,
    "region": "us-east-1",
    "tags": ["postgresql"]
  }'

Update Asset

Partially update an asset with PATCH (manager or admin). Updatable fields: name, display_name, parent, tags, labels, attributes, owner, team, status, owner_ref, team_ref, owner_locked, team_locked, criticality, criticality_locked, internet_exposed, exposure_locked, is_active and ai_classification. Changing criticality or exposure recomputes the priority of the asset findings.

PATCH /api/v1/assets/{uid}/

# Example: assign an owning team (locked against discovery) and a criticality
curl -X PATCH https://idp.example.com/api/v1/assets/azure-vm-abc123/ \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ "team_ref": 3, "team_locked": true, "criticality": "high" }'

Delete Asset (Soft Delete)

Delete an asset by setting its is_active flag to false (manager or admin). This is a soft delete: the asset stays in the database and is excluded from the default list; it can be restored.

Note: To include soft-deleted assets in list queries, explicitly pass is_active=false as a filter.

DELETE /api/v1/assets/{uid}/

# Example
curl -X DELETE https://idp.example.com/api/v1/assets/azure-vm-abc123/ \
  -H "Authorization: Bearer {access_token}"

# Returns 204 No Content on success

Restore Asset

Undo a soft delete by restoring an inactive asset back to active status. This sets is_active back to true and makes the asset visible in default list queries again.

POST /api/v1/assets/{uid}/restore/

# Example
curl -X POST https://idp.example.com/api/v1/assets/azure-vm-abc123/restore/ \
  -H "Authorization: Bearer {access_token}"

Asset Dependencies

Retrieve the list of dependencies for a specific asset. Dependencies represent relationships such as network connections, database links, API calls, and containment hierarchies. Each dependency includes the source, target, dependency type, and optional metadata like port, protocol, and confidence score.

GET /api/v1/assets/{uid}/dependencies/?limit=200

# Example
curl -X GET "https://idp.example.com/api/v1/assets/azure-vm-abc123/dependencies/?limit=200" \
  -H "Authorization: Bearer {access_token}"

# Response (at most `limit` per direction, default 200, max 1000; most recently seen first)
{
  "incoming": [ { "id": 7, "source_detail": {"uid": "k8s-pod-1", "name": "pod-1", "asset_type": "kubernetes_pod"}, "target_detail": {"uid": "azure-vm-abc123", "name": "vm", "asset_type": "vm"}, "dependency_type": "network", "port": 443, "protocol": "tcp", "confidence": 0.9 } ],
  "outgoing": [],
  "counts": { "incoming": 2500, "outgoing": 0 },
  "limit": 200,
  "truncated": true
}

Asset Children

Retrieve the active child assets of a parent asset (for example the containers of a host or the pods of a cluster).

GET /api/v1/assets/{uid}/children/?page=1&page_size=20

# Example
curl -X GET https://idp.example.com/api/v1/assets/k8s-node-01/children/ \
  -H "Authorization: Bearer {access_token}"

# Response (paginated like the asset list)
{
  "count": 12,
  "next": "...?page=2",
  "previous": null,
  "results": [ { "uid": "k8s-pod-1", "name": "pod-1", "asset_type": "kubernetes_pod" } ]
}

Classify Asset

Run the classification of an asset on demand (re-evaluates its type and categorization from its metadata).

POST /api/v1/assets/{uid}/classify/

# Example
curl -X POST https://idp.example.com/api/v1/assets/manual-db-prod-01/classify/ \
  -H "Authorization: Bearer {access_token}"

Criticality, Coverage and Topology

Other asset actions used by the UI:

# Set the criticality of many assets at once (manager or admin)
POST /api/v1/assets/bulk-criticality/
{ "asset_ids": [12, 13], "criticality": "high" }   # "unset" clears the lock
# -> { "criticality": "high", "requested": 2, "updated": 2 }

# Coverage of the last agent report (collector, scope, status)
GET /api/v1/assets/{uid}/coverage/

# Topology graph centred on the asset, depth 1..5 (default 2)
GET /api/v1/assets/{uid}/topology/?depth=2

List Asset Types

List the asset type definitions of the registry, ordered by category and name, with the label, category, color and icon the UI uses.

GET /api/v1/assets/types/

# Response
[
  { "value": "vm", "label": "Virtual Machine", "category": "compute", "color": "#3b82f6", "icon": "server" }
]

Asset Statistics

Retrieve aggregate statistics about the asset inventory including total, active and inactive counts plus breakdowns by asset type, discovery zone and deployment environment (each a list of objects with a count). This endpoint powers the dashboard widgets and summary views.

GET /api/v1/assets/stats/

# Accepts the same filters as the asset list (e.g. ?discovery_zone=1&asset_type=vm)

# Response
{
  "total": 1847,
  "active": 1793,
  "inactive": 54,
  "by_type": [
    { "asset_type": "container", "count": 685 },
    { "asset_type": "vm", "count": 420 }
  ],
  "by_zone": [
    { "discovery_zone__name": "Production Kubernetes", "discovery_zone__environment_type": "kubernetes", "count": 997 }
  ],
  "by_environment": [
    { "environment__name": "Production", "environment__kind": "production", "count": 892 }
  ]
}

Export Assets

Export the asset inventory as CSV (default), JSON or XLSX. The export accepts the list filters, so you can export a targeted subset. The format goes in ?export_format= (preferred) or ?format=.

  • csv: comma-separated values, streamed
  • json: JSON array of asset objects
  • xlsx: Excel workbook with formatted columns and headers
GET /api/v1/assets/export/?export_format=csv|json|xlsx
GET /api/v1/assets/export/applications/?export_format=xlsx|csv|json   # applications (default xlsx)

# Example: VMs of deployment environment 2 as CSV
curl "https://idp.example.com/api/v1/assets/export/?export_format=csv&environment=2&asset_type=vm" \
  -H "Authorization: Bearer {access_token}" \
  -o assets_export.csv

Export Dependencies

Export dependency records as CSV or JSON. Useful for analyzing relationships in external tools or generating compliance reports.

GET /api/v1/assets/export/dependencies/?export_format=csv|json

curl "https://idp.example.com/api/v1/assets/export/dependencies/?export_format=csv" \
  -H "Authorization: Bearer {access_token}" \
  -o dependencies_export.csv

Generate PDF Report

Download a PDF inventory report: the summary tables cover every matching asset, the detail table is capped at 5000 rows (use the CSV/XLSX export for the full list). The AI-written report is queued instead: it is emailed to the requester and announced with report_ready / report_failed on the WebSocket.

# PDF inventory report (accepts the list filters)
GET /api/v1/assets/export/report/

# AI-written report, emailed to the requester (manager or admin)
POST /api/v1/assets/export/report/generate/
{ "depth": 1, "environment": "" }   # depth 1 Executive, 2 Operational, 3 Technical
# -> { "task_id": "...", "status": "queued", "message": "Executive report generation started. ..." }

Asset Type Definitions

Manage the fingerprinting patterns used to classify discovered assets. Each type definition includes matching rules for SNMP OIDs, service banners, port patterns, and HTTP headers. Built-in definitions cannot be deleted but can be extended with custom ones.

GET /api/v1/assets/type-definitions/
GET /api/v1/assets/type-definitions/{id}/
POST /api/v1/assets/type-definitions/
PATCH /api/v1/assets/type-definitions/{id}/
DELETE /api/v1/assets/type-definitions/{id}/

# Additional endpoints
GET /api/v1/assets/type-definitions/categories/  # List all categories
GET /api/v1/assets/type-definitions/stats/        # Stats per category

Fingerprint & AI Classification

AsPeekIt provides dedicated endpoints for device fingerprinting and AI-powered classification. The fingerprint endpoint accepts raw device data and returns a best-match asset type. The AI endpoints use an LLM to classify assets from service banners or device metadata.

Note: The AI classification endpoints require the LLM service to be configured and running. Check /api/v1/assets/ai/status/ to verify availability.

# Fingerprint a device from raw data
POST /api/v1/assets/fingerprint/

# Check AI/LLM service status
GET /api/v1/assets/ai/status/

# AI-powered service identification from banner text
POST /api/v1/assets/ai/identify-service/

# AI-powered device classification from metadata
POST /api/v1/assets/ai/classify-device/