API Authentication

Learn how to authenticate your API requests to access Docaflex services securely.

Authentication Methods

Docaflex supports multiple authentication methods to secure your API requests:

API Key Authentication

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' } });

Security Note

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.

OAuth 2.0

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' } });

Available Scopes

  • templates.read - Read access to templates
  • templates.write - Create and modify templates
  • documents.read - Read access to documents
  • documents.write - Create and modify documents
  • workflows.read - Read access to workflows
  • workflows.write - Create and modify workflows

SSO Integration

For enterprise customers, we support Single Sign-On (SSO) through various providers:

  • Google Workspace
  • Lark
  • Microsoft Azure AD
  • Okta
  • Custom SAML 2.0 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'] } });

Rate Limiting

API requests are subject to rate limiting based on your subscription plan:

PlanRate LimitBurst Limit
Free100 requests/minute200 requests
Pro1,000 requests/minute2,000 requests
EnterpriseCustomCustom

Rate limits are applied per API key. Contact us if you need higher limits.

Need Help?

Having trouble with authentication? Check out our troubleshooting guide or contact our support team.

Hi there 👋 How can we help?