Skip to main content

Get All Auth Tokens

Retrieve a list of auth tokens with optional filtering, searching, and pagination.

HTTP Request

GET/api/users/auth_tokens

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Query Parameters

ParameterTypeDefaultDescription
limitIntegerNumber of results to return per page.
offsetIntegerNumber of results to skip before returning results.
searchStringSearch term to filter by (`id`, `key`, `user__username`, `user__mobile_number`, `user__first_name`, `user__last_name`).
orderingStringField to order results by (`id`, `created_at`, `updated_at`, `user`).
id_minIntegerMinimum ID of the authentication token.
id_maxIntegerMaximum ID of the authentication token.
created_dateStringExact creation date (`YYYY-MM-DD`).
updated_dateStringExact last update date (`YYYY-MM-DD`).
created_fromStringStart date for tokens created after this date (`YYYY-MM-DD`).
updated_fromStringStart date for tokens updated after this date (`YYYY-MM-DD`).
created_toStringEnd date for tokens created before this date (`YYYY-MM-DD`).
updated_toStringEnd date for tokens updated before this date (`YYYY-MM-DD`).

Example Requests

1import requests
2
3api = requests.Session()
4api.headers.update({'Authorization': 'Token f4e75eab6e0f663a972d145478d6fc4b81762070'})
5response = api.get('http://www.example.com/api/users/auth_tokens/', params={
6  'limit': 5,
7  'ordering': 'created_at'
8})
9print(response.json())

Status Codes

CodeDescription
200Auth tokens retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the auth token
user_dataObjectInformation about the user associated with the token
keyStringThe regenerated authentication token key
created_atDateTimeTimestamp when the token was created
updated_atDateTimeTimestamp when the token was last updated (regenerated)

Example Response

[
{
"id": 15,
"key": "z9y8x7w6v5u4t3s2r1q0p9o8n7m6l5k4j3h2g1f0",
"user_data": {
"id": 42,
"username": "alex_thompson",
"full_name": "Alex Thompson",
},
"created_at": "2025-08-06T15:30:45.123456Z",
"updated_at": "2025-08-06T16:45:30.789012Z"
},
{
"id": 23,
"key": "m5n4b3v2c1x6z9a8s7d0f2g4h6j8k1l3q5w7e9r0",
"user_data": {
"id": 67,
"username": "jordan_smith",
"full_name": "Jordan Smith"
},
"created_at": "2025-08-06T16:22:15.654321Z",
"updated_at": "2025-08-06T16:22:15.654321Z"
}
]