Learn how to authenticate your API requests to access Docaflex services securely.
Docaflex supports multiple authentication methods to secure your API requests:
The simplest way to authenticate your requests is using an API key. Include your API key in the request headers:
// Example API request with key authentication
fetch('https://api.docaflex.com/v1/templates', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
Never expose your API key in client-side code. Always make API calls from your server and store the API key securely in environment variables.
For more secure authentication, especially when dealing with user data, use OAuth 2.0:
// Example OAuth 2.0 authentication flow
const auth = await docaflex.authenticate({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'https://your-app.com/callback',
scope: ['templates.read', 'templates.write']
});
// Use the access token for API requests
const response = await fetch('https://api.docaflex.com/v1/templates', {
headers: {
'Authorization': `Bearer ${auth.accessToken}`,
'Content-Type': 'application/json'
}
});
templates.read
- Read access to templatestemplates.write
- Create and modify templatesdocuments.read
- Read access to documentsdocuments.write
- Create and modify documentsworkflows.read
- Read access to workflowsworkflows.write
- Create and modify workflowsFor enterprise customers, we support Single Sign-On (SSO) through various providers:
// Example SSO configuration
const sso = await docaflex.configureSso({
provider: 'google',
domain: 'your-company.com',
settings: {
clientId: 'YOUR_GOOGLE_CLIENT_ID',
clientSecret: 'YOUR_GOOGLE_CLIENT_SECRET',
allowedGroups: ['document-admins', 'template-editors']
}
});
API requests are subject to rate limiting based on your subscription plan:
Plan | Rate Limit | Burst Limit |
---|---|---|
Free | 100 requests/minute | 200 requests |
Pro | 1,000 requests/minute | 2,000 requests |
Enterprise | Custom | Custom |
Rate limits are applied per API key. Contact us if you need higher limits.
Having trouble with authentication? Check out our troubleshooting guide or contact our support team.