query-attribute-workload-resources-stats
dci query-attribute-workload-resources-stats [body] [flags]
Returns aggregated totals for one workload in a date range: its total cost, the number of
cloud resources it used (dimensionRowCount, the row count of
queryAttributeWorkloadResourcesTable), and the percent change of the total against the
previous period of the same length. Use queryAttributeWorkloadResourcesTable for the
resource rows.
Get workloadId from a workload row of queryAttributeWorkloadsTable. An ID that does not
decode returns 404. The request body holds the filters; this operation only reads data.
Freemium customers (no paid Attribute plan) see network cost only, and only for the last 60 days.
Authenticate with Authorization: Bearer <token>. Omit X-Tenant-Id when the credential
resolves to one customer. When the credential can act on several customers, send
X-Tenant-Id: <tenant-id> to select one.
Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.
Request
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
workloadId | string | yes | Opaque ID of one workload. Copy it unchanged from the workloadId of a workload row of queryAttributeWorkloadsTable; do not build or change it. An ID that does not decode returns 404. |
filterConditions | one of 2 variants | yes | The filters, as an object with exactly one key: and (every item must match) or or (at least one item must match). Each item is a condition or a group of conditions. Send \{"and": []\} for no filter. |
Raw JSON schema
{
"type": "object",
"required": [
"workloadId",
"filterConditions"
],
"properties": {
"workloadId": {
"type": "string",
"minLength": 1,
"description": "Opaque ID of one workload. Copy it unchanged from the `workloadId` of a `workload` row of\n`queryAttributeWorkloadsTable`; do not build or change it. An ID that does not decode\nreturns 404."
},
"filterConditions": {
"description": "The filters, as an object with exactly one key: `and` (every item must match) or `or` (at\nleast one item must match). Each item is a condition or a group of conditions. Send\n`{\"and\": []}` for no filter.",
"oneOf": [
{
"type": "object",
"title": "All of",
"additionalProperties": false,
"required": [
"and"
],
"properties": {
"and": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
},
{
"description": "A nested group of conditions, joined with AND or with OR. Groups cannot nest further.",
"oneOf": [
{
"type": "object",
"title": "All of",
"additionalProperties": false,
"required": [
"and"
],
"properties": {
"and": {
"type": "array",
"items": {
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
}
}
}
},
{
"type": "object",
"title": "Any of",
"additionalProperties": false,
"required": [
"or"
],
"properties": {
"or": {
"type": "array",
"items": {
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
}
}
}
}
]
}
]
}
}
}
},
{
"type": "object",
"title": "Any of",
"additionalProperties": false,
"required": [
"or"
],
"properties": {
"or": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
},
{
"description": "A nested group of conditions, joined with AND or with OR. Groups cannot nest further.",
"oneOf": [
{
"type": "object",
"title": "All of",
"additionalProperties": false,
"required": [
"and"
],
"properties": {
"and": {
"type": "array",
"items": {
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
}
}
}
},
{
"type": "object",
"title": "Any of",
"additionalProperties": false,
"required": [
"or"
],
"properties": {
"or": {
"type": "array",
"items": {
"type": "object",
"description": "One condition on one field.",
"required": [
"var",
"operator",
"values"
],
"properties": {
"var": {
"type": "object",
"required": [
"field"
],
"properties": {
"field": {
"type": "string",
"description": "A field to filter on. Get its values from `listAttributeWorkloadsFilterValues`.\n\n- `name`: workload name. `type`: workload type. `namespace`: Kubernetes namespace.\n- `platform_name`, `platform_type`, `platform_region`: the cluster's name, type and region.\n- `accountId`: the cloud account of the cluster.\n- `platformCloudProvider`: the cloud the cluster runs on.\n- `resourceName`: the billed resource's ID. `resourceType`: the billed service.\n `resourceRegion`: the resource's region.\n- `resourceAccountId`, `resourceAccountName`: the cloud account (or project) that holds\n the resource.\n- `resourceCloudProvider`: the cloud that billed the resource.\n- `costDescription`: the billing SKU description.",
"enum": [
"accountId",
"costDescription",
"name",
"namespace",
"platform_name",
"platform_region",
"platform_type",
"platformCloudProvider",
"resourceAccountId",
"resourceAccountName",
"resourceCloudProvider",
"resourceName",
"resourceRegion",
"resourceType",
"type"
]
}
}
},
"operator": {
"type": "string",
"description": "`in` / `not_in`: the field equals / does not equal one of `values` (exact match).\n`contains` / `not_contains`: the field contains / does not contain one of `values` as a\nsubstring. `exists` / `not_exists`: the field has / has no value; send `values: []`.",
"enum": [
"in",
"not_in",
"contains",
"not_contains",
"exists",
"not_exists"
]
},
"values": {
"type": "array",
"description": "The values to compare with. Send an empty array for `exists` and `not_exists`.",
"items": {
"type": "string"
}
}
}
}
}
}
}
]
}
]
}
}
}
}
],
"example": {
"and": [
{
"var": {
"field": "namespace"
},
"operator": "in",
"values": [
"checkout"
]
},
{
"or": [
{
"var": {
"field": "platformCloudProvider"
},
"operator": "in",
"values": [
"AWS"
]
},
{
"var": {
"field": "resourceType"
},
"operator": "contains",
"values": [
"Storage"
]
}
]
}
]
}
}
}
}
Flags
| Flag | Type | Default | Example | Description |
|---|---|---|---|---|
--from | string (date) | 2026-09-01 | First day of the date range (UTC), inclusive, as YYYY-MM-DD. The change fields compare with the period of the same length right before this day. Freemium customers (no paid Attribute plan) can only read the last 60 days: a from earlier than today minus 60 days (UTC) returns 403. | |
--to | string (date) | 2026-09-30 | Last day of the date range (UTC), inclusive, as YYYY-MM-DD. Must be on or after from. |
Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.
Output
OK - Totals for the workload in the date range.
By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.
| Field | Type | Description |
|---|---|---|
totalCost | number | Total cost in the date range. |
count | number | Number of workloads with cost in the date range. |
dimensionRowCount | number | Number of distinct values of the dimension (for the w/resources operation: number of resources). Equals the total row count of the matching table operation. |
change | number | Percent change of totalCost against the previous period of the same length. Null when the previous total is 0. |
Raw JSON schema
{
"type": "object",
"properties": {
"totalCost": {
"type": "number",
"nullable": true,
"description": "Total cost in the date range."
},
"count": {
"type": "number",
"nullable": true,
"description": "Number of workloads with cost in the date range."
},
"dimensionRowCount": {
"type": "number",
"nullable": true,
"description": "Number of distinct values of the dimension (for the `w/resources` operation: number of\nresources). Equals the total row count of the matching table operation."
},
"change": {
"type": "number",
"nullable": true,
"description": "Percent change of `totalCost` against the previous period of the same length. Null\nwhen the previous total is 0."
}
}
}
Errors
On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.
HTTP status to exit code mapping
| HTTP status | Exit code | Error code | Meaning |
|---|---|---|---|
| 400 | 30 | VALIDATION_ERROR | The arguments or request body were rejected. Review the command's flags and payload. |
| 401 | 10 | AUTHENTICATION_FAILED | Not signed in, or the API token is invalid. Run dci login or check DCI_API_KEY. |
| 403 | 11 | PERMISSION_DENIED | The DoiT user or the active customer context does not have access. |
| 404 | 20 | RESOURCE_NOT_FOUND | The requested resource does not exist. Check the identifier argument. |
| 409 | 21 | RESOURCE_CONFLICT | The operation conflicts with the resource's current state. |
| 500, 502, 503 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- get-attribute-workload-details — Get one workload's identity
- get-attribute-workloads-cost-data-status — Check whether workload cost data exists
- get-attribute-workloads-signals — Get workloads that need attention
- list-attribute-workload-non-network-resource-types — List one workload's non-network resource types
- list-attribute-workloads-cloud-providers — List the cloud providers that billed workload resources
- list-attribute-workloads-filter-values — List the values of a workload filter field
- list-attribute-workloads-resource-tag-keys — List resource tag keys
- list-attribute-workloads-resource-tag-values — List the values of one resource tag key
- query-attribute-workload-resources-over-time — Get one workload's resource cost over time
- query-attribute-workload-resources-table — List one workload's cloud resources
- query-attribute-workloads-over-time — Get Kubernetes workload cost over time
- query-attribute-workloads-stats — Get Kubernetes workload cost totals
- query-attribute-workloads-table — List Kubernetes workload costs by dimension
- API reference: POST /attribute/v1/workloads/w/resources/stats
Aliases: queryattributeworkloadresourcesstats