This page will help you get started with starting a Workflow Run.

Start a Workflow Run

To start a workflow run, send a POST request to <https://api.copy.ai/api/workflow/><workflow_id>/run with a JSON body containing the starting value(s) for the run.

For example:

{
  "startVariables": {
	  "Input 1": "<Inputs vary depending on the workflow used.>",
	  "Input 2": "<The best way to see an example is to try it!>"
	},
	"metadata": {
    "api": true  /* example optional metadata to set on the workflow run */
	}
}

You will receive a response with the ID of the started workflow run:

{
  "status": "success",
  "data": {
    "id": "<run_id>"
  }
}

This ID can be used to track the progress of the workflow run and will also be included in the webhook request when the run is completed.

Tracking / Poll for Progress

To track a workflow run, send a GET request to <https://api.copy.ai/api/workflow/><workflow_id>/run/<run_id>. You will get a response in the following format:

{
    "status": "success",
    "data":
    {
        "id": "<run_id>",
        "input":
        { 
          	"Input 1": "Inputs vary depending on the workflow used.",
			      "Input 2": "The best way to see an example is to try it!" 
        },
        "status": "PROCESSING",
        "output":
        {
            "Output 1": "<Outputs vary depending on the workflow used.>",
						"Output 2": "<The best way to see an example is to try it!>"
        },
        "createdAt": "2022-11-18T20:30:07.434Z"
    }
}

To learn more about the workflow run details and statuses available, visit this page: Get Workflow Run

Run Completion

When the run is complete, the status will change to COMPLETE and we will send a POST request to any webhooks registered to receive completion events for the workflow.

Example request:

{
    "type": "workflowRun.completed",
    "workflowRunId": "<run_id>",
    "workflowId": "<workflow_id>",
    "result":
    {
      "Output 1": "<Outputs vary depending on the workflow used.>",
			"Output 2": "<The best way to see an example is to try it!>"
    },
    "metadata":
    {
      /* any metadata set on the workflow run */
    },
    "credits": 2 
}

To learn more about registering a webhook, see this page: Register Webhook

Language
Credentials
Header
Click Try It! to start a request and see the response here!