Skip to main content

Tutorial: Your First Workflow

This is the fastest way to get MOD: we'll take a product photo, remove its background, and download the cut-out — first by clicking through the UI, then the exact same thing over the API.

You'll need: a MOD account (the Free plan is fine) and any photo with a clear subject (.png or .jpg). Total time: ~5 minutes.


Part 1 — Do it in the UI

Step 1. Upload your photo

  1. In the sidebar, click Data.
  2. Click Upload (or drag the file into the window) and pick your photo.
  3. It appears in your file list.

(Screenshot: the Data page with one uploaded image in the grid.)

Step 2. Build the workflow

  1. Click Workflow Builder in the sidebar (it opens in a new tab).
  2. From the node sidebar on the left, drag an Image Input node onto the canvas.
  3. Drag a Background Extraction node onto the canvas.
  4. Draw a connection: click the output port on Image Input and drag to the input port on Background Extraction.

Your canvas should look like this:

The builder validates connections as you draw them — an incompatible pairing shows a warning instead of connecting.

Step 3. Pick your file and run

  1. Click the Image Input node and select the photo you uploaded.
  2. Click Save in the toolbar and give the workflow a name (e.g. "Cut out background").
  3. Click Run.

You'll see a per-node progress bar with a live ETA. Click the running node to tail its log.

(Screenshot: the run in progress, Background Extraction node showing a progress bar.)

Step 4. Get your result

When the run finishes (status turns green), the output node holds your background-removed image. Click it and Download.

That's a complete pipeline: input → process → output. Everything else in MOD is more nodes on that same canvas.


Part 2 — Do the exact same thing with the API

Once you've saved the workflow above, you can run it headless. Grab two things first:

  • An API key — Dashboard → Settings → API Keys → New Key (it starts with sk_, shown once).
  • The workflow version id — open your saved workflow; it's in the Workflow Builder URL, or list them with GET /workflows/.
BASE=https://dev-api.modtechlabs.com

# 0. Exchange your sk_ key for a ~1h Bearer token
TOKEN=$(curl -s -X POST "$BASE/api-keys/token" -H "Content-Type: application/json" \
-d '{"api_key": "sk_your_key_here"}' | jq -r .access_token)
AUTH="Authorization: Bearer $TOKEN"

# 1. Upload the photo -> note the returned cog "id"
COG=$(curl -s -X POST "$BASE/cogs/upload-file" -H "$AUTH" \
-F "file=@./product.jpg" | jq -r .id)

# 2. Run your saved workflow version against it (use YOUR version id)
RUN=$(curl -s -X POST "$BASE/workflows/workflow-versions/<your_version_id>/run" -H "$AUTH" \
-H "Content-Type: application/json" \
-d "{\"cog_ids\": [$COG]}" | jq -r .workflow_run_id)

# 3. Poll until it reaches a terminal status
while :; do
STATUS=$(curl -s "$BASE/workflows/workflow-runs/$RUN" -H "$AUTH" | jq -r .status)
echo "$STATUS"
case "$STATUS" in success|partial_success|failure|cancelled) break;; esac
sleep 3
done

# 4. Output files are listed under run_files; download one by its cog id
curl -s "$BASE/cogs/<output_id>/download" -H "$AUTH" -o cutout.png

Prefer Python or JavaScript? The same loop is in Getting Started → Quickstart with the API, and you can run any of these interactively in the Swagger explorer.


What you just learned

  • Files are cogs, and every workflow starts from an input node pointing at one.
  • A workflow is just nodes wired on a canvas; you save versions of it and run a version.
  • A run moves through pending → running → succeeded, and outputs are downloadable cogs.
  • Anything you do in the UI is available over the API with the same building blocks.

Where to go next

  • Swap Background Extraction for any other node — see the Node Library (texture maps, 3D/photogrammetry, video, AI, and more).
  • Process a whole folder at once with batch mode — see the Workflow Builder Guide.
  • Run it automatically on a schedule or event — see Triggers in the Features Catalog.