# Tokens

Tokens are what allow AccidentalQuality to connect and extract data, which is later processed for your convenience. Retrieving them allows you to monitor the validity of your tokens, and use them to automate creation of API elements, like for example creating integrations.

To retrieve tokens, do the following:

curl -H "X-API-Key: <your api token goes here>" \
https://api.accidentalquality.com/api/tokens
fetch('https://api.accidentalquality.com/api/tokens', {
  method: "GET",
  headers: {"Content-type": "application/json;charset=UTF-8", "X-API-Key": "<your-api-token-goes-here>"}
})
.then(response => response.json()) 
.then(json => console.log(json)) 
.catch(err => console.log(err));

The data returned is in json format and structured as follows:

  • (array)
    • id integer - The id of the token. You will need this for other endpoints.
    • name string - The name of the token.
    • integ_type string Defines the type of a token, which is what it can apply to. Options are Jira, Azure, Github and Jenkins currently.
    • created_at string Metadata describing when the token was created.
    • updated_at string Metadata describing when the token was last edited.

Example:

        [
            {
                "id": "1", 
                "name": "Jira token", 
                "integ_type": "jira", 
                "created_at": "1999-001-01T10:10:10.312Z",
                "updated_at": "1999-001-01T10:10:10.312Z"
            },
            {
                "id": "2", 
                "name": "Azure token", 
                "integ_type": "azure", 
                "created_at": "1999-001-01T10:10:10.312Z",
                "updated_at": "1999-001-01T10:10:10.312Z"
            },
            ...
        ]
    }