Overview

The Contazen API uses Bearer token authentication. All API requests must include a valid API key in the Authorization header.

API Keys

Key Type

Live Keys

Format: sk_live_ + 24 charactersUse for production. All actions affect real data and can’t be undone.

Creating API Keys

1

Access API Settings

Log in to your Contazen account and navigate to Settings → API Keys
2

Create New Key

Click “Create New API Key” and configure:
  • Name: Identify your key (e.g., “Production Server”)
  • Permissions: Select required scopes
  • IP Restrictions: Optionally limit to specific IPs
3

Copy Your Key

Your secret key will only be shown once. Store it securely in your environment variables.

Making Authenticated Requests

Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
curl https://api.contazen.ro/v1/clients \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY"

Security Best Practices

Authentication Errors

When authentication fails, you’ll receive a 401 Unauthorized response:
{
  "success": false,
  "error": {
    "message": "Invalid API key",
    "type": "authentication_error",
    "code": "invalid_api_key",
    "status": 401
  },
  "meta": {
    "version": "v1",
    "response_time": "2.3ms"
  }
}

Common Error Codes

CodeDescriptionSolution
missing_api_keyNo Authorization headerInclude the header
invalid_api_keyKey doesn’t existCheck your key
expired_api_keyKey has expiredCreate a new key
ip_restrictedRequest from unauthorized IPUpdate IP whitelist
insufficient_permissionsKey lacks required scopeUpdate key permissions

Testing Authentication

Verify your setup with this simple test:
# Test authentication
curl -I https://api.contazen.ro/v1/clients \
  -H "Authorization: Bearer YOUR_API_KEY"

# Success: HTTP 200
# Failed: HTTP 401

Troubleshooting

Need Help?

If you’re having authentication issues:
  1. Double-check your API key
  2. Verify you’re using a valid API key
  3. Check rate limits
  4. Review IP restrictions
  5. Contact support with your request ID