Get All Auth Tokens
Retrieve list of all authentication tokens with optional filtering, searching, and pagination.
HTTP Request
GET/api/users/auth_tokens/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS
Authorization
Authorization
- Required: Yes
- Permission: Staff with UserAuthTokenPermission or Admin
- Permission Code: 1242
- Authentication: Token-based (Authorization: Token <your_api_key>)
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | Integer | 10 | Number of results to return per page. |
| offset | Integer | 0 | Number of results to skip before returning results. |
| search | String | — | Search term to filter by (`id`, `key`, `user__username`, `user__mobile_number`, `user__first_name`, `user__last_name`). |
| ordering | String | — | Order results by (`id`, `created_at`, `updated_at`, `user`). |
| id_min | Integer | — | Minimum ID of the authentication token. |
| id_max | Integer | — | Maximum ID of the authentication token. |
| created_date | String | — | Exact creation date (`YYYY-MM-DD`). |
| updated_date | String | — | Exact last update date (`YYYY-MM-DD`). |
| created_from | String | — | Tokens created after defined date (`YYYY-MM-DD`). |
| updated_from | String | — | Tokens last updated after defined date (`YYYY-MM-DD`). |
| created_to | String | — | Tokens created before defined date (`YYYY-MM-DD`). |
| updated_to | String | — | Tokens updated before defined date (`YYYY-MM-DD`). |
Example Requests
- 🐍 Python
- 💻 cURL
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())1curl "http://www.example.com/api/users/auth_tokens/?limit=5&ordering=created_at" -H "Authorization: Token f4e75eab6e0f663a972d145478d6fc4b81762070"Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of Token objects |
Token Object Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the auth token(unique) |
| key | String | The regenerated authentication token key(unique) |
| user_data | Object | Information about the user associated with the token |
| created_at | DateTime | Timestamp when the token was created |
| updated_at | DateTime | Timestamp when the token was last updated (regenerated) |
UserData fields
| Field | Type | Description |
|---|---|---|
| id | Integer | User id(unique) |
| username | String | Username of the related user(unique) |
| mobile_number | String | User mobile number (unique) |
| first_name | String | First name of the user (nullable) |
| last_name | String | Last name of the user (nullable) |
Example Response
{
"count": 7,
"next": "http://127.0.0.1:8000/api/users/auth_tokens/?limit=3&offset=3",
"previous": null,
"results": [
{
"id": 7,
"key": "c6cb2d0782c4e71cd8f2812ac80c04ab61a8cb21",
"user_data": {
"id": 7,
"username": "user_96f356bd56e9fcd8148bd59d8d9b1960",
"mobile_number": "09123456789",
"first_name": null,
"last_name": null
},
"created_at": "2025-11-28T15:26:10.636492Z",
"updated_at": "2025-11-28T15:26:10.636498Z"
},
{
"id": 6,
"key": "ac98f23f16fbb816999abb60bf203533f5d82ae4",
"user_data": {
"id": 6,
"username": "Irwin_Schmitt56",
"mobile_number": null,
"first_name": null,
"last_name": null
},
"created_at": "2025-11-25T12:26:57.400985Z",
"updated_at": "2025-11-25T12:26:57.400992Z"
},
{
"id": 5,
"key": "fe09237688e80217f639ea3bf91afe9ed45c5f17",
"user_data": {
"id": 4,
"username": "Rosemarie.Hoeger3",
"mobile_number": null,
"first_name": "rosemarie",
"last_name": "hoeger"
},
"created_at": "2025-11-25T12:20:11.497778Z",
"updated_at": "2025-11-25T12:20:11.497783Z"
}
]
}