Skip to main content

Authentication API

The Grafana API supports multiple authentication methods for secure access to API endpoints.

Authentication Methods

Grafana supports the following authentication methods:
  1. Basic Authentication - Username and password
  2. API Keys - Token-based authentication
  3. Session Cookies - Browser-based authentication

Basic Authentication

Use HTTP Basic Authentication with your Grafana username and password:

Security Definitions

basic
HTTP Basic Authentication using username and password

API Key Authentication

API keys provide a secure way to authenticate API requests without exposing user credentials.

Security Definitions

apiKey
API Key authenticationLocation: Header
Name: Authorization
Format: Bearer <api-key>

Using API Keys

Include the API key in the Authorization header:

Session Authentication

Login

string
required
Username or email address
string
required
User password
string
Login success message

Logout

Logs out the current user and clears the session cookie.

User Auth Tokens

Get Auth Tokens

Get all auth tokens for the current user.
integer
Token ID
boolean
Whether the token is currently active
string
IP address of the client
string
Token creation timestamp (ISO 8601)

Revoke Auth Token

Revoke a specific auth token.
integer
required
ID of the auth token to revoke

Rotate Auth Token

Rotate the current auth token.

Authentication Errors

401 Unauthorized

Returned when authentication credentials are missing or invalid.

403 Forbidden

Returned when the authenticated user lacks permission for the requested resource.