Skip to main content
A claims system collects evidence into a case folder: photos, police reports, repair estimates, medical records. Someone has to decide whether that evidence is complete and acceptable. That decision then has to be recorded. This tutorial hands the review to Box. When your app calls POST /reviews with selected evidence file IDs, the service tags those files with the claim ID and begins a Box Automate workflow. Box Automate assigns the approval task, waits for the decision, then runs the approved or rejected branch.

Clone the working sample

Prefer to start from running code? The complete app built in this tutorial is on GitHub. Clone it, add your Box credentials, and run.
The Box Automate workflow endpoints used in this tutorial are Beta and are not available on the . Every request must include the box-version: 2026.0 header. Beta endpoints can change before general availability.

What you are building

By the end of this tutorial, you have a working Python service that:
  • Exposes a POST /reviews endpoint your claims system uses to start a review on selected evidence files.
  • Writes the claim ID onto each selected evidence file as Box metadata, so the workflow can read it as a variable.
  • Looks up the published Automate workflow attached to the claims folder and starts it on the selected files.
Box Automate owns the review itself. Your service never polls for task state or implements approval logic.
Why metadata carries the claim ID. During the Beta, the start endpoint does not accept fields at runtime, so you cannot pass a claim ID in the request body. Writing the claim ID to each file as metadata makes it available as a workflow variable. When fields at start become available, you can pass the claim ID directly and drop this step.

Prerequisites

Before you start, make sure you have the following:
  • A with Box Automate enabled. See .
  • A Box platform application configured with Client Credentials Grant authentication, with Read and write all files and folders stored in Box enabled, App + Enterprise Access, and Generate user access tokens turned on. After you change those settings, re-authorize the app in the Admin Console.
  • The user ID of a managed user who can build and start Automate workflows (for testing, use your own user ID). The Automate list and start endpoints return workflows that user can start. They do not return results for the enterprise service account.
  • Admin access to create a metadata template, or a Box administrator who can create one for you.
  • Permission to build and publish workflows in the Box Automate builder.
  • Python 3.11 or higher.
  • A coding agent with installed. Run npx skills add box/box-for-ai in your project, or install the Cursor, Codex, or Claude Code plugin. See for setup.
Both Automate endpoints require root_readwrite, the OAuth scope behind Read and write all files and folders stored in Box. The same scope covers writing claim metadata. If a scope or feature is missing from the Developer Console, contact Box Support with the user or app context you plan to use.

Configure Box once

These steps happen in the Box Admin Console and Automate builder. An agent cannot do them for you. Complete them before you build the service.
  1. Create a Claim metadata template in the Admin Console under Metadata. Add two text fields: Claim ID and Review status. Click Save, click back into the template, then copy the template key. Confirm the generated field keys with GET /2.0/metadata_templates/enterprise/<TEMPLATE_KEY>/schema. This tutorial assumes claimId and reviewStatus.
  2. Configure Client Credentials Grant for a managed user. In Developer Console > your CCG app > Configuration, set application access to App + Enterprise Access, enable Generate user access tokens, and save. Re-authorize the app in the Admin Console. Copy the managed user’s ID (Admin Console > Users & Groups, or GET /2.0/users/me with that user’s token). You pass this ID as BOX_USER_ID so the service authenticates as that user, not as the enterprise service account.
    A service-account token can often read the claims folder and write metadata, yet GET /2.0/automate_workflows still returns an empty entries list, and start returns 400 Action not found. Authenticate as a managed user who can run Automate.
  3. Create a Claims Review folder in Box as that managed user (or invite them as an Editor), note its folder ID from the URL, and upload two or three sample PDFs. Without folder access for the user your app acts as, file and metadata calls return 404.
  4. Build and publish a Manual Start workflow in the Box Automate builder. For a full walkthrough of the builder UI, see .
    1. Open Automate, select New+Workflow, and name it Claims evidence review.
    2. Drag Manual Start onto the canvas and scope it to the Claims Review folder.
    3. Add a Task Action outcome. Set the type to Approval, assign the file to Trigger: File, and for testing set both complete and manage to Workflow owner. Optionally include the Claim ID metadata field in the task message.
    4. Branch on Approved and Rejected, and add Send Notification on each branch.
    5. Select Activate (not only Save).
    The Manual Start folder must match the folder_id you query later. An unpublished draft, or a different folder, returns an empty entries list rather than an error.
  5. Optional: inspect the workflow IDs so you recognize the response shape later. Use an access token for the same managed user your app will act as:
The top-level id is the action ID, not the workflow ID. Passing the action ID in the path returns a 404.

Build the service

Choose how to scaffold the service. Both paths produce the same app; continue to Run and verify when you finish.
Prefer not to build the project step by step? Clone the for this tutorial and run it directly.
With Box configured and installed, paste the following prompt into your coding agent. Replace the placeholders only if you want the agent to pre-fill .env; otherwise leave them and fill credentials yourself after scaffolding.
When the agent finishes, copy .env.example to .env and fill in your credentials, user ID, folder ID, and template key. Put each variable on its own line.

