Overview
The Petra Security API uses Bearer token authentication. Every request to the API must include a valid API key in the Authorization header.Getting Your API Key
The API is in private beta. Please contact us to confirm access before generating keys.
- Go to app.petrasecurity.com and sign in.
- Navigate to Settings and click the API Keys tab.
- Click Create API Key.
- Optionally enter a description (e.g.
Production integration) to identify the key later. - Click Create API Key in the dialog.
- Copy the key immediately. The full key value is only shown once — it cannot be retrieved again after you close the dialog.
Managing Existing API Keys
The API Keys page lists all active keys for your organization, showing the description and creation date for each. The raw key value is never shown after the initial creation dialog. To delete a key, click the trash icon next to it and confirm. Deletion is immediate — any application still using that key will start receiving401 Unauthorized errors. There is no undo.
Using Your API Key
Include your API key in theAuthorization header of every request:
Example with different languages
Troubleshooting
401 Unauthorized
This error means your API key is invalid, missing, or has been deleted. Check that:- You’re including the
Bearerprefix before your API key (e.g.Authorization: Bearer petra_abc123...) - The key hasn’t been deleted from Settings → API Keys
- You’re using the key for the correct organization