Authentication
Learn how to authenticate with the OpsPilot365 API.
API Keys
API keys provide programmatic access to OpsPilot365. Each key is scoped to your organization.
Creating an API Key
- Navigate to Settings → Integrations → API Keys
- Click “Create API Key”
- Enter a descriptive name
- Select permissions:
- Read - View data only
- Write - Create and update data
- Admin - Full access including deletions
- Click “Create”
- Copy and securely store the key (it won’t be shown again)
Treat API keys like passwords. Never commit them to source control or expose them in client-side code.
Using API Keys
Include your API key in the Authorization header:
curl -X GET \
-H "Authorization: Bearer op365_sk_live_abc123..." \
https://api.opspilot365.com/v1/tenantsKey Prefixes
| Prefix | Environment |
|---|---|
op365_sk_live_ | Production |
op365_sk_test_ | Sandbox/Testing |
OAuth 2.0
For applications that act on behalf of users, use OAuth 2.0.
Authorization Flow
- Redirect to authorization URL
https://auth.opspilot365.com/oauth/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=YOUR_REDIRECT_URI&
response_type=code&
scope=read:tenants write:users- Exchange code for tokens
curl -X POST https://auth.opspilot365.com/oauth/token \
-d "grant_type=authorization_code" \
-d "code=AUTH_CODE" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "redirect_uri=YOUR_REDIRECT_URI"- Use access token
curl -H "Authorization: Bearer ACCESS_TOKEN" \
https://api.opspilot365.com/v1/tenantsRefreshing Tokens
curl -X POST https://auth.opspilot365.com/oauth/token \
-d "grant_type=refresh_token" \
-d "refresh_token=REFRESH_TOKEN" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"Scopes
| Scope | Description |
|---|---|
read:tenants | View tenant information |
write:tenants | Modify tenant settings |
read:users | View user data |
write:users | Create/update users |
read:licenses | View license data |
write:licenses | Assign/remove licenses |
admin | Full administrative access |
Security Best Practices
- Rotate keys regularly - Create new keys and deprecate old ones
- Use minimum permissions - Only request scopes you need
- Secure storage - Use environment variables or secret managers
- Monitor usage - Review API logs for suspicious activity
- IP allowlisting - Restrict key usage to known IPs (Enterprise)
Revoking Access
Revoking API Keys
- Go to Settings → Integrations → API Keys
- Find the key to revoke
- Click “Revoke”
- Confirm the action
Revoking OAuth Tokens
curl -X POST https://auth.opspilot365.com/oauth/revoke \
-d "token=ACCESS_TOKEN" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"Last updated on