{% extends "layout.html" %} {% block title %}Access tokens{% endblock %} {% block body_class %}plain-page token-page{% endblock %} {% block breadcrumbs %}{% set navigation.current = "api-access" %}{% endblock %} {% block body %}

Access tokens

{{ __user_config("4cat.name") }} has an API, which is documented with an OpenAPI-compatible specification here. Some API endpoints require authentication. You can generate an access token through which to authenticate yourself on this page. Alternatively, tokens may be requested programmatically via the /api/request-token/ endpoint, when requested with a currently logged-in session.

{% if not tokens %}

You currently have no active access token(s). Request one:

{% else %} {% for token in tokens %} {% endfor %}
Token Calls so far Expiration
{{ token.token }} {{ token.calls }} {{ token.expires|datetime|safe }}
{% endif %}

Tokens can be passed to API calls in two ways; via a GET parameter, access-token:

/api/endpoint?access-token=[token]

Alternatively, you can pass it as a request header, Authentication:

headers = {"Authentication": "[access-token]"}

{% endblock %}