Skip to Content
🎉 New release with new features and improvements! V0.0.5 Release →

Rotate API Key

Rotate an API key for programmatic access to the BSH Engine API.

POST /api/api-keys/{id}/rotate

Path Parameters

ParameterTypeRequiredDescription
idnumberyesThe unique identifier of the API key to rotate

Response

Success Response (200 OK):

{ "data": [ { "id": 123, "apiKey": "bsh_abcd1234efgh5678ijkl9012mnop3456qrst7890", "name": "My API Key", "type": "MACHINE", "status": "ACTIVE", "duration": 30, "startedAt": "2025-01-15T10:30:00Z", "expiresAt": "2025-02-14T10:30:00Z", "userId": "user-123" } ], "status": "OK", "code": 200, "timestamp": 1234567890, "meta": {} }
PropertyTypeDescription
idnumberUnique identifier for the API key
apiKeystringThe full API key value (only shown once after rotation)
namestringThe name assigned to the API key
typestringThe type of API key (PERSONAL, MACHINE)
statusstringCurrent status of the key (ACTIVE, REVOKED, DISABLED)
durationnumberExpiration period in days
startedAtstringISO 8601 timestamp when the key was created
expiresAtstringISO 8601 timestamp when the key will expire
userIdstringID of the user who created the key

Important Notes

⚠️ Save your API key immediately! The full apiKey value is only returned once in the response. After this, the key will be masked as bsh_******** in all subsequent API calls for security purposes.