Skip to content

API Usage Examples

All examples below demonstrate how to trigger flows using a Bearer Token and a JSON payload.

  • Method: POST
  • Authorization: Bearer Token (workspace-level)
  • Content-Type: application/json

Replace:

  • {workspace_id} with your workspace ID
  • {trigger_id} with your trigger ID
  • {environment} with DEV / UAT / PROD
  • workspace_api_key with your workspace token
Terminal window
curl -X POST "https://app.phinite.ai/api/v1/ai/trigger/{workspace_id}/{trigger_id}/{environment}" \
-H "Authorization: Bearer workspace_api_key" \
-H "Content-Type: application/json" \
-d '{
"message": "start the task",
"user_variables": {
"key1": "value1",
"key2": "value2"
}
}'

{
"detail": "Invalid authentication credentials"
}

  • Automated incident response from monitoring systems
  • Scheduled data processing and reporting
  • Webhook-triggered workflows from external platforms (Jira, etc.)
  • Background batch processing with real-time progress tracking
  • Long-running data transformation and enrichment tasks
  • Periodic system health checks and maintenance routines

  • Validate bearer tokens: Always verify authentication in DEV environment before deploying to PROD.
  • Use user_variables for context: Pass structured data through user_variables instead of embedding everything in the message field.
  • Poll status intelligently: When using background tasks, implement appropriate polling intervals (e.g., every 5-10 seconds) to check status without overwhelming the API.
  • Monitor execution time: Be aware of the 2700-second maximum for background tasks. Design flows to complete within this limit.
  • Test thoroughly: Always test in DEV environment before promoting to UAT and PROD.
  • Keep triggers descriptive: Use clear, meaningful names for triggers to facilitate internal reference and debugging.
  • Handle webhooks appropriately: For Jira and other webhook integrations, ensure the integration is properly configured with the correct secret before testing.