Is it possible to trigger a Prefect2 flow via the ...
# ask-community
n
Is it possible to trigger a Prefect2 flow via the REST API with a later start time? This is possible via the UI for a custom run by specifying start time as later instead of now
1
k
you can. Taking a look at the Create Flow Run From Deployment docs, under
state
->`state_details` there's a
scheduled_time
you can include
here's an example request payload generated from the UI that you can model your requests after
Copy code
{
  "name": "psi67-chactun",
  "parameters": {
    "name": "hi"
  },
  "tags": [
    "main"
  ],
  "state": {
    "type": "SCHEDULED",
    "message": "",
    "state_details": {
      "scheduled_time": "2024-09-17T05:00:00.000Z",
      "cache_expiration": null
    }
  },
  "empirical_policy": {
    "retries": null,
    "retry_delay": null,
    "pause_keys": [],
    "resuming": false
  },
  "work_queue_name": "dev",
  "job_variables": {},
  "enforce_parameter_schema": false
}
n
Thank you that is really helpful!