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
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | Integer | — | Number of results to return per page. |
| offset | Integer | — | 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 | — | Field to 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 | — | Start date for tokens created after this date (`YYYY-MM-DD`). |
| updated_from | String | — | Start date for tokens updated after this date (`YYYY-MM-DD`). |
| created_to | String | — | End date for tokens created before this date (`YYYY-MM-DD`). |
| updated_to | String | — | End date for tokens updated before this 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"Status Codes
| Code | Description |
|---|---|
| 200 | Auth tokens retrieved successfully |
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the auth token |
| user_data | Object | Information about the user associated with the token |
| key | String | The regenerated authentication token key |
| created_at | DateTime | Timestamp when the token was created |
| updated_at | DateTime | Timestamp 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"
}
]