Skip to main content

Authentication

Curacel Doc Extractor API uses API key-based authentication to secure access to our services. This guide will help you understand how to authenticate your requests and manage your API keys.

API Key Authentication

All requests to the Curacel Doc Extractor API must include a valid API key in the request headers. The API key serves as your unique identifier and determines your access level and rate limits.

Header Format

Include your API key in the X-API-Key header:

curl -X POST "https://api.doc-extractor.curacel.co/api/extract" \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"files": [...],
"fields": [...]
}'

Bearer Token Authentication

Alternatively, you can use Bearer token authentication:

curl -X POST "https://api.doc-extractor.curacel.co/api/extract" \
-H "Authorization: Bearer your_bearer_token_here" \
-H "Content-Type: application/json" \
-d '{
"files": [...],
"fields": [...]
}'

Getting Your API Key

1. Sign Up for an Account

Visit our developer portal to create your account.

2. Generate API Key

Once you've signed up, you can generate your API key from the developer dashboard:

  1. Log in to your account
  2. Navigate to the API Keys section
  3. Click "Generate New API Key"
  4. Copy and securely store your API key

3. Production Environment

The API key is used for the production environment where real document processing occurs.

API Key Security

Best Practices

  1. Keep Your API Key Secret

    • Never expose your API key in client-side code
    • Don't commit API keys to version control
    • Use environment variables to store API keys
  2. Rotate Keys Regularly

    • Generate new keys periodically
    • Revoke old keys when no longer needed
    • Monitor key usage for suspicious activity
  3. Use Environment Variables

    # Set environment variable
    export DOC_EXTRACTOR_API_KEY="your_api_key_here"

    # Use in your application
    curl -X POST "https://api.doc-extractor.curacel.co/api/extract" \
    -H "X-API-Key: $DOC_EXTRACTOR_API_KEY" \
    -H "Content-Type: application/json"

Key Management

  • View Active Keys: Check your dashboard for all active API keys
  • Revoke Keys: Deactivate compromised or unused keys
  • Monitor Usage: Track API usage and rate limits
  • Set Permissions: Configure key permissions for different access levels

Rate Limits

API keys are subject to rate limits based on your plan:

PlanRequests per MinuteRequests per Day
Free101,000
Pro10010,000
Enterprise1,000100,000

Rate Limit Headers

The API includes rate limit information in response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Error Handling

Authentication Errors

When authentication fails, you'll receive a 401 Unauthorized response:

{
"status": false,
"message": "Invalid API key"
}

Common Authentication Issues

  1. Missing API Key

    {
    "status": false,
    "message": "API key is required"
    }
  2. Invalid API Key

    {
    "status": false,
    "message": "Invalid API key"
    }
  3. Expired API Key

    {
    "status": false,
    "message": "API key has expired"
    }

Testing Authentication

You can test your API key authentication using a simple request:

curl -X POST "https://api.sandbox.doc-extractor.curacel.co/api/extract" \
-H "X-API-Key: your_sandbox_api_key" \
-H "Content-Type: application/json" \
-d '{
"files": [
{
"type": "url",
"file": {
"name": "test.pdf",
"content": "https://example.com/test.pdf"
}
}
],
"fields": ["test_field"]
}'

A successful response indicates your authentication is working correctly.

Support

If you encounter authentication issues:

  1. Verify your API key is correct
  2. Check that you're using the right environment (sandbox vs production)
  3. Ensure your API key hasn't expired
  4. Contact support at support@curacel.ai for assistance