{% extends "base.html" %} {% load i18n static wger_extras %} {% block title %}{% translate "API access" %}{% endblock %} {% block content %}

{% blocktranslate trimmed %} Theare are two ways to authenticate against the API: JWT is the preferred mechanism for client applications, the static API key is intended for personal scripts or one-off integrations. {% endblocktranslate %}

{% translate "JWT sessions" %}

{% blocktranslate count counter=active_jwt_sessions %} There is currently {{ counter }} active JWT session {% plural %} There are currently {{ counter }} active JWT sessions {% endblocktranslate %}

{% blocktranslate trimmed %} Revoking JWT sessions logs out every device that obtained a refresh token via the JWT login endpoint. {% endblocktranslate %}

{% translate "API key" %}

{% if token %}

{% endif %}
{% if token %} {{ token.key }} {% else %} {% translate "You have no API key yet" %} {% endif %}

{% blocktranslate with key=token.key|default:"1234567890abcde..." %} Pass Token {{ key }} in the Authorization header to use it. {% endblocktranslate %}

{% translate "Example with curl:" %}

curl -X GET https://wger.de/api/v2/routine/ \
     -H 'Authorization: Token {% if token %}{{ token.key }}{% else %}1234567890abcde...{% endif %}'
{% endblock %} {# #} {# Sidebar #} {# #} {% block sidebar %}
{% translate "Documentation" %}

{% translate 'API documentation' %}

{% endblock %}