API Authentication
All Piora API requests require authentication. Piora uses Bearer Tokens for API authentication.
Obtaining an API Token
Section titled “Obtaining an API Token”Generate in the Dashboard
Section titled “Generate in the Dashboard”- Log into the Piora Dashboard
- Go to “Settings” > “API Tokens”
- Click “Generate New Token”
- Name the token (e.g.,
ci-cd-pipeline) - Select token permission scopes
- Click “Create”
Token Permissions
Section titled “Token Permissions”When generating a token, you can select the following permission scopes:
| Permission | Description |
|---|---|
servers:read | Read server information |
servers:write | Manage servers |
applications:read | Read application information |
applications:write | Manage applications |
applications:deploy | Deploy applications |
databases:read | Read database information |
databases:write | Manage databases |
backups:read | Read backup information |
backups:write | Manage backups |
Using Tokens
Section titled “Using Tokens”Bearer Token Authentication
Section titled “Bearer Token Authentication”Include the token in the Authorization header of every API request:
curl -X GET https://app.piora.dev/api/v1/servers \ -H "Authorization: Bearer piora_token_xxxxxxxxxxxx"Language Examples
Section titled “Language Examples”// Node.js (fetch)const response = await fetch('https://app.piora.dev/api/v1/servers', { headers: { 'Authorization': 'Bearer piora_token_xxxxxxxxxxxx', 'Content-Type': 'application/json', },});const data = await response.json();# Python (requests)import requests
response = requests.get( 'https://app.piora.dev/api/v1/servers', headers={'Authorization': 'Bearer piora_token_xxxxxxxxxxxx'})data = response.json()// Goreq, _ := http.NewRequest("GET", "https://app.piora.dev/api/v1/servers", nil)req.Header.Set("Authorization", "Bearer piora_token_xxxxxxxxxxxx")resp, _ := http.DefaultClient.Do(req)Token Management
Section titled “Token Management”View Token List
Section titled “View Token List”On the “Settings” > “API Tokens” page, you can see all created tokens:
- Token name
- Permission scopes
- Creation date
- Last used time
Revoke a Token
Section titled “Revoke a Token”If a token may have been compromised, revoke it immediately:
- Go to “Settings” > “API Tokens”
- Find the target token
- Click “Revoke”
- Confirm the operation
Once revoked, all requests using that token will immediately receive a 401 Unauthorized response.
Security Best Practices
Section titled “Security Best Practices”- Never hardcode tokens in source code — Use environment variables
- Never commit tokens to version control — Add tokens to
.gitignore - Rotate tokens regularly — We recommend every 90 days
- Use least privilege — Only grant the necessary permission scopes
- Monitor usage — Regularly review token usage logs
# Use environment variablesexport PIORA_API_TOKEN=piora_token_xxxxxxxxxxxx
# Use in your applicationcurl -H "Authorization: Bearer $PIORA_API_TOKEN" \ https://app.piora.dev/api/v1/serversError Codes
Section titled “Error Codes”| HTTP Status | Description |
|---|---|
401 | Token is invalid or expired |
403 | Token has insufficient permissions |
429 | Rate limit exceeded |