Authentication
The Unstract Flow API lets your own systems start runs, check on them, cancel them, recover the ones that fail, read review tickets, create, prepare and deploy workflows, reset or expedite the items in their connectors' pipelines, and import files into reference tables. Every request carries an API key in the X-API-Key header.
Base URL
Every endpoint sits under your organization:
https://<your Flow address>/api/v1/external/accounts/<organization-id>/
<your Flow address> is the address you sign in at. The examples on these pages keep both values in environment variables:
export FLOW_URL="https://<your Flow address>"
export FLOW_ORG="<organization-id>"
export FLOW_API_KEY="ufk_…"
export WORKFLOW_ID="<workflow-id>"
The API explorer on the API keys tab shows your organization ID in each curl command it builds. It sends its own requests with your sign-in in place of a key, so an organization owner or admin can try every read request before creating one.
API keys
An organization admin creates keys in Settings, on the API keys tab. API keys covers creating and revoking them. A key starts with ufk_ and is shown once.
A key gives access to the API for its organization, whoever created it. Reads cover the whole organization. Runs it starts are recorded as started by the person who created the key.
curl "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets?limit=1" \
-H "X-API-Key: $FLOW_API_KEY"
Who a key acts as
Requests that list workflows, read runs or their logs, change a review ticket, recover or cancel a run, create, change, prepare or deploy a workflow, read, reset or expedite pipeline items, or read or import into a reference table act as the person who created the key. Flow checks that person's current permissions on every request, so a change to their role applies to the key at once.
| Request | Permission needed |
|---|---|
| Claim the next ticket, claim, skip, release, escalate | hitl:assign |
| Resolve | hitl:resolve |
| Recover a run | run:retry |
| Cancel a run | run:cancel |
| List workflows | workflow:read |
| List runs, read a run's status, results, recovery options or logs | run:read |
| Start a run | workflow:execute |
Reading tickets needs no permission beyond a valid key. Creating, changing, preparing and deploying workflows, and reading, resetting and expediting pipeline items, check the permissions listed in Author and deploy over the API, and reference tables those in Reference tables over the API. Identity also reports the key's creator, so it returns the first two 403s below when that person is gone or has left the organization.
Limiting what a key can do
A key can be given less than the person who made it, never more. When you create one you choose between two kinds. Full access can do anything you can do, and follows your role if that changes. Limited gets only the permissions you pick, so if it leaks, that is all it can do.
A limited key is refused anything outside its scopes, even where its creator holds the permission:
| Status | Message |
|---|---|
| 403 | This API key's scopes do not include run:read. Create a key with that scope. |
Scopes narrow; they never widen. A key cannot be given a permission you do not hold yourself: that is refused when the key is created. A limited key also loses a permission the moment its creator does.
Identity reports what the key itself can do, which for a limited key is less than its creator's own set.
When a key expires
Every new key expires. Pick 30, 60 or 90 days, a year, or a custom date up to a year away; a key created without an expiry gets 90 days. Existing keys keep the expiry dates they were given. An older key made without one goes on working and shows as Never in the list.
| Status | Message | Cause |
|---|---|---|
| 403 | This API key's creator no longer exists or is deactivated; create a new key. | The person who created the key was deleted or deactivated. |
| 403 | This API key's creator is no longer a member of this organization; create a new key. | The person was removed from the organization. |
| 403 | Missing permission: hitl:assign | The person's role lacks the permission. hitl:resolve for a resolve, run:retry to recover a run, run:cancel to cancel one, run:read to read runs and logs, workflow:read to list workflows, workflow:execute to start one. |
| 403 | This API key's scopes do not include … | The key is limited and this request is outside its scopes, whatever its creator may hold. |
Ticket history records these actions with the key's name, prefix and ID under details.via_api_key. Identity shows how to check who a key acts as and which permissions that person has now.
Failed authentication
| Status | Message | Cause |
|---|---|---|
| 401 | Invalid API key | The key is unknown, revoked, or belongs to another organization. |
| 401 | API key has expired | The key's expiry date has passed. |
| 401 | Missing API key | The request has no X-API-Key header, or the header is empty. The response carries WWW-Authenticate: ApiKey. |
Rate limits and errors shows the error body, and the X-Request-ID header every response carries.