Authentication
The InChurch API uses basicAuthentication with API Key and Secret to secure all requests. This guide explains how to create API clients, manage credentials, and authenticate your requests.
API Client Management
Creating an API Client
- Access your InChurch admin panel
- Go to the (API Module]((https://admin.inchurch.com.br/api/clientes)) (requires admin privileges)
- Navigate to API → API Clients
- Click "Create"
- Fill in the client details:
- Name: Descriptive name (e.g., "Mobile App", "N8N Integration")
- Scope: Choose denomination, regional, or local access
- Permissions: Select resource and action scopes . Copy and save the API Key and API Secret ()
API Client Scopes
Every API client must have a unique scope level:
| Scope | Description | Access Level |
|---|---|---|
| Denomination | Full access across all churches in the denomination | Highest |
| Regional | Access to churches within a specific region | Medium |
| Local | Access to a single local church | Lowest |
Permission System
Permissions follow the format <resource>:<method> where methods include:
GET- Retrieve or view dataPOST- Create new dataPATCH- Update existing dataDELETE- Remove data
Examples:
people:GET- Retrieve member informationdonations:POST- Create new donationsdonations:PATCH- Update existing donationsevents:DELETE- Delete events
Important
If no specific scopes are defined, the API client will have access to all actions on all endpoints within its scope level.
API Credentials
API Key & Secret
When you create an API client, you'll receive:
- API Key: Public identifier (immutable, safe to log)
- API Secret: Private key (shown only once, never stored in plaintext)
Never share your API Secret!
It's displayed only once during creation. If compromised, immediately revoke and regenerate it through the admin panel. Also, never share the Base64 encoded credentials as they provide direct API access.
Credential Storage
Store your credentials securely:
Code
Making Authenticated Requests
Required Headers
Include these headers in all API requests:
Code
Where {BASE64_ENCODED_CREDENTIALS} is the Base64 encoding of your API Key and API Secret joined with a colon (API_KEY:API_SECRET).
Request Examples
Code
Authentication Errors
Common Error Responses
| Status Code | Error | Description |
|---|---|---|
401 | UNAUTHORIZED | Missing or invalid credentials |
403 | FORBIDDEN | Valid credentials but insufficient permissions |
429 | RATE_LIMITED | Too many requests (see Rate Limits) |
Example Error Response
Code
Best Practices
Security
- ✅ Store credentials in environment variables
- ✅ Use HTTPS for all requests
- ✅ Rotate API secrets regularly
- ✅ Monitor API usage logs
- ❌ Never commit credentials to version control
- ❌ Don't share API secrets via email or chat
Performance
- ✅ Reuse connections when possible
- ✅ Implement proper error handling and retries
- ✅ Respect rate limits
- ✅ Cache responses when appropriate
Troubleshooting
Testing Your Credentials
Use this simple test to verify your authentication:
Code
Common Issues
- 401 Unauthorized: Check your API key and secret, and ensure they're properly Base64 encoded
- 403 Forbidden: Verify your client has the required permissions
- Invalid scope: Ensure you're accessing resources within your scope level