Skip to content

API Documentation

GraphQL

The Cryptosense v2 API uses GraphQL. Some familiarity with this query language is recommended to make the best use of the API but is not mandatory for this tutorial.

You can use any HTTP client you'd like to send queries. Below is an example with curl that retrieves the name of the user:

$ export CS_API_KEY=<your API key>
$ curl \
    --request POST \
    --header "API-KEY: $CS_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{"query": "query {viewer {name}}"}' \
    https://analyzer.cryptosense.com/api/v2
{"data":{"viewer":{"name":"<your username>"}}}

And here is the same query in Python:

import json
import os

import requests

api_key = os.getenv("API_KEY")
query = """
  query {
    viewer {
      name
    }
  }
"""
response = requests.post(
    "https://analyzer.cryptosense.com/api/v2",
    data=json.dumps({"query": query}),
    headers={"API-KEY": api_key, "Content-Type": "application/json"},
)
print(json.dumps(response.json()))

In the following parts, we will assume you have chosen any suitable client and only show you the queries and responses.

Tutorials

Further Reading

For more information about the GraphQL types exposed by the API, go to the API explorer. You can write queries with auto-completion and submit them against the production database. In the top right corner, you will see a "DOCS" link that will show you the available types and their attributes.

For general information about traces, please see our support pages. For instructions on how to generate a trace using our java agent, please see our HOWTO guide.

For information about how to interpret the results of an analysis, please see the support documentation for reports.