Skip to content

Tutorial 4: Delete the traceπŸ”—

You can delete traces either individually, or in bulk.

Delete a single traceπŸ”—

Traces can be deleted using the GraphQL deleteTrace mutation.

Bash
curl \
    --header 'API-KEY: <Cryptosense API Key>' \
    --header 'Content-Type: application/json' \
    --data-raw '{"query": "mutation { deleteTrace(input: {traceId: "<trace ID>"}){ clientMutationId }}"}' \
    https://analyzer.cryptosense.com/api/v2

Delete multiple tracesπŸ”—

It’s possible to send multiple mutations in a single GraphQL query. Combined with the previous example, this enables bulk deletion of traces in the AQtive Guard API. Here is an example of deleting two traces with a single curl call:

Bash
curl \
    --header 'API-KEY: <Cryptosense API Key>' \
    --header 'Content-Type: application/json' \
    --data-raw '{"query": "mutation { d0: deleteTrace(input: {traceId: "<trace ID 1>"}){ clientMutationId }  d1: deleteTrace(input {traceId: "<trace ID 2>"}){ clientMutationId }}"}' \
    https://analyzer.cryptosense.com/api/v2

The d0 and d1 names here can be changed to any valid GraphQL query label. The return value will contain the response for each individual deletion request.

Note

One failed delete does not impact the others.

In the example above, if d0 succeeded and d1 failed, the return value would be:

JSON
{
  "errors": [
    {
      "message": "<error message>",
      "locations": [
        {
          "line": 6,
          "column": 3
        }
      ],
      "path": ["d1"]
    }
  ],
  "data": {
    "d0": {
      "clientMutationId": null
    },
    "d1": null
  }
}