> ## Documentation Index
> Fetch the complete documentation index at: https://docs.myworklayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Review

> Keep humans in the loop when decisions matter. Surface approvals, questions, and app connections in your own app and resume Workers the moment someone responds.

A **Review** is any moment where a factory pauses work and asks for human input before continuing—whether that's approving a sensitive tool call, answering a clarifying question, or connecting a required app.

The Worker waits safely until a person responds, and your application can render and resolve Reviews directly inside your own UI through the Factory API.

In the support example, the Worker prepares to refund order 1188. Because `stripe_create_refund` is configured to require sign-off, the Worker pauses and emits a Review. Your app notifies a support lead, captures their decision, and sends it back—unblocking the refund immediately.

![Human-in-the-loop Review flow: Worker pauses on a tool approval, Worklayer emits reviews.approvals.created, your app collects approval, submits POST /reviews/\{requestId}/decision, and the Worker resumes.](https://mintcdn.com/worklayer-17401167/cpUXFKQRIMsNdzrq/images/diagrams/review-loop-light.svg?fit=max\&auto=format\&n=cpUXFKQRIMsNdzrq\&q=85\&s=bfd1d80c55b213f26019aeb2d9c14aee)

## Review types

The Factory API supports three Review types today under `/v1/rooms/{roomId}/reviews`:

| `kind` | What the Worker needs | Resolution endpoint |
| - | - | - |
| `approval` | Approval or denial for one or more pending tool calls | [Approve or deny tool calls](https://docs.myworklayer.com/api-reference/review/approve-or-deny-tool-calls.md) |
| `question` | Answers to one or more structured questions | [Answer a question](https://docs.myworklayer.com/api-reference/review/answer-a-question.md) |
| `connect_app` | A person to authorize a required third-party app | [Get a connect-app link](https://docs.myworklayer.com/api-reference/review/get-a-connect-app-link.md) |

## Detecting pending Reviews

When a Worker requests a Review, its status switches to `waiting` until the request is resolved. You can discover pending Reviews in two ways:

* **Push (recommended):** subscribe to `reviews.approvals.created`, `reviews.questions.created`, and `reviews.connect_apps.created` via [Subscriptions](https://docs.myworklayer.com/subscriptions.md).
* **Poll:** call `GET /v1/rooms/{roomId}/reviews` to list pending requests for the Room, oldest first (optionally filtered by `workerId` and `kind`).

```json theme={null}
{
  "requests": [
    {
      "requestId": "wr1.Y2x4Mmh0cTlrMDAwMQ.2.Qm9vVGF0Y2hlcy1maW5nZXJwcmludC1leGFtcGxlXzQz",
      "workerId": "6f1c2a9e-4b7d-4e2a-9c51-3d8e0b7a1f24",
      "kind": "approval",
      "calls": [
        { "tool": "stripe_create_refund", "callNumber": 1, "inputFields": ["charge", "amount"] }
      ]
    }
  ]
}
```

*(Tool names reflect whichever apps are connected to your factory.)*

## Resolving a Review from your app

> [tab] Approval
>
> Send `approve` or `deny` for the pending `requestId`:
>
> ```bash theme={null}
> curl -X POST "https://api.myworklayer.com/v1/rooms/$ROOM_ID/reviews/$REQUEST_ID/decision"       -H "Authorization: Bearer $WORKLAYER_API_KEY"       -H "Content-Type: application/json"       -d '{"decision": "approve"}'
> ```
>
> The decision applies to every tool call listed in `calls`. For security, the request exposes tool names and input field names rather than raw input values.

> [tab] Question
>
> Submit an `answers` map keyed by each question's `id`. Each entry provides either selected `optionIds` or freeform `text`:
>
> ```json theme={null}
> {
>   "answers": {
>     "refund_reason": { "optionIds": ["duplicate_charge"] },
>     "note": { "text": "Let the customer know the refund takes 5 to 10 business days." }
>   }
> }
> ```
>
> * `optionIds`: 1 to 10 distinct option IDs. Multiple IDs are allowed only when the question specifies `multiSelect: true`.
> * `text`: 1 to 1,000 non-blank characters.
>
> Answers that don't match the pending questions return `400 Bad Request`.

> [tab] Connect an app
>
> App OAuth flows require an interactive sign-in and cannot be completed purely server-side. Call `GET /v1/rooms/{roomId}/reviews/{requestId}/connect-app` to get a Worklayer web link:
>
> ```json theme={null}
> { "url": "https://app.myworklayer.com/actions/wr1.Y2x4Mmh0cTlrMDAwMQ.2.Qm9vVGF0Y2hlcy1maW5nZXJwcmludC1leGFtcGxlXzQz" }
> ```
>
> Open or send this URL to a teammate authorized to connect the app. Once they complete sign-in, the Worker resumes automatically.

Approval and question responses return `200 OK` with `requestId` and `workerId`, and the Worker resumes immediately.

## Who can resolve a Review

Reviews aren't locked to a single surface—the first valid response wins:

* **Your application**, via the Factory API using the factory's API key.
* **Your team in the Worklayer web app** (the owner and authorized factory members).
* **Your team in Slack**, when the task originated from a Slack [Channel](https://docs.myworklayer.com/channels.md#how-the-factory-replies).

Once resolved, the Review is closed and any subsequent submission returns `409 Conflict`.

## Handling requestId updates

Always use the latest `requestId` returned by `GET /v1/rooms/{roomId}/reviews` or your webhook payload. If the pending tool calls or questions change before someone responds, Worklayer issues a new `requestId`. Submitting an outdated `requestId` returns `409 Conflict` with `Request has changed.`—simply re-fetch the pending Reviews and present the updated request.

## Errors

| Status | Cause |
| - | - |
| `400` | Invalid request body, or answers don't match the pending questions. |
| `402` | The Worker cannot resume because of a billing limit. |
| `404` | Review not found, wrong Review kind for the endpoint, or not in this Room. |
| `409` | The Review changed (`Request has changed.`) or has already been resolved. |

> [card] [Workers](https://docs.myworklayer.com/workers.md)
>
> Inspect the status and live output of the Worker waiting on Review.

> [card] [Subscriptions](https://docs.myworklayer.com/subscriptions.md)
>
> Receive instant webhooks whenever a Review is created.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.