{% extends "crashstats_base.html" %} {% block page_title %}API Tokens{% endblock %} {% block product_nav_filter %} {% endblock %} {% block site_css %} {{ super() }} {% endblock %} {% block site_js %} {{ super() }} {% endblock %} {% block content %}

API Tokens

You need API Tokens to be able to connect to the API so that the API knows who you are and thus what permissions you have.
Using any valid API Token with your API calls means a much higher rate limit.
An API token for downloading crash data requires the permissions View Personal Identifiable Information and View Raw Dumps.

Your Generated Tokens

{% for token in your_tokens %}

Generated {{ token.created | time_tag }}

{% if token.is_expired %}

Token has expired and will not work any more.

{% endif %} {% if token.is_expired %} {% else %} {% endif %}
{% csrf_token %}
{% else %}

You currently have no tokens generated

{% endfor %}

Generate a New Token

{% csrf_token %} {{ form.as_table() }}
 

How To Use These

When using the API you must supply these tokens as a header called Auth-Token.

Here's an example:

curl -H "Auth-Token: 58af2acef8a74dbca9580e2bb8ba9c9a" {{ absolute_base_url }}{{ url('api:model_wrapper', 'RawCrash') }}?crash_id=fb27d0f3-db8e-4835-9311-288bb0170829

Or, if you prefer Python:

import requests

headers = {'Auth-Token': '58af2acef8a74dbca9580e2bb8ba9c9x'}
url = '{{ absolute_base_url }}{{ url('api:model_wrapper', 'RawCrash') }}?crash_id=fb27d0f3-db8e-4835-9311-288bb0170829'
response = requests.get(url, headers=headers)
print(response.json())
{% endblock %}