get-widget
dci get-widget <widgetId>
Returns the latest precomputed cached result for one widget. This read does not refresh or recompute the widget synchronously.
Use either the customer-specific id returned by the list-widgets operation or one of these
stable aliases:
current-month-cloud-spend— total cloud spend accumulated during the current calendar month.current-month-cloud-forecast— forecast of total cloud spend for the current calendar month.
The two concrete alias requests are:
GET https://api.doit.com/analytics/v1/widgets/current-month-cloud-spendGET https://api.doit.com/analytics/v1/widgets/current-month-cloud-forecast
Authenticate with Authorization: Bearer <token>. Omit X-Tenant-Id when the credential
resolves to one customer. When the credential can act on multiple customers, send
X-Tenant-Id: <tenant-id> to select the customer. A 403 response means the caller or
selected customer is not authorized or entitled to use this API.
The result's period.endTime is exclusive. Monetary amount values are decimal strings and
currency values are ISO 4217 currency codes. monthToMonthGrowthPercentage and
monthToMonthGrowthAmount are both null when no comparable prior-period value exists.
widgetId— Stable widget alias or customer-specific widget ID returned by listWidgets. Use current-month-cloud-spend for current-month accumulated spend or current-month-cloud-forecast for the current-month forecast.
Output
OK - The widget and its latest precomputed result.
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 |
|---|---|---|
id | string | Customer- and tier-specific widget id. This value can vary between customers. |
alias | string | Stable customer-facing widget identifier. |
type | string | Whether the widget is supplied by DoiT or defined by a customer. One of: "custom", "preset". |
kind | string | Determines which property is populated in the widget's result. One of: "monetary_metric". |
generateTime | string (date-time) | Time when the cached result was generated by the background computation. |
result | object | Computed widget result. The populated property corresponds to kind. |
result.monetaryMetric | object | A monetary value over a period and its comparison with the equivalent prior period. monthToMonthGrowthPercentage and monthToMonthGrowthAmount are both null when no comparable prior-period value exists, such as when prior-period spend is zero. |
result.monetaryMetric.value | object | Current-period monetary value. amount is a decimal string and currency is an ISO 4217 code. |
result.monetaryMetric.value.amount | string | Decimal monetary amount at ISO 4217 minor-unit precision (string). |
result.monetaryMetric.value.currency | string | ISO 4217 currency code. |
result.monetaryMetric.period | object | UTC date-time range covered by the widget result. endTime is exclusive. |
result.monetaryMetric.period.startTime | string (date-time) | Inclusive start of the period. |
result.monetaryMetric.period.endTime | string (date-time) | Exclusive end of the period. |
result.monetaryMetric.monthToMonthGrowthPercentage | number (double) | Percentage change from the comparable prior period, or null when no comparison is available. |
result.monetaryMetric.monthToMonthGrowthAmount | object | Absolute monetary change from the comparable prior period, or null when no comparison is available. |
result.monetaryMetric.monthToMonthGrowthAmount.amount | string | Decimal monetary amount at ISO 4217 minor-unit precision (string). |
result.monetaryMetric.monthToMonthGrowthAmount.currency | string | ISO 4217 currency code. |
Example response (--output json)
{
"id": "widget-example-spend-01",
"alias": "current-month-cloud-spend",
"type": "preset",
"kind": "monetary_metric",
"generateTime": "2026-09-24T11:48:10.319Z",
"result": {
"monetaryMetric": {
"value": {
"amount": "865.24",
"currency": "USD"
},
"period": {
"startTime": "2026-09-01T00:00:00Z",
"endTime": "2026-10-01T00:00:00Z"
},
"monthToMonthGrowthPercentage": 12.34,
"monthToMonthGrowthAmount": {
"amount": "94.88",
"currency": "USD"
}
}
}
}
Raw JSON schema
{
"type": "object",
"description": "Widget metadata and its latest precomputed cached result.",
"required": [
"id",
"alias",
"type",
"kind",
"generateTime",
"result"
],
"properties": {
"id": {
"type": "string",
"description": "Customer- and tier-specific widget id. This value can vary between customers.",
"example": "widget-example-spend-01"
},
"alias": {
"type": "string",
"description": "Stable customer-facing widget identifier.",
"example": "current-month-cloud-spend"
},
"type": {
"type": "string",
"description": "Whether the widget is supplied by DoiT or defined by a customer.",
"enum": [
"custom",
"preset"
]
},
"kind": {
"type": "string",
"description": "Determines which property is populated in the widget's `result`.",
"enum": [
"monetary_metric"
]
},
"generateTime": {
"type": "string",
"format": "date-time",
"description": "Time when the cached result was generated by the background computation.",
"example": "2026-09-24T11:48:10.319Z"
},
"result": {
"type": "object",
"description": "Computed widget result. The populated property corresponds to `kind`.",
"required": [
"monetaryMetric"
],
"properties": {
"monetaryMetric": {
"type": "object",
"description": "A monetary value over a period and its comparison with the equivalent prior period.\n`monthToMonthGrowthPercentage` and `monthToMonthGrowthAmount` are both `null` when no\ncomparable prior-period value exists, such as when prior-period spend is zero.",
"required": [
"value",
"period",
"monthToMonthGrowthPercentage",
"monthToMonthGrowthAmount"
],
"properties": {
"value": {
"allOf": [
{
"type": "object",
"required": [
"amount",
"currency"
],
"properties": {
"amount": {
"type": "string",
"pattern": "^-?(0|[1-9]\\d*)(\\.\\d+)?$",
"description": "Decimal monetary amount at ISO 4217 minor-unit precision (string).",
"example": "100.00"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$",
"description": "ISO 4217 currency code.",
"example": "USD"
}
}
}
],
"description": "Current-period monetary value. `amount` is a decimal string and `currency` is an ISO 4217 code."
},
"period": {
"type": "object",
"description": "UTC date-time range covered by the widget result. `endTime` is exclusive.",
"required": [
"startTime",
"endTime"
],
"properties": {
"startTime": {
"type": "string",
"format": "date-time",
"description": "Inclusive start of the period.",
"example": "2026-09-01T00:00:00Z"
},
"endTime": {
"type": "string",
"format": "date-time",
"description": "Exclusive end of the period.",
"example": "2026-10-01T00:00:00Z"
}
}
},
"monthToMonthGrowthPercentage": {
"type": "number",
"format": "double",
"nullable": true,
"description": "Percentage change from the comparable prior period, or `null` when no comparison is available.",
"example": 12.34
},
"monthToMonthGrowthAmount": {
"allOf": [
{
"type": "object",
"required": [
"amount",
"currency"
],
"properties": {
"amount": {
"type": "string",
"pattern": "^-?(0|[1-9]\\d*)(\\.\\d+)?$",
"description": "Decimal monetary amount at ISO 4217 minor-unit precision (string).",
"example": "100.00"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$",
"description": "ISO 4217 currency code.",
"example": "USD"
}
}
}
],
"nullable": true,
"description": "Absolute monetary change from the comparable prior period, or `null` when no comparison is available."
}
}
}
}
}
}
}
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 |
|---|---|---|---|
| 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. |
| 500, 503 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- list-widgets — List widgets
- API reference: GET /analytics/v1/widgets/{widgetId}
Aliases: getwidget