Error handling
Trigger failures
The trigger endpoint can fail for several reasons:Polling failures
The status endpoint may be temporarily unavailable while the execution is being registered. Don’t treat transient errors as fatal — continue polling:Execution failures
When a workflow fails, the error details are inexecution.errorDetails:
node_failure, validation_error, external_api_error, timeout
Result parsing with fallbacks
Workflow output shapes can vary. Always validate before assuming structure:Retry logic
Retrying failed items in a batch
If a workflow processes multiple items and some fail, retry only the failures:Idempotency
Codika workflows are not idempotent by default. Retrying a trigger creates a new execution. If your workflow has side effects (sending messages, creating records), design your retry logic accordingly:- Track which items succeeded before retrying
- Use your own database to record trigger history
- Don’t blindly re-trigger the entire batch
Audit trail
Log every workflow trigger and result to your own database for accountability:Security best practices
Keep API keys server-side
Never expose the Codika API key in client-side code. All calls to Codika should go through your server:- Authentication of your own users (session, JWT, etc.)
- Authorization (can this user trigger this workflow?)
- API key injection (adds the X-API-Key header)
- Response filtering (only return what the client needs)
Query parameter security
When using?api_key= query parameter authentication:
- HTTPS encrypts the full URL including query parameters — the key is protected in transit
- Server logs may record query strings — ensure your log retention and access controls are appropriate
- Use instance keys (
ck_), not organization keys — instance keys have the narrowest scope - Rotate keys if you suspect exposure — regenerate from the Codika dashboard
Validate input before triggering
Don’t pass raw user input to the workflow. Validate and sanitize on your server before calling the trigger endpoint:Rate limit your own endpoints
Codika doesn’t rate-limit workflow triggers beyond n8n’s capacity. Add rate limiting to your own API routes to prevent abuse:Polling configuration
Tune polling parameters based on your workflow’s expected duration:| Workflow type | Suggested interval | Suggested timeout |
|---|---|---|
| Fast (validation, lookup) | 1s | 30s |
| Medium (API calls, processing) | 1.5s | 120s |
| Slow (AI generation, file processing) | 3s | 300s |