View all methods

aiToolMetrics.delete

Permanently delete bespoke AI tool usage records, for example records sent under the wrong tool name or email.

Facts

Method POST https://yourinstance.getdx.net/api/aiToolMetrics.delete

Arguments

Required arguments

Name Type Description
token Token Auth token passed as an HTTP header.
tool String Exact name of the AI tool the records were sent under.

Optional arguments

Name Type Description
email String Only delete records for this user email. Matching is case-insensitive.
date String Only delete records for this date, in YYYY-MM-DD format.
confirm Boolean Required to be true when neither email nor date is provided, because the request then deletes every record for the tool.

Usage info

Use this method to remove records that were added to your Data Cloud instance through aiToolMetrics.push or aiToolMetrics.pushAll by mistake. Deletion is permanent. To restore deleted records, send them again.

Matching records are removed from the bespoke_ai_tool_daily_metrics table, along with their model breakdowns and the usage data derived from them in AI reports.

A request with only tool deletes every record for that tool, so it must include "confirm": true. Provide email, date, or both to delete a narrower set of records.

Deletion runs in the background. The request returns HTTP 202 with matched_count, the number of records that matched when the request was received. The records are removed shortly afterwards, and reports update once the deletion finishes. If no records match, status is nothing_to_delete and nothing is queued, so repeating a request is safe.

The tool itself is not removed, only its records.

Response

Name Type Description
tool String AI tool name from the request.
email String Email filter from the request, or null.
date String Date filter from the request, or null.
matched_count Integer Number of records that matched when the request was received.
status String queued when deletion was scheduled, or nothing_to_delete when no records matched.

Example request

Delete all records sent under a mistaken tool name:

curl -X POST https://yourinstance.getdx.net/api/aiToolMetrics.delete \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
  -H 'Content-Type: application/json' \
  --data '{
    "tool": "Claude Enterprise Seats",
    "confirm": true
  }'

Delete one user’s records for a single day:

curl -X POST https://yourinstance.getdx.net/api/aiToolMetrics.delete \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
  -H 'Content-Type: application/json' \
  --data '{
    "tool": "tabnine",
    "email": "test@example.com",
    "date": "2025-01-15"
  }'

Example response

{
  "ok": true,
  "data": {
    "tool": "Claude Enterprise Seats",
    "email": null,
    "date": null,
    "matched_count": 240,
    "status": "queued"
  }
}

Errors

Error Description
not_authed The request did not include a valid API key.
missing_tool tool was not provided.
invalid_email email is not a string.
invalid_date date is not a valid YYYY-MM-DD date.
confirmation_required Neither email nor date was provided and confirm was not true.