openapi: 3.0.0 info: title: API Keys Management API version: 1.0.0 description: API for managing API keys for user authentication paths: /v1/api-keys: post: summary: Create a new API key tags: - API Keys security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ApiKeyCreate' responses: '201': description: API key created successfully content: application/json: schema: $ref: '#/components/schemas/ApiKeyWithSecretResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' get: summary: List all API keys for the current user tags: - API Keys security: - ApiKeyAuth: [] parameters: - $ref: '#/components/parameters/PageParam' - $ref: '#/components/parameters/ItemsPerPageParam' responses: '200': description: API keys retrieved successfully content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/ApiKeyResponse' pagination: $ref: '#/components/schemas/Pagination' '401': $ref: '#/components/responses/Unauthorized' /v1/api-keys/{key_name}: get: summary: Get details of a specific API key tags: - API Keys security: - ApiKeyAuth: [] parameters: - in: path name: key_name required: true schema: type: string responses: '200': description: API key details retrieved successfully content: application/json: schema: $ref: '#/components/schemas/ApiKeyResponse' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' patch: summary: Update a specific API key tags: - API Keys security: - ApiKeyAuth: [] parameters: - in: path name: key_name required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ApiKeyUpdate' responses: '200': description: API key updated successfully content: application/json: schema: $ref: '#/components/schemas/ApiKeyResponse' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' delete: summary: Revoke a specific API key tags: - API Keys security: - ApiKeyAuth: [] parameters: - in: path name: key_name required: true schema: type: string responses: '200': description: API key revoked successfully content: application/json: schema: $ref: '#/components/schemas/ApiKeyResponse' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: schemas: ApiKeyCreate: type: object required: - name - expires_at properties: name: type: string description: The name of the API key expires_at: type: string format: date-time description: The expiration date and time of the API key ApiKeyUpdate: type: object properties: name: type: string description: The new name for the API key expires_at: type: string format: date-time description: The new expiration date and time for the API key ApiKeyResponse: type: object properties: id: type: string format: uuid created_at: type: string format: date-time last_used_at: type: string format: date-time expires_at: type: string format: date-time status: type: string enum: [ACTIVE, EXPIRED, REVOKED] name: type: string prefix: type: string ApiKeyWithSecretResponse: allOf: - $ref: '#/components/schemas/ApiKeyResponse' - type: object properties: secret: type: string description: The full API key secret (only returned on creation) Pagination: type: object properties: total_pages: type: integer current_page: type: integer items_per_page: type: integer ErrorResponse: type: object properties: status: type: integer message: type: string responses: BadRequest: description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Unauthorized: description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' NotFound: description: Resource not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Forbidden: description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' parameters: PageParam: in: query name: page schema: type: integer default: 1 minimum: 1 description: Page number to retrieve ItemsPerPageParam: in: query name: items_per_page schema: type: integer default: 20 minimum: 1 description: Number of items to return per page securitySchemes: ApiKeyAuth: type: apiKey in: header name: x-api-key