Authentication Guide
OAuth2
API Reference
How to integrate with Sorgera API using OAuth2 Client Credentials.
Overview
Sorgera Services uses a two-step authentication process for automated integrations. Instead of using your permanent API key directly in every request, we recommend using the Client Credentials Flow to obtain temporary Bearer access tokens.
1. Obtain Credentials
Go to your Dashboard and click "Generate Token". If you haven't generated credentials before, you will receive your Client ID and Client Secret via email.
2. Exchange for Access Token
Send a POST request to the token endpoint with your credentials.
curl -X POST https://services.sorgera.com/api/auth/token \
-H "Content-Type: application/json" \
-d '{
"clientId": "your_client_id",
"clientSecret": "your_client_secret"
}'Example Response
{
"access_token": "abc123def456...",
"token_type": "Bearer",
"expires_in": 7776000,
"expires_at": "2026-04-03T22:12:34.000Z"
}3. Use Bearer Token
Include the access_token in the Authorization header of your API requests.
curl -X POST https://services.sorgera.com/api/peppol/xml-to-pdf-base64 \
-H "Authorization: Bearer abc123def456..." \
-H "Content-Type: application/json" \
-d '{
"xml": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4..."
}'Security Best Practices
- Never commit your Client Secret to version control (GitHub, etc.).
- Use environment variables to store credentials in your applications.
- The access token is valid for 90 days. We recommend caching it and only requesting a new one when it expires.
- If your Secret is compromised, regenerate it immediately via the dashboard.
