delete-custom-metric
dci delete-custom-metric [flags]
Deletes a custom metric. This cannot be undone. Requires the
analytics:calculatedMetrics entitlement and a metrics write
permission, and only the owner can delete a metric. Send the
metric's etag in If-Match.
A metric that a report or an alert uses cannot be deleted. Remove it from them first.
A retry with the same Idempotency-Key returns the first 204. A
new request for a metric that no longer exists, including one that
is already deleted, returns 404 not_found: treat it as gone.
With dryRun=true, every check runs and nothing is deleted.
Errors (RFC 9457 Problem Details, code field):
400 idempotency_key_required: noIdempotency-Keyheader.400 tenant_id_required: a caller with access to more than one customer sent noX-Tenant-Id.403 analytics.feature_not_entitled: the customer does not have the calculated metrics entitlement.403 analytics.custom_metric_not_owner: the caller does not own the metric.403 forbidden: no metrics write permission, a read-only token, or anX-Tenant-Idthat the credential cannot access.404 not_found: no custom metric with this id for the customer, including a metric that is already deleted.409 delete_blocked_by_dependencies: reports, allocations or alerts use the metric.detailshas one entry per user, withissueset toused_by_report,used_by_allocationorused_by_alert, andresourceTypeandresourceIdnaming that user, for example\{"issue": "used_by_report", "resourceType": "report", "resourceId": "..."\}. An allocation uses the metric when one of its splits is weighted by it.409 idempotency_request_in_progress: a request with the sameIdempotency-Keyis still running. Retry with backoff.412 precondition_failed:If-Matchdoes not match the currentetag. Read the metric again, then retry.422 idempotency_key_reused: theIdempotency-Keywas used for another request.428 precondition_required: noIf-Matchheader.
Flags
| Flag | Type | Default | Example | Description |
|---|---|---|---|---|
--dry-run | boolean | false | If true, validates the request and returns the would-be result without applying it. The response then carries the X-Dry-Run header. |
Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.
Output
On success, this command produces no response data.
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, 422 | 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. |
| 405, 412, 428 | 1 | API_ERROR | The request failed; the printed error message has details. |
| 409 | 21 | RESOURCE_CONFLICT | The operation conflicts with the resource's current state. |
| 429 | 50 | RATE_LIMITED | Too many requests. Retryable — the CLI reports the server-provided delay. |
| 500, 503 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- create-custom-metric — Create a custom metric
- get-custom-metric — Get a custom metric
- list-custom-metrics — List custom metrics
- update-custom-metric — Update a custom metric
- API reference: DELETE /analytics/v1/custom-metrics/{id}
Aliases: deletecustommetric