Skip to content

Overview

Generate a Token

The TKG Analytics API requires the use of a Bearer token for authentication. This page explains how to generate a token and use it.

Only district admins can generate and use api tokens.

  1. Log into TKG Analytics
  2. In the navbar, click the dropdown button with your name
  3. Click Profile
  4. In the sidebar, click API
  5. Click the Create an API Token button
  6. Confirm it's you: choose Email me a code, enter the code we email you, and click Confirm. If you turned on two-factor authentication, enter a code from your authenticator app instead. See Confirming It's You.
  7. Name the token and click the button to create it
  8. Click the Reveal button to see the token
  9. Copy it

If you lose your token, don't worry about it. You can always come back to see it again, confirming it's you if your last confirmation was more than 30 minutes ago.

Access the API

Every API endpoint for TKG Analytics requires your API token for access. To use the token, pass an Authorization header with the token in it.

For example, to access the api/v1/me endpoint (replace TOKEN with the value of the token you copied from the Generate a Token section):

curl https://tkganalytics.org//api/v1/me \
  -H "Accept: application/json" \
  -H "Authorization: Bearer TOKEN"

API requests do not count as sign-ins. They do not change the sign-in count or the last sign-in date shown for the token's owner.

API Reference

The full API Reference, with examples and endpoint documentation, is available at https://tkganalytics.org//api-docs.

You must be logged in to view the API documentation.