Review tickets
Read the Unstract Flow review tickets in your organization, with their decisions, edits and history, and work them from your own system: claim, skip, release, escalate and resolve. Writes act as the person who created the key, with that person's permissions. Authentication covers that.
List tickets
GET /api/v1/external/accounts/<organization-id>/hitl/tickets
| Parameter | Meaning |
|---|---|
status | pending, assigned, in_progress, resolved, escalated or cancelled. |
queue_id | One queue's tickets. |
workflow_id | One workflow's tickets. |
workflow_name | The tickets of every workflow with that exact name. Two people can each own a workflow of the same name; both are included. |
assigned_to_email | Tickets assigned to one current member, by their email in lower case. |
start_date, end_date | Tickets created in that range, in ISO 8601. |
include | history, field_edits, or both, comma-separated. |
limit | 1 to 200. The default is 50. |
offset | How many tickets to skip, for paging. |
values | whole, the default, or preview, which cuts each long value short. |
curl "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets?status=resolved&include=field_edits&limit=100" \
-H "X-API-Key: $FLOW_API_KEY"
A list returns whole values, so a page of tickets with long values can be large. Add values=preview to get each value over about 8,000 characters in visible_variables, editable_variables and variable_edits as {"_truncated": true, "_preview": "..."}, then fetch the one ticket for the whole value. field_edits stays whole either way.
The response holds tickets, total, limit and offset, newest ticket first. Tickets are deleted with their workflow, and with their run when Flow deletes an old Auto version, so load them regularly and keep what you have loaded; don't replace your copy with a fresh full load. Paging uses offset, so the list can shift between requests: new tickets push older ones onto later pages, and a ticket that is deleted, or that stops matching your status or assigned_to_email filter, pulls later ones onto a page you've already read. For a complete load, ask for short start_date and end_date windows that have passed and hold no more than limit tickets each, so each window is one request, and deduplicate on id. A workflow_name or assigned_to_email that matches nothing returns an empty list.
Ticket fields
| Field | Meaning |
|---|---|
id | The ticket's ID. |
workflow_id, run_id | The workflow and run that created it. run_id is the run's ID as the Runs endpoints return it, so the two can be joined. |
queue_id, queue_name | Its queue. |
title, description | What the reviewer saw at the top. |
visible_variables | The values shown for checking. On a workflow's review with picked values, a long one is cut short to the start of its text. _review_info then says so: cut_short lists those names, and note says when the run's values couldn't be read as the review opened. |
editable_variables | The values the reviewer could correct. On a ticket resolved with edits, they hold the corrected values, and field_edits keeps the old ones. |
status | The ticket's status. |
approved | true or false on a ticket answered with Approve & Next or Reject & Next. null on any other ticket. When Flow couldn't deliver a decision, the ticket keeps its approved value and a second ticket for the same run_id is created for the review; the run acts on the later ticket. The first ticket's history then has a commented entry with details {"reason": "decision_not_delivered"}, and the second ticket's names it in replaces_ticket. |
info_only | true on a ticket from a review step set to Info only, no stop: its run did not wait for it, and resolving it changes nothing in the run. |
variable_edits | The corrections the reviewer sent. On an open ticket that replaces an undelivered decision, the corrections it carries from the ticket it replaces. |
resolution_message | The reviewer's note. |
assigned_to, assigned_to_name | Who holds it now, or who held it when it was resolved or cancelled. null on a ticket that is unclaimed, or was escalated or skipped since, or whose holder was removed from the organization; history records who claimed it. |
resolved_by, resolved_by_name, resolved_at | Who answered it, and when. Only the person holding a ticket can answer it. |
created_at, updated_at | Timestamps in ISO 8601. |
history, field_edits | null unless you ask for them with include. A ticket with none gets an empty array. |
Each entry in field_edits gives the field_name, its old_value and new_value, who made the edit and when.
Ticket history
GET /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/history
The response is an array of events, each with an action, who performed it, details and created_at. Actions include created, claimed, unclaimed, resolved, escalated, commented and cancelled. An unknown ticket, or one from another organization, returns 404 Ticket not found.
Get a ticket
GET /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>
curl "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID" \
-H "X-API-Key: $FLOW_API_KEY"
The response has the ticket fields plus accepts_decision. It is true when the ticket takes a yes or no, so approved on a resolve is honored. Send approved: false only when it is true.
An unknown ticket, or one from another organization, returns 404 Ticket not found.
Claim the next ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/claim-next
The body is optional. Send {"queue_id": "<queue-id>"} to claim from one queue.
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/claim-next" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
The response is the claimed ticket, now assigned to the key's creator. It comes from the queues that person is assigned to. When there is nothing to claim, the response is 204 No Content with no body. That happens when the creator isn't assigned to any queue, when queue_id names a queue the creator isn't assigned to (the request isn't refused), and when no unassigned pending ticket is waiting.
Claim a ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/claim
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID/claim" \
-H "X-API-Key: $FLOW_API_KEY"
The response is the ticket.
| Status | Message | Cause |
|---|---|---|
| 409 | Ticket has already been claimed by another agent | Someone else holds the ticket. |
| 400 | Cannot claim ticket with status '…' | The ticket is neither waiting nor assigned, for example it is already resolved. |
| 400 | Cannot claim ticket in current state | The claim failed for another reason, for example the ticket changed while you claimed it. Get the ticket and try again. |
| 404 | Ticket not found | The ticket doesn't exist in your organization. |
Skip a ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/skip
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID/skip" \
-H "X-API-Key: $FLOW_API_KEY"
The response is the ticket. Skipping releases a ticket the key's creator holds so another reviewer can take it.
| Status | Message | Cause |
|---|---|---|
| 400 | Cannot skip ticket in current state | The ticket isn't in progress and held by the key's creator. Claim it first. An unknown ticket also gets this 400, not a 404. |
Release a ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/release
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID/release" \
-H "X-API-Key: $FLOW_API_KEY"
The response is the ticket, back in its queue with nobody holding it. Release frees a ticket someone claimed and left. Another reviewer can then claim it. The key's creator can release a ticket they hold, and so can an organization admin or a supervisor of the ticket's queue, whoever holds it. A ticket that was escalated goes back as escalated. Ticket history records the release as unclaimed, with details.reason set to released.
| Status | Message | Cause |
|---|---|---|
| 403 | Only its holder, an admin or a supervisor of its queue can release this ticket | Someone else holds the ticket, and the key's creator is neither an admin nor a supervisor of its queue. |
| 409 | Nobody holds this ticket | The ticket isn't claimed, or someone decided, skipped or released it first. |
| 404 | Ticket not found | The ticket doesn't exist in your organization. |
Escalate a ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/escalate
The body needs reason, 1 to 2000 characters.
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID/escalate" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reason": "The invoice total disagrees with the purchase order."}'
The response is the ticket.
| Status | Message | Cause |
|---|---|---|
| 409 | Claim this ticket before you escalate it. | Nobody holds the ticket. Claim it first. |
| 409 | This ticket is held by …. Only the person holding a ticket can escalate it. | Someone else holds the ticket, and the key's creator may not release it. |
| 409 | This ticket has already been decided., or a similar message | The ticket is decided, already escalated, cancelled or expired. |
| 404 | Ticket not found | The ticket doesn't exist in your organization. |
| 422 | Request validation failed | reason is missing, empty or longer than 2000 characters. |
Resolve a ticket
POST /api/v1/external/accounts/<organization-id>/hitl/tickets/<ticket-id>/resolve
| Field | Type | Meaning |
|---|---|---|
approved | boolean, or null | The yes or no, for a ticket whose accepts_decision is true. Left out, it means approve. |
message | string, or null | The reviewer's note. |
variable_edits | object, or null | Whole new values, by variable name. |
variable_leaf_edits | array, or null | Corrections to single values inside a variable. |
table_actions | array, or null | Row-level changes to a table variable, recorded in the ticket's field edits. |
curl -X POST "$FLOW_URL/api/v1/external/accounts/$FLOW_ORG/hitl/tickets/$TICKET_ID/resolve" \
-H "X-API-Key: $FLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"approved": true, "message": "Total corrected.", "variable_edits": {"total": 1250.00}}'
The response is the resolved ticket. Resolving resumes the run that was waiting on it. When that run matched values against a reference table, resolving also teaches the table, as What a table learns describes; a resolve with approved: false teaches nothing. Flow queues that learning as it saves the decision, before it resumes the run, so a resolve that answers 502 or 503 still teaches the table.
| Status | Message | Cause |
|---|---|---|
| 400 | A message about the rejection | approved is false on a ticket the run can't act on a rejection for. |
| 400 | {"message": "…", "not_editable": [...], "editable": [...]} | The body edits a variable the ticket doesn't offer. not_editable lists the ones sent, editable the ones the ticket offers. |
| 400 | {"message": "Tabular cell validation failed", "errors": [...]} | A cell fails its validation rule. errors says which. |
| 400 | Variable leaf patch references a path that doesn't exist… | A variable_leaf_edits path doesn't match the ticket. Fetch the ticket again and redo the edits. |
| 409 | Claim this ticket before you decide it. | Nobody holds the ticket. Claim it first. |
| 409 | This ticket is held by …. Only the person holding a ticket can decide it. | Someone else holds the ticket. |
| 409 | This ticket has already been decided., or a similar message | The ticket is decided, escalated, cancelled or expired. |
| 400 | Cannot resolve ticket in current state | The ticket can't be resolved for another reason. Get the ticket and try again. |
| 404 | Ticket not found | The ticket doesn't exist in your organization. |
| 503 | Your decision was saved but could not be sent to the run. Shortly, a new ticket for this review opens in the same queue, with your corrections and note. Decide it again there. | The review was recorded but the run did not receive it. Decide the new ticket when it opens. |
| 502 | The ticket was resolved, but the run could not be resumed. Read the ticket with Get a ticket before retrying; a new review ticket may appear for this run. | The review was recorded but the run could not continue. A new ticket may appear for the run. |
Edits and the approved value show in the ticket's history and field edits, like a resolve from the app.
- A rejection is refused, not recorded, when the run can't act on it. Check
accepts_decisionfirst. - Claim and resolve act as the person who created the key, so two keys from one person hold the same tickets.
- A released ticket still appears in its last holder's Get Next, unlike a skipped one.