All guides

Run an automation from your app

Build the automation in cuil.si first (Automations in the app). Then start it from your code whenever something happens on your side: a new blog post, a new product, a form someone filled in.
  1. 1Run it with your API key

    POST /workflows/{workflow_id}/run starts a run. What you send in data is what the automation's first step receives. The answer has the run's id. A key can't run an automation that posts to YouTube; a webhook trigger (below) can.

    curl -X POST "https://cuil.si/api/v1/workflows/WORKFLOW_ID/run" -H "Authorization: Bearer $CUILSI_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $(uuidgen)" \
      -d '{"data": {"topic": "Our new oat-milk latte", "link": "https://example.com/blog/oat-latte"}}'
    # { "id": "RUN_ID", "status": "running", ... }
  2. 2Follow the run

    Check the run until it is finished. If a step waits for a person (an approval step), you can approve or reject it through the API too. Or add a webhook for workflow.run.completed and workflow.run.failed.

    curl "https://cuil.si/api/v1/workflows/runs/RUN_ID" -H "Authorization: Bearer $CUILSI_API_KEY"
    # "status" is running, waiting (a step needs a person), succeeded, failed or cancelled.
    # Approve a waiting step:
    curl -X POST "https://cuil.si/api/v1/workflows/runs/RUN_ID/steps/STEP_ID/approve" -H "Authorization: Bearer $CUILSI_API_KEY"
  3. 3Or start it without an API key

    Give the automation a webhook trigger in the builder. It gets its own link and secret, which you can hand to another app (a form tool, a shop, Zapier) without sharing your API key. Send the secret in the X-Ginie-Secret header.

    # No API key: the automation's own secret, from its webhook trigger in the automation builder.
    curl -X POST "https://cuil.si/api/v1/hooks/workflows/WORKFLOW_ID" \
      -H "X-Ginie-Secret: YOUR_AUTOMATION_SECRET" \
      -H "Content-Type: application/json" \
      -d '{"name": "Asha", "email": "[email protected]", "message": "Do you ship to Pune?"}'
    # 202 Accepted. Any JSON up to 256 KB; up to 30 a minute.