list-labels
dci list-labels [flags]
Returns a list of labels that your account has access to. Labels are listed in reverse chronological order by default.
CLI default view
dci list-labels presents a curated table by default:
- Columns:
name,type,color, andupdated (UTC)(fromupdateTime). - In interactive tables,
updated (UTC)renders in your local timezone and is titledupdated (local); machine formats, agent mode, and--utckeep UTC — see Timestamps and timezones. --output jsonand explicit-C/--fieldsselections return the raw fields documented below.
Examples
# Your labels, newest first (one page of 50).
dci list-labels
# Custom labels only, sorted by name (filter fields are name and type; sort fields are id, name, type, createTime, updateTime).
dci list-labels --filter type:custom --sort-by name --sort-order asc
# Labels whose name contains a word, case-insensitively (combines with `--filter` using AND).
dci list-labels --name-contains team
# Every label as JSON, for scripts.
dci list-labels --all --output json
Flags
| Flag | Type | Default | Example | Description |
|---|---|---|---|---|
--max-results | integer (int64) | 50 | The maximum number of results to return in a single page. Use the page tokens to iterate through the entire collection. | |
--page-token | string | Page token, returned by a previous call, to request the next page of results | ||
--filter | string | name:budget | An expression for filtering the results. Valid fields: name, type. | |
--name-contains | string | monthly spend | Case-insensitive substring match against the resource name. Combined with the "filter" parameter using AND semantics. | |
--sort-by | string | A field by which the results will be sorted. One of: "id", "name", "type", "createTime", "updateTime". | ||
--sort-order | string | Specifies the sort direction; accepts asc for ascending (lowest to highest) or desc for descending (highest to lowest). One of: "asc", "desc". |
Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.
Output
OK - The request succeeded.
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 |
|---|---|---|
pageToken | string | Page token, returned by a previous call, to request the next page of results. |
rowCount | integer | Total number of labels in the result set. |
labels | array of object | |
labels[].id | string | The unique identifier of the label. |
labels[].name | string | The name of the label. |
labels[].color | string | The color of the label. One of: "blue", "skyBlue", "teal", "mint", "lime", "softYellow", "apricot", "lavender", "purple", "rosePink", "slateGrey". |
labels[].type | string | The type of the label (custom or preset). One of: "custom", "preset". |
labels[].createTime | string (date-time) | The time when the label was created. |
labels[].updateTime | string (date-time) | The time when the label was last updated. |
Raw JSON schema
{
"type": "object",
"description": "Paged list of labels.",
"properties": {
"pageToken": {
"type": "string",
"description": "Page token, returned by a previous call, to request the next page of results."
},
"rowCount": {
"type": "integer",
"description": "Total number of labels in the result set."
},
"labels": {
"type": "array",
"items": {
"required": [
"id",
"name",
"color"
],
"type": "object",
"description": "Label metadata.",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier of the label."
},
"name": {
"type": "string",
"description": "The name of the label."
},
"color": {
"type": "string",
"enum": [
"blue",
"skyBlue",
"teal",
"mint",
"lime",
"softYellow",
"apricot",
"lavender",
"purple",
"rosePink",
"slateGrey"
],
"description": "The color of the label."
},
"type": {
"type": "string",
"enum": [
"custom",
"preset"
],
"description": "The type of the label (custom or preset)."
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "The time when the label was created."
},
"updateTime": {
"type": "string",
"format": "date-time",
"description": "The time when the label was last updated."
}
}
}
}
}
}
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. |
Related
- get-label — Retrieve a label
- create-label — Create a label
- update-label — Update a label
- delete-label — Delete a label
- get-label-assignments — Get label assignments
- assign-objects-to-label — Assign or unassign objects to a label
- API reference: GET /analytics/v1/labels
Aliases: listlabels