---
title: "Open a fan-out run and mint its shared id (T880)"
method: POST
path: "/api/agent/runs"
tags: ["Agent"]
---

# Open a fan-out run and mint its shared id (T880)

`POST /api/agent/runs`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/agent/runs`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

The orchestrator calls this once before spawning, then pastes the returned `runId` into every agent's prompt alongside the other pinned contracts. Registering the run is what makes the findings channel's empty state honest — without it, "nobody has found anything yet" and "you were handed an id nobody shares" are the same empty list. Idempotent on (tenant, run_id): re-opening returns the existing record without overwriting its label.

## Request body

- object
  - `run_id` string: Reuse a specific id; omit to mint one
  - `label` string
  - `session_id` integer: The orchestrator's session

## Response `201`

Run opened (or the existing record, on a re-open).

- object
  - `runId` string
  - `label` string, nullable
  - `openedBySessionId` integer, nullable
  - `createdAt` string, date-time

## Other responses

- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