Run and verify

  1. Start the server (venv activated):
  1. In a second terminal, start a review. Use file IDs from the sample PDFs in Claims Review, not the folder ID:
A successful response looks like:
  1. Confirm in Box:
    • Open an evidence file → Metadata tab shows claim CLM-1042 and status in_review.
    • As the task assignee, open the approval task and confirm the claim ID appears in the message.
    • Approve or reject from the file’s Activity sidebar panel, and confirm the matching branch runs.

Troubleshooting

Your virtual environment is not activated. Run source .venv/bin/activate from the project directory before running any python3 commands. Each new terminal tab needs its own activation.
Check your .env file:
  • Verify BOX_CLIENT_ID and BOX_CLIENT_SECRET match the values in Developer Console > Configuration.
  • Ensure the app is authorized and its type is Client Credentials Grant.
Your app is requesting a user token, but the Developer Console is not set up for it. Confirm App + Enterprise Access and Generate user access tokens, then re-authorize the app in the Admin Console. Verify BOX_USER_ID is the managed user’s ID (digits only, no spaces).
The request succeeded, but no workflow matched for this caller. Check each of the following:
  • You are authenticated as a managed user who can run Automate, not as the enterprise service account. A user token that returns the workflow while the app returns entries: [] usually means the app still uses enterprise_id instead of user_id.
  • The workflow is published, not saved as a draft.
  • The workflow has a Manual Start trigger.
  • The trigger’s folder is the folder whose ID you passed as folder_id.
  • The managed user can access that folder.
Several causes produce a 404 here:
  • Box Automate is not enabled for your enterprise. Ask your admin to .
  • Your account is on the Free Developer Plan, where these endpoints are unavailable.
  • The box-version: 2026.0 header is missing.
  • You passed the action ID in the URL path. The path takes entries[].workflow.id; the body takes entries[].id.
The workflow and action IDs can be valid for a different actor. Hardcoding IDs from a successful user-token curl does not help if the app still authenticates as the service account. Switch the client to BOX_USER_ID, then confirm that file_ids contains at least one ID, at most 20 IDs, and that every file is within the Manual Start folder scope.
The request reached the workflow but the payload was rejected. Confirm that file_ids contains at least one ID, that it holds no more than 20 IDs, and that every file is within the folder scope configured on the Manual Start trigger.
The workflow variable is not resolving to your metadata field. Confirm that the field keys in tag_evidence match the fields[].key values returned by GET /2.0/metadata_templates/enterprise/:key/schema, and that the task message references the Claim ID field from that template.
The app is missing the required scope. Enable Read and write all files and folders stored in Box in the Developer Console. Depending on your authentication method and enterprise settings, the app requires admin authorization or reauthorization in the Admin Console before a scope change takes effect.
The Automate endpoints are Beta and not yet in box-sdk-gen. Re-paste the prompt and emphasize client.make_request with box-version: 2026.0, or select the Build by hand tab in Build the service for the tested modules.

Scaling to production

The sample calls GET /2.0/automate_workflows on every review to resolve the workflow by name. That list call is optional in production. The IDs you need are stable for a given published workflow:Resolve them once at startup, or store them as configuration after a successful list call:
Then call start with those IDs and skip find_workflow_action. Keep the list lookup as a fallback if start begins failing (for example after you replace the workflow in the builder).
Caching IDs only skips the list call. Start still requires a managed user who can run Automate. Hardcoding IDs from a successful user-token curl does not work if the app authenticates as the enterprise service account. That case returns 400 Action not found, not an empty list.
A double-submitted request starts the workflow twice and can create duplicate approval tasks on the same evidence. Do not rely on reviewStatus: in_review alone as a lock: this tutorial sets that value when a review starts and never clears it, so a naive skip would block legitimate resubmits.Prefer an idempotency check in your claims system (for example, ignore a repeat claim_id + file_ids start while a review is open), or inspect the file for an incomplete approval task before calling start. If you use metadata as the lock, add an Automate outcome on the approved and rejected branches that updates reviewStatus when the decision is done.
POST /reviews needs authentication in production. Verify a signed request from your claims system, or place the service behind your existing gateway. Keep credentials in a secret manager rather than a .env file, and never expose user or app tokens to a browser client. Prefer a dedicated managed user with the least Automate and folder access your flow needs, rather than a personal admin account.
Tagging metadata before the run is a workaround for a Beta limitation, and it costs one API call per file. When the start endpoint accepts fields at runtime, pass the claim ID directly in the start request and keep metadata only where you want the claim ID to persist on the file for search and reporting. Isolating the workaround in claims_metadata.py makes that a single-module change.
A single start request accepts 20 files at most. For larger evidence sets, split the files into batches and start one run per batch (each batch can create its own approval tasks), or restructure the workflow to trigger on the case folder rather than on individual files.

Next steps

Box Agent Skills

Install skills so your coding agent can scaffold more Box integrations from natural language.

Start Automate workflow

See the full API specification for the manual start endpoint.
Last modified on August 21, 2026