mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-18 18:11:57 +00:00
125 lines
3.5 KiB
Plaintext
125 lines
3.5 KiB
Plaintext
---
|
|
title: "List API Keys"
|
|
api: "GET /api/v1/api-keys"
|
|
description: "Retrieve a list of API keys for the tenant, with filtering support."
|
|
---
|
|
|
|
Retrieve a list of all API keys associated with your tenant. This endpoint supports various filtering options to help you find specific keys.
|
|
|
|
## Query Parameters
|
|
|
|
### Filtering
|
|
|
|
- `filter[name]` - Filter by exact API key name
|
|
- `filter[name__icontains]` - Filter by API key name (case-insensitive)
|
|
- `filter[prefix]` - Filter by API key prefix
|
|
- `filter[revoked]` - Filter by revocation status (boolean)
|
|
- `filter[expires_at]`, `filter[expires_at__gte]`, `filter[expires_at__lte]` - Filter by expiration date
|
|
- `filter[inserted_at]`, `filter[inserted_at__gte]`, `filter[inserted_at__lte]` - Filter by creation date
|
|
- `filter[search]` - General search term
|
|
|
|
### Pagination
|
|
|
|
- `page[number]` - Page number to retrieve
|
|
- `page[size]` - Number of results per page
|
|
|
|
### Sorting
|
|
|
|
- `sort` - Field to sort by. Available options: `name`, `-name`, `prefix`, `-prefix`, `revoked`, `-revoked`, `inserted_at`, `-inserted_at`, `expires_at`, `-expires_at`
|
|
|
|
### Field Selection
|
|
|
|
- `fields[api-keys]` - Specify which fields to return: `name`, `prefix`, `expires_at`, `revoked`, `inserted_at`, `last_used_at`, `entity`
|
|
|
|
### Include Related Resources
|
|
|
|
- `include` - Include related resources. Available: `entity`
|
|
|
|
## Example Request
|
|
|
|
```bash
|
|
curl -X GET "https://api.prowler.com/api/v1/api-keys?page[size]=10&sort=-inserted_at" \
|
|
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
-H "Content-Type: application/vnd.api+json"
|
|
```
|
|
|
|
## Response
|
|
|
|
### Success Response (200 OK)
|
|
|
|
Returns a paginated list of API keys with their metadata:
|
|
|
|
```json
|
|
{
|
|
"data": [
|
|
{
|
|
"type": "api-keys",
|
|
"id": "api-key-uuid-1",
|
|
"attributes": {
|
|
"name": "Production CI/CD Pipeline",
|
|
"prefix": "pk_live_abc123",
|
|
"expires_at": "2025-12-31T23:59:59Z",
|
|
"revoked": false,
|
|
"inserted_at": "2024-01-15T10:30:00Z",
|
|
"last_used_at": "2024-01-20T14:22:00Z"
|
|
},
|
|
"relationships": {
|
|
"entity": {
|
|
"data": {
|
|
"type": "users",
|
|
"id": "user-uuid"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "api-keys",
|
|
"id": "api-key-uuid-2",
|
|
"attributes": {
|
|
"name": "Staging Dashboard API Access",
|
|
"prefix": "pk_live_def456",
|
|
"expires_at": null,
|
|
"revoked": false,
|
|
"inserted_at": "2024-01-10T08:15:00Z",
|
|
"last_used_at": null
|
|
},
|
|
"relationships": {
|
|
"entity": {
|
|
"data": {
|
|
"type": "users",
|
|
"id": "user-uuid"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"meta": {
|
|
"page": {
|
|
"number": 1,
|
|
"size": 20,
|
|
"total": 2,
|
|
"total_pages": 1
|
|
}
|
|
},
|
|
"links": {
|
|
"self": "https://api.prowler.com/api/v1/api-keys?page[number]=1",
|
|
"first": "https://api.prowler.com/api/v1/api-keys?page[number]=1",
|
|
"last": "https://api.prowler.com/api/v1/api-keys?page[number]=1"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Response Fields
|
|
|
|
- `id` (UUID) - Unique identifier for the API key record
|
|
- `name` (string) - Descriptive name (3-100 characters)
|
|
- `prefix` (string, read-only) - First characters of the key for identification
|
|
- `expires_at` (datetime, nullable) - Expiration date in ISO 8601 format
|
|
- `revoked` (boolean, read-only) - Whether key has been revoked
|
|
- `inserted_at` (datetime, read-only) - When key was created
|
|
- `last_used_at` (datetime, nullable, read-only) - Last usage timestamp
|
|
|
|
<Note>
|
|
The full API key value is never returned after creation. Only the prefix is shown for identification purposes.
|
|
</Note>
|