{
    "openapi": "3.0.3",
    "info": {
        "title": "SynovAI Public API",
        "version": "1.17.0",
        "description": "Programmatic access to SynovAI retrosynthesis pipelines. Submit molecules, run predictions asynchronously, retrieve route trees, references, convergence analysis, and per-end-user usage data. Authenticate with a per-customer API key created via /manage/api-keys.\n\nFor MCP-native clients, the same tools are exposed at POST /api/v1/mcp using the Streamable HTTP transport (JSON-RPC 2.0).\n\n## Response schema stability\n\nRoute-carrying responses include `schema_version` (currently 1.0), the version of the ROUTE-TREE shape \u2014 `path_dicts` and the `TreeNode` fields inside it \u2014 not of the HTTP API, which is the `/v1` or `/v2` in the path.\n\nFields marked `x-stable: true` in the schemas below are designated STABLE. A stable field is removed, renamed, re-typed or re-positioned only under a new schema version, on not less than 90 days' prior written notice, with both versions served for not less than 90 days after the effective date.\n\nFields not so designated are DIAGNOSTIC: they may change without notice and should not be relied on in a production interface. You may request that a field be designated stable; designation takes effect on our written confirmation.\n\nAdding fields, nodes or permitted values is never a breaking change and does not bump the schema version. Disregard fields you do not recognise.\n\nMINOR (1.0 -> 1.1) means additive and backwards-compatible. MAJOR (1.x -> 2.0) means an existing field changed. Pin on the major if you parse the tree.\n\n## Errors come in three shapes\n\n`ErrorResponse` carries prose in `error`. `CodedErrorResponse` puts a machine code in `error` and the prose in `message`. `JsonRpcErrorResponse`, from `/mcp` only, has no `status` at all and an OBJECT in `error`. Handle all three; rendering `json.error` blindly prints `[object Object]` for the third. \n\n## Error HTTP status codes (`/execute`)\n\nHistorically every `/execute` refusal — bad input, unknown tool, pipeline-not-available, and every class refusal — answered **HTTP 200** with `status: error` in the body; only auth (401/403), spend cap (402), busy (429) and server faults (500/503) used real codes. Real HTTP status codes are now the DEFAULT for every key; send `SynovAI-Errors: legacy` for the backward-compatible HTTP 200 body. One refusal differs from the old behaviour in BOTH modes: a failed job dispatch (`code: SUBMIT_FAILED`) now returns HTTP 500 in both modes rather than 200, because the reservation had already committed and returning 200 for that would report a dead job as accepted. Every error body now also carries a stable machine `code` (adding a field is not a breaking change). Send `SynovAI-Errors: legacy` to force the old 200 behaviour; omit it (or send `http`) for real codes, which is the default for every key. In `http` mode the mapping is: 400 bad input, 402 spend cap exceeded, 403 not allowed, 404 unknown student, 409 project locked/closed, 422 run limit reached, 429 busy (with `Retry-After`), 500/503 our faults. (402 spend cap, 429 busy and 500/503 server faults are returned in BOTH modes; legacy mode only changes the refusals that would otherwise answer 200.) The `status` and `code` body fields are identical in both modes — branch on `code`, not on the HTTP status, and you are correct under either rollout.\n\n## What `x-stable: true` does and does not promise\n\nIt promises the field will not be removed, renamed or re-typed without notice. It does **not** promise the field is always present. `reference_metadata.references`, for example, is designated stable and is absent from nodes that have no literature precedent. Treat a stable field as optional-but-unchanging, and never assume presence.\n\n## Read-only keys\n\nA key is `full` (the default) or `read_only`. A read-only key is for dashboards and CI that read results: it can read jobs, batches, rankings and exports, but it cannot spend money, submit or move runs, store anything or change configuration. The owner chooses it when creating a key on Account \u2192 API keys (also for a key of a partner contract, which then shares the contract's rate limit and stateless setting but spends nothing), or SynovAI staff mint one for you. It is fixed for the life of the key: rotating keeps it, and there is no way to widen it, so mint a full key when you need one.\n\nEvery operation in this spec carries `x-key-scope`: `read` means a read-only key may call it, `write` means it answers **403** with `error: \"key_scope_read_only\"` (see `ReadOnlyKeyRefusal`) and the header `X-Key-Scope: read_only`, before anything runs, is charged or counts against the rate limit. The writes are: `POST /execute`, `POST /conditions`, `POST /route-conditions`, `POST /patents/check`, `POST /outcomes`, moving a run or adding a pipeline stage, writes to `/views`, `/batch-templates` and `/scoring-profiles`, webhook management, `POST /api/v2/batch` (inline and chunked), and a batch's `/targets` and `/upload` POSTs, `/seal`, `/pause`, `/resume`, `/retry`, `/cancel` and `/handoff`, and `POST /api/v2/deep-link`. Four GETs are writes too, because they are billed per molecule: `/jobs/{jobId}/analysis`, `/jobs/{jobId}/convergence`, `/jobs/{jobId}/references` and `/jobs/{jobId}/sourcing`. The free `GET /api/v2/batch/{job_id}/convergence` is a read.\n\nTwo endpoints are reads with one write branch. `POST /api/v2/batch/{job_id}/export` is allowed synchronously, but `async: true` (which stores the file and queues work) answers 403 `key_scope_read_only`. On `POST /mcp`, `tools/list` offers a read-only key only the read tools (`get_job_status`, `get_job_references`, `get_job_convergence`, `validate_smiles`, `list_projects`, `list_folders`), and `tools/call` on `submit_retrosynthesis`, `predict_conditions` or `log_outcome` returns a JSON-RPC error with `error.data.code` `key_scope_read_only`.\n\nA read-only key reads what its owner can read, exactly like a full key of the same owner.\n\n## Class chatbot keys\n\nA class chatbot key belongs to ONE class that has the class WhatSyn add-on. The class owner (the teacher) creates it on the class's WhatSyn tab, and it is shown once. It is a scoped key, not general API access. It may call only:\n\n- `POST /execute` with `tool` `predict_route` or `super_sample`, always with `on_behalf_of` (the student's email);\n- `GET /jobs/{jobId}` for jobs this key submitted;\n- `GET /class/projects`.\n\nEverything else answers 403 `class_key_scope`. On every request the key also answers 403 `addon_inactive` while the class's add-on is switched off or outside its open/close dates, and 403 `key_inactive` once the teacher who created it no longer manages the class. A class key's errors use real HTTP status codes by default (send `SynovAI-Errors: legacy` for the 200 body); `ClassRunError` lists every class code with its status. A class run is owned by the student, filed in the student's group project for the class project and never charged to the student. A class key gets the standard per-key rate limit (60 requests a minute unless your agreement says otherwise; read `X-RateLimit-Limit`), shared by every student the key submits for, so pace job polling accordingly.\n\n## Rate limits, and what they do not bound\n\nTwo different limits get confused with each other. They are unrelated and are enforced in different places.\n\n**Requests per minute is PER KEY.** Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds). **Read `X-RateLimit-Limit` rather than any number written in a document**, including this one: the ceiling is a property of your key, your agreement may set it higher or lower, and it can be changed for your key without this spec changing. 60 a minute is only the platform default, applied to a key that has no value of its own. Over it, the request is refused **429** with `code: rate_limit_exceeded` and the three `X-RateLimit-*` headers (no `Retry-After` on this one: wait until `X-RateLimit-Reset`).\n\nAll the keys of one partner contract **share a single bucket**. Minting a second key does not double your request rate, and polling spends the same allowance as submitting, so a client with many jobs in flight should pace its polling against the one shared number.\n\n**This limit counts REQUESTS, not molecules.** One `POST /api/v2/batch` carrying 100 targets is one request against it, and one `POST /patents/check` carrying 1,000 SMILES is one request. What bounds volume is a different set of limits entirely: your spend caps, your run concurrency and queue depth, your daily run cap, and a sandbox key's daily run quota. A batch's 100 targets are 100 runs against those.\n\n**Run limits are also per key**, and are not stated here for the same reason. A partner key runs the concurrency, queue depth and daily run cap agreed for that key; any other key runs its plan's. A refusal always names the limit it applied, so read the message in the 429 rather than inferring the number. Queue pressure answers **429** with `code: busy` and a `Retry-After`; it is not a billing refusal and nothing is charged.\n\n## SMILES in URLs\n\nSend SMILES in the JSON request body. SMILES use characters that mean something in a URL: `#` (a triple bond) starts a URL fragment, `+` (a charge) reads as a space in a query string, `/` and `\\` are stereo bonds, and `%`, `=`, `@`, `[` and `]` are reserved too. If you ever put a SMILES in a query string or a link, percent-encode it first (`encodeURIComponent(smiles)` in JavaScript, `urllib.parse.quote(smiles, safe='')` in Python). Inside JSON a backslash must be written `\\\\`; a JSON library does that for you, so build bodies with one rather than by string concatenation.\n\n## Projects, folders and pipeline stages\n\nEvery new run is filed in a project. Send `project_id`, and optionally `folder_id`, on `POST /execute` (top level, beside `tool`), `POST /api/v2/batch` (see below) and the MCP tool `submit_retrosynthesis` (as tool arguments). No folder means Unsorted.\n\nWithout `project_id` the run goes in the key's **default project**, named \"API runs: <key label>\". It is made the first time a key sends a run without `project_id`, owned by the key's owner, and reused after that. Each key has its own, including each key of a partner contract. The owner can rename it, share it, or add folders like any other project. If it is deleted or archived, the next such run makes a new one. A `folder_id` without `project_id` names a folder of the default project.\n\nAn accepted response echoes `project_id` and `folder_id`.\n\nRefusals use these codes, and cost nothing: nothing is created or billed. They use the real HTTP status in both error modes. On `/mcp` the body is a JSON-RPC error with the code in `error.data.code`; the HTTP status is 200 inside a JSON-RPC batch, where each item has its own outcome.\n\n- `400 project_required`: no `project_id`, from a credential with no API key behind it to hold a default project.\n- `400 project_not_applicable`: a stateless key sent `project_id` or `folder_id` on `/execute` with `predict_route` or on `/api/v2/batch`, or called `POST /projects/{project_id}/stages` or `PATCH /jobs/{jobId}`. Its runs keep no results and are not filed.\n- `404 project_not_found`: the project does not exist, or the key owner cannot add runs to it. The two are deliberately the same answer.\n- `404 folder_not_found`: the folder does not exist, is in another project, or the key owner cannot open it. The same answer again.\n\nFind them with `GET /projects`, `GET /projects/{project_id}/folders` and `GET /projects/{project_id}/stages`, or the MCP tools `list_projects` and `list_folders`. They list only what the key owner can see, with `fileable` on each: false for a viewer, and for a folder with `navigation_only` true, which is shown only because a folder below it is open. On these GET routes a stateless key sees `fileable` false everywhere, as `predict_route` and batch do not file its runs.\n\n### Filing a batch\n\n`project_id` and `folder_id` at the top level are the default for the batch. Each entry in `input.targets` is a SMILES string, which takes the default, or an object `{ \"smiles\": \"...\", \"project_id\": \"...\", \"folder_id\": \"...\" }`. A target with its own `project_id` does not take the default folder: it goes in that project's Unsorted unless it names a folder. A target with only `folder_id` names a folder of the default project, and `folder_id: null` is the default project's Unsorted. Unknown fields in a target are refused.\n\nEvery target is checked before anything is created. If any is refused the whole submission is, and `failed_targets` lists each `{ index, error, message }`. The top-level `error` is the code they share, or `target_filing_refused` when they differ. An accepted batch returns `targets`, with the `task_id`, `project_id` and `folder_id` for each index.\n\n### Reading a batch\n\nA batch is not an access group. Status, result and cancel cover only the targets the caller can read now, and every total and rollup counts only those. Results carry `position` (the index in your submission), `task_id` and `target_smiles`. A target you can no longer read is left out, so positions can have gaps, and totals count only what is listed. Per-molecule callbacks carry `batch.position` too. Cancel skips a target the caller can read but not add to. If none is readable the answer is the same 404 as a batch that does not exist.\n\nStateless keys do not send these fields on `/execute` with `predict_route` or on `/api/v2/batch`. `super_sample` and MCP store their results whatever the key, so they need a project from every key.\n\n### Pipeline stages and moving a run\n\nA project's pipeline is an ordered list of stages. `GET /projects/{project_id}/stages` lists the live ones; `POST` adds one at the end (the project owner or a non-viewer member). `PATCH /jobs/{jobId}` with `project_id`, `folder_id` and `stage_id` moves a run, by exactly the rules the app uses, with the key's owner as the actor:\n\n- **Project.** A run stays in the project it was filed in, except that its owner (while the project is not locked) or a project admin can move it to another project of the same organization. It never leaves for no project. A run that is not yet filed is filed by the person who ran it. The stage does not travel: set `stage_id` in a second request once the run is there.\n- **Folder.** A folder you can open; `null` is Unsorted, which a run in a subfolder never goes back to.\n- **Stage.** The run's owner, or the project owner or a non-viewer member. `null` clears it. An archived stage is refused with `409 stage_archived`, a stage of another project with `404 stage_not_found`.\n- **A stage that needs approval** (`requires_approval: true`) does not move the run, in the API or the app. It opens a stage-transition decision that records the target stage (`decision.target_stage_id`) and who asked (`decision.requested_by_user_id`), for the project owner (`decision.approver_user_ids`) to sign off, and answers **202** with `status: pending_approval` and the `decision_id`; asking again while it is open returns the same one. **Approving the decision moves the run** into the stage, after checking again that the run is still in the project, the stage is not archived and the run is not already there; if any of those fails, the decision closes as unable to apply, with the reason, and the run does not move. Rejecting or withdrawing it leaves the run where it is. The project owner, being the approver, moves straight in and gets 200. Turning `requires_approval` off later leaves open decisions open, and approving them still moves the run. Send `stage_id` alone for such a stage.\n\nEverything a later step would refuse is checked before the first write, so a refused request changes nothing. Other refusals: `403 forbidden` (you can see the run but not do this to it), `404 job_not_found` (no such run, or not one you can read: the same answer), `409 move_refused` (a rule said no; `error` says which), `409 job_not_filed`.",
        "x-paramus-tools": [
            {
                "id": "synovai_predict_route",
                "execution": "async",
                "endpoints": {
                    "submit": "/api/v1/execute",
                    "status": "/api/v1/jobs/{job_id}",
                    "quote": "/api/v1/forecast"
                },
                "endpoint": "/api/v1/execute",
                "quote_endpoint": "/api/v1/forecast",
                "cost_usd": 5,
                "cost_model": "quoted"
            },
            {
                "id": "synovai_predict_route_f",
                "execution": "async",
                "endpoints": {
                    "submit": "/api/v1/execute",
                    "status": "/api/v1/jobs/{job_id}",
                    "quote": "/api/v1/forecast"
                },
                "endpoint": "/api/v1/execute",
                "quote_endpoint": "/api/v1/forecast",
                "cost_usd": 5,
                "cost_model": "quoted",
                "deprecated": true,
                "deprecation_note": "Alias for synovai_predict_route. Coordinate with SynovAI before removing; existing Paramus integrations may still call this ID."
            },
            {
                "id": "synovai_validate_smiles",
                "execution": "realtime",
                "endpoints": {
                    "invoke": "/api/v1/validate-smiles"
                },
                "endpoint": "/api/v1/validate-smiles",
                "cost_usd": 0,
                "cost_model": "fixed"
            },
            {
                "id": "synovai_library_convergence",
                "execution": "realtime",
                "endpoints": {
                    "invoke": "/api/v1/library-convergence"
                },
                "endpoint": "/api/v1/library-convergence",
                "cost_usd": 0,
                "cost_model": "fixed"
            },
            {
                "id": "synovai_screen_library",
                "execution": "async",
                "endpoints": {
                    "submit": "/api/v2/batch",
                    "status": "/api/v2/batch/{job_id}",
                    "result": "/api/v2/batch/{job_id}/result",
                    "cancel": "/api/v2/batch/{job_id}/cancel"
                },
                "pricing": {
                    "cost_usd_max": 500,
                    "cost_usd_per_item": 5
                },
                "description": "Library screening workflow: fan-out predict_route over up to 100 target SMILES. Each child costs $5; total cost = $5 * len(targets)."
            }
        ]
    },
    "servers": [
        {
            "url": "https://platform.synovai.net/api/v1",
            "description": "Production. Absolute so an imported spec works in Postman, codegen and HTTP clients without the integrator having to know the host."
        },
        {
            "url": "/api/v1",
            "description": "Relative. Used by the interactive docs at /api/v1/docs/ui, which are served same-origin."
        }
    ],
    "security": [
        {
            "BearerAuth": []
        },
        {
            "ApiKeyAuth": []
        }
    ],
    "paths": {
        "/health": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getHealth",
                "summary": "Health check",
                "description": "Returns the health status of the API, database, and model server. No authentication required.",
                "security": [],
                "responses": {
                    "200": {
                        "description": "Service is healthy",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HealthResponse"
                                },
                                "example": {
                                    "status": "ok",
                                    "database": "ok",
                                    "models": "ok",
                                    "timestamp": "2026-04-07T12:00:00.000Z"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "Service unhealthy (database unreachable)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Database unreachable"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tools": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listTools",
                "summary": "List available tools",
                "description": "Returns the list of available retrosynthesis tools with their parameters and current per-call cost.",
                "responses": {
                    "200": {
                        "description": "List of tools",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Tool"
                                    }
                                },
                                "example": [
                                    {
                                        "name": "predict_route",
                                        "description": "Generate retrosynthesis routes using Pipeline F (canonical). Alias: predict_route_f (deprecated).",
                                        "cost_per_call_usd": 5,
                                        "params": {
                                            "smiles": {
                                                "type": "string",
                                                "required": true,
                                                "description": "Target molecule SMILES string"
                                            },
                                            "num_steps": {
                                                "type": "integer",
                                                "required": false,
                                                "default": 3,
                                                "min": 2,
                                                "max": 8,
                                                "description": "Target route length the search aims for. The 2-8 range bounds the INPUT, not the output: returned routes are not strictly capped by it and have come back longer (depth 9 observed at num_steps=8). Treat it as a guide, not a guarantee. Null for auto."
                                            },
                                            "starting_material": {
                                                "type": "string",
                                                "required": false,
                                                "default": null,
                                                "description": "Starting material SMILES (optional)"
                                            },
                                            "deep_search": {
                                                "type": "boolean",
                                                "required": false,
                                                "default": false,
                                                "description": "Enable deep search for more diverse routes"
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/forecast": {
            "post": {
                "x-key-scope": "read",
                "operationId": "forecastCost",
                "summary": "Forecast job cost",
                "description": "Returns the current cost in USD for a single call to the specified tool. Does not execute the tool.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ForecastRequest"
                            },
                            "example": {
                                "tool": "predict_route"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Cost forecast",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ForecastResponse"
                                },
                                "example": {
                                    "cost_usd": 5
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Unknown tool",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Unknown tool: invalid_tool. Use GET /api/v1/tools to list available tools."
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "500": {
                        "description": "Internal error (worker not found)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Worker not found"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/execute": {
            "post": {
                "x-key-scope": "write",
                "operationId": "executeJob",
                "summary": "Execute a retrosynthesis job",
                "description": "Submits an asynchronous retrosynthesis job. Returns a job ID that can be polled via GET /jobs/{jobId}. Optionally provide a callback_url to receive a webhook POST when the job completes. Error status codes: by DEFAULT every key receives real HTTP status codes for validation/refusal errors; the body carries status 'error' and a machine `code`. The real-code mapping is (400/402/403/404/409/422/429/500/503 — see the API description); send `SynovAI-Errors: legacy` to force the backward-compatible HTTP 200 body instead. One refusal changes in BOTH modes: a failed dispatch (`code: SUBMIT_FAILED`) now returns 500, not 200. A class chatbot key (class WhatSyn add-on) submits runs for a student with `on_behalf_of`; see that field.",
                "parameters": [
                    {
                        "name": "SynovAI-Errors",
                        "in": "header",
                        "required": false,
                        "description": "Opt in to real HTTP status codes for errors. `http` = return 400/402/403/404/409/422/429/500/503 per the mapping in the API description; `legacy` (or `200`) = the backward-compatible HTTP 200 body. Omitted = real codes, the default for every key. The `status` and `code` body fields are the same either way.",
                        "schema": {
                            "type": "string",
                            "enum": ["http", "legacy", "200"]
                        }
                    },
                    {
                        "name": "X-End-User-Id",
                        "in": "header",
                        "required": false,
                        "description": "Attributes this run to one of YOUR end customers. Opaque to us. This is what `GET /usage` groups `by_end_user` on and what launch credits are counted against, so a run sent without it is attributed to nobody and is reported under `end_user_id: null`.\n\nThe same value may instead be sent as `end_user_id` in the JSON body, for clients that cannot set a custom header. If BOTH are sent the HEADER wins. Send one.\n\n⚠️ `POST /api/v2/batch` does NOT read this header. A batch takes its end user from the `user` field in the body. A header sent to the batch endpoint is ignored, so the batch's usage is attributed to nobody.\n\n⚠️ The value must match `^[\\w@.+\\-:]{1,128}$` (letters, digits, underscore, `@`, `.`, `+`, `-`, `:`; at most 128 characters). A value outside that set — a space, a comma, an accented letter, anything longer — is DROPPED to null rather than refused: the run is accepted and billed, with no attribution and no launch credit. Check the `end_user_id` echoed in the accepted response against what you sent.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[\\w@.+\\-:]{1,128}$"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ExecuteRequest"
                            },
                            "example": {
                                "tool": "predict_route",
                                "callback_url": "https://api.paramus.ai/webhooks/synovai",
                                "end_user_id": "acme-labs",
                                "params": {
                                    "smiles": "CC(=O)Oc1ccccc1C(=O)O",
                                    "num_steps": 3,
                                    "temperature": "Standard"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Job accepted, OR (only in `SynovAI-Errors: legacy` mode) a refusal carried in the body. Check the `status` field to distinguish success from error; read `code` for the machine-readable reason. By default refusals use real HTTP status codes (400/402/403/404/409/422/429/500/503) instead of this 200; send `SynovAI-Errors: legacy` for the 200 body. A failed dispatch (`code: SUBMIT_FAILED`) returns 500 in both modes.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ExecuteAcceptedResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        }
                                    ],
                                    "discriminator": {
                                        "propertyName": "status"
                                    }
                                },
                                "examples": {
                                    "accepted": {
                                        "summary": "Job accepted",
                                        "value": {
                                            "status": "accepted",
                                            "job_id": "cm9abc123def456",
                                            "poll_url": "/api/v1/jobs/cm9abc123def456",
                                            "cost_usd": 5
                                        }
                                    },
                                    "error": {
                                        "summary": "Validation error (legacy mode: HTTP 200 with a code in the body)",
                                        "value": {
                                            "status": "error",
                                            "error": "Missing required parameter: smiles",
                                            "code": "invalid_request"
                                        }
                                    },
                                    "super_sample_accepted": {
                                        "summary": "SuperSampling accepted \u2014 a narrowed 24-permutation sweep",
                                        "value": {
                                            "status": "accepted",
                                            "job_id": "cm9abc123def456",
                                            "poll_url": "/api/v1/jobs/cm9abc123def456",
                                            "grid_size": 24,
                                            "cost_usd": 12.0,
                                            "billed_per_permutation": true,
                                            "end_user_id": null,
                                            "message": "SuperSampling started \u2014 24 permutations: 2-4 steps \u00b7 all precedence levels \u00b7 deep search on and off. Results merge into this one job; poll it as normal.",
                                            "sweeping": "2-4 steps \u00b7 all precedence levels \u00b7 deep search on and off"
                                        }
                                    },
                                    "class_run_accepted": {
                                        "summary": "Class chatbot key: a SuperSampling run for a student",
                                        "value": {
                                            "status": "accepted",
                                            "job_id": "cm9abc123def456",
                                            "poll_url": "/api/v1/jobs/cm9abc123def456",
                                            "view_url": "https://platform.synovai.net/tasks/cm9abc123def456",
                                            "project_url": "https://platform.synovai.net/projects/cm9proj000group1",
                                            "queue_position": 3,
                                            "class_project": "cm9classproj001",
                                            "on_behalf_of": "student@university.edu",
                                            "tool": "super_sample",
                                            "lengths": [2, 4, 7],
                                            "grid_size": 24,
                                            "sweeping": "2, 4, 7 steps \u00b7 all precedence levels \u00b7 deep search on and off",
                                            "cost_usd": 0
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "Class chatbot key refused (`ClassKeyForbidden` codes), or a read-only key (`key_scope_read_only`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        { "$ref": "#/components/schemas/ClassKeyRefusal" },
                                        { "$ref": "#/components/schemas/ReadOnlyKeyRefusal" }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad input, in `http` mode (the default for every key; `SynovAI-Errors: legacy` answers 200 instead). Codes include `invalid_json`, `invalid_request`, `unknown_tool`, `invalid_smiles`, `invalid_route_length`, `invalid_callback_url`, `callback_url_required`, `too_many_exclusions`, `stateless_not_supported` (a `catalog_id` on a stateless key), and for class keys `class_project_required`. An unknown or inaccessible `catalog_id` is 404 `catalog_not_found`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Missing required parameter: smiles",
                                    "code": "invalid_request"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Class chatbot keys, `http` mode: `student_not_enrolled`, no enrolled student in the class has the `on_behalf_of` email.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "No student in this class has that email. The student must join the class in SynovAI with this email first.",
                                    "code": "student_not_enrolled"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Class chatbot keys, `http` mode: `project_closed` or `project_locked`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "This class project is not open for runs.",
                                    "code": "project_closed"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Class chatbot keys, `http` mode: `run_limit_reached` (`limit` says whether the student or the group hit it).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "This student has used 5 of 5 single runs in this class this term.",
                                    "code": "run_limit_reached",
                                    "limit": "student"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Our fault; nothing ran. `SUBMIT_FAILED` and `NO_KEY_OWNER` (both modes), and in `http` mode `submit_failed` (class keys) and `SUPERSAMPLING_START_FAILED`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Failed to submit job",
                                    "code": "SUBMIT_FAILED"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The pipeline is unavailable (`pipeline_unavailable`, or `models_unavailable` for a class key, in `http` mode) or capacity could not be reserved (`RESERVE_FAILED`, both modes). Retry later.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/ErrorResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/ClassRunError"
                                        }
                                    ]
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Pipeline not available",
                                    "code": "pipeline_unavailable"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too busy; nothing was started and nothing was charged. Sent in BOTH error modes. `busy` (ordinary keys) and, for class chatbot keys, `class_busy` (the class has its maximum runs in progress) or `engine_busy` (the retrosynthesis engine is at capacity) carry a `Retry-After` header in seconds: wait at least that long, then send the same request again. `rate_limit_exceeded` means the key sent more requests this minute than its limit; it carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds) instead of `Retry-After`.",
                        "headers": {
                            "Retry-After": {
                                "schema": {
                                    "type": "integer"
                                },
                                "description": "Seconds to wait."
                            }
                        },
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["error"]
                                        },
                                        "error": {
                                            "type": "string"
                                        },
                                        "code": {
                                            "type": "string",
                                            "enum": ["busy", "class_busy", "engine_busy", "rate_limit_exceeded"]
                                        }
                                    }
                                },
                                "example": {
                                    "status": "error",
                                    "error": "The class already has 4 runs in progress, which is its limit. Try again in a minute or two.",
                                    "code": "class_busy"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/conditions": {
            "post": {
                "x-key-scope": "write",
                "operationId": "predictConditions",
                "summary": "Predict reaction conditions (HowSyn)",
                "description": "Predict experimental conditions (reagents, solvent, temperature, time, estimated yield) for a single reaction using HowSyn (condition prediction). Synchronous and cache-first: a cache hit returns instantly and is free; a miss runs inference (30 s - 3 min) and is billed to the API key owner at the HowSyn rate ($2.50 per uncached step unless your agreement sets a rate; GET /api/v1/tools shows yours). This is HowSyn pricing, per uncached step; it is not a WhatSyn route price. Provide either reaction_smiles OR (reactants + product). Requires the HowSyn add-on, or a contract that includes HowSyn, on the account that owns the key.",
                "security": [
                    {
                        "BearerAuth": []
                    },
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reaction_smiles": {
                                        "type": "string",
                                        "description": "Full reaction SMILES (reactants>>product)."
                                    },
                                    "reactants": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Reactant SMILES (with product)."
                                    },
                                    "product": {
                                        "type": "string",
                                        "description": "Product SMILES (with reactants)."
                                    },
                                    "mode": {
                                        "type": "string",
                                        "enum": ["conditions", "yield", "all"],
                                        "default": "conditions"
                                    },
                                    "end_user_id": {
                                        "type": "string",
                                        "description": "Opaque downstream-user id for reseller re-billing (or send X-End-User-Id header)."
                                    }
                                }
                            },
                            "example": {
                                "reaction_smiles": "Brc1ccccc1.Nc1ccccc1>>c1ccc(Nc2ccccc2)cc1",
                                "mode": "conditions"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "HowSyn prediction (cached or freshly inferred). On a sandbox key `cost_usd` is 0 and `would_cost_usd` carries the production price (0 for a cache hit); production responses have no `would_cost_usd`.",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "cached": false,
                                    "cost_usd": 2.5,
                                    "end_user_id": null,
                                    "model_version": "mosaic-v1-2026-05",
                                    "response": {
                                        "request_id": "abc-123",
                                        "model_version": "mosaic-v1-2026-05",
                                        "elapsed_ms": 41200,
                                        "warnings": [],
                                        "experts_consulted": [
                                            {
                                                "expert_id": 883,
                                                "centroid_distance": 0.85
                                            }
                                        ],
                                        "predictions": [
                                            {
                                                "rank": 1,
                                                "structured": {
                                                    "solvent": {
                                                        "name": "1,4-dioxane"
                                                    },
                                                    "temperature_c": 100,
                                                    "time_h": 16,
                                                    "yield_bin": "60-70%"
                                                }
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation failed (missing/invalid reaction input).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "Spend cap exceeded for the API key or end user.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Plan does not include HowSyn. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "MOSAIC backend error. `code` is `MOSAIC_UNREACHABLE` when the prediction service could not be reached (safe to retry), otherwise `MOSAIC_FAILED`. The body carries no upstream detail.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "504": {
                        "description": "The prediction did not finish within the server time limit (`code`: `MOSAIC_TIMEOUT`). A cold start or an unusual reaction can be slow; retry. Nothing is billed for a failed prediction.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/route-conditions": {
            "post": {
                "x-key-scope": "write",
                "operationId": "predictRouteConditions",
                "summary": "Predict conditions for a whole route (HowSyn)",
                "description": "Predict experimental conditions for every transformation in a route with HowSyn (condition prediction), billed at the same HowSyn rate as /conditions ($2.50 per uncached step unless your agreement sets a rate) for each transformation that runs inference (up to 10 steps per call). The charge is per uncached step, not per route: a route of 10 uncached steps is 10 steps, and a fully cached route is free. It is not a WhatSyn route price. Cache-first: a cached transformation is free, so a fully-cached route costs nothing. `charged_steps` and `unit_price_usd` in the response show how the total was reached. Provide either an inline `steps` array, or `task_id` + `route_index` (the API key owner must have access to the task). Each uncached transformation is 30 s - 3 min of inference, so a multi-step route can take several minutes; set generous client timeouts. Routes longer than 10 steps are rejected. Requires the HowSyn add-on, or a contract that includes HowSyn, on the account that owns the key.",
                "security": [
                    {
                        "BearerAuth": []
                    },
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "steps": {
                                        "type": "array",
                                        "maxItems": 10,
                                        "description": "The route's transformations, in order. Each is {reactants: string[], product: string}.",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "reactants": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "product": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "task_id": {
                                        "type": "string",
                                        "description": "Alternative to `steps`: a completed task you have access to."
                                    },
                                    "route_index": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "1-BASED route number within the task \u2014 the same number `?route=` takes and every `route_index` in this API reports, so a value read from /analysis or /scored can be posted straight here. (Through spec 1.8.0 this one field was 0-based, alone in the API; if you integrated against 1.8.0 or earlier, drop your -1.)"
                                    },
                                    "end_user_id": {
                                        "type": "string",
                                        "description": "Opaque downstream-user id for reseller re-billing (or send X-End-User-Id header)."
                                    }
                                }
                            },
                            "example": {
                                "steps": [
                                    {
                                        "reactants": ["Oc1ccc([N+](=O)[O-])cc1"],
                                        "product": "Nc1ccc(O)cc1"
                                    },
                                    {
                                        "reactants": ["Nc1ccc(O)cc1", "CC(=O)OC(C)=O"],
                                        "product": "CC(=O)Nc1ccc(O)cc1"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Per-step HowSyn predictions for the route. On a sandbox key `cost_usd` is 0 and `would_cost_usd` carries the production price; production responses have no `would_cost_usd`.",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "charged": true,
                                    "cost_usd": 2.5,
                                    "charged_steps": 1,
                                    "unit_price_usd": 2.5,
                                    "step_count": 2,
                                    "steps": [
                                        {
                                            "step": 1,
                                            "reaction_smiles": "Oc1ccc([N+](=O)[O-])cc1>>Nc1ccc(O)cc1",
                                            "cached": false,
                                            "model_version": "mosaic-v1-2026-05",
                                            "conditions": {}
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation error, empty route, or route longer than 10 steps."
                    },
                    "402": {
                        "description": "Spend cap exceeded."
                    },
                    "403": {
                        "description": "Plan does not include HowSyn. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`)."
                    },
                    "404": {
                        "description": "task_id / route_index did not resolve to an accessible route."
                    },
                    "502": {
                        "description": "A step failed. `code` is `MOSAIC_UNREACHABLE` when the prediction service could not be reached (safe to retry), otherwise `MOSAIC_FAILED`. `step` names the failing step. The body carries no upstream detail."
                    },
                    "503": {
                        "description": "HowSyn backend not available."
                    },
                    "504": {
                        "description": "A step did not finish within the server time limit (`code`: `MOSAIC_TIMEOUT`, `step` names it). Retry; predictions already cached are reused."
                    }
                }
            }
        },
        "/outcomes": {
            "post": {
                "x-key-scope": "write",
                "operationId": "logOutcome",
                "summary": "Contribute reaction outcomes (data flywheel)",
                "description": "Contribute one or more reaction OUTCOMES (ran / partial / failed / not-attempted, with yield, failure mode, and conditions used) back into the SynovAI data flywheel. Free \u2014 an outcome is a contribution, not a billable prediction. Provide a structured `outcomes` array, OR a parsed `.eln` RO-Crate via `eln_crate` (eLabFTW, RSpace, Kadi4Mat, \u2026), OR a parsed Chemotion `export.json` via `chemotion_export`. Rows de-dup on external_id, so re-sending updates rather than duplicates. Requires any plan that can run routes (the basic_retro feature); the API key owner is recorded as the contributor and per-record task access is enforced.\n\n\ud83d\udd34 ELN ingest is a licensable capability and MAY BE EXCLUDED by your agreement (\u00a72.2). When it is, this endpoint refuses with `error: \"capability_not_licensed\"` and the prose in `message`.",
                "security": [
                    {
                        "BearerAuth": []
                    },
                    {
                        "ApiKeyAuth": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "outcomes": {
                                        "type": "array",
                                        "maxItems": 500,
                                        "description": "Structured outcomes.",
                                        "items": {
                                            "type": "object",
                                            "required": ["task_id", "route_index", "status"],
                                            "properties": {
                                                "task_id": {
                                                    "type": "string",
                                                    "description": "The SynovAI task (job) the route belongs to."
                                                },
                                                "route_index": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "description": "\ud83d\udd34 0-BASED here, and deliberately so: this is the round-trip key SynovAI itself wrote into the ELN export as `synovai:routeIndex`, so echo back the number you received rather than a number you read from another endpoint. Every OTHER route number in this API is 1-based."
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": ["RAN_SUCCESS", "RAN_PARTIAL", "FAILED", "NOT_ATTEMPTED"]
                                                },
                                                "failure_mode": {
                                                    "type": "string",
                                                    "enum": [
                                                        "NONE",
                                                        "NO_REACTION",
                                                        "LOW_YIELD",
                                                        "PURIFICATION_FAILED",
                                                        "SIDE_REACTION",
                                                        "OTHER"
                                                    ]
                                                },
                                                "yield_pct": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 100,
                                                    "description": "Isolated yield %."
                                                },
                                                "failed_at_step": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "description": "Step index where the route broke, when known."
                                                },
                                                "conditions": {
                                                    "type": "object",
                                                    "description": "Conditions actually used (reagents, solvent, temperature, time)."
                                                },
                                                "trajectory": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object"
                                                    },
                                                    "description": "Optional optimization trajectory (ordered attempts)."
                                                },
                                                "note": {
                                                    "type": "string",
                                                    "maxLength": 8000
                                                },
                                                "external_id": {
                                                    "type": "string",
                                                    "maxLength": 400,
                                                    "description": "Stable id from your system for de-dup; defaults to task_id:route_index."
                                                }
                                            }
                                        }
                                    },
                                    "eln_crate": {
                                        "type": "object",
                                        "description": "A parsed ro-crate-metadata.json from a `.eln` file. Entities carrying synovai:taskId + synovai:routeIndex are ingested; others are reported as skipped."
                                    },
                                    "chemotion_export": {
                                        "type": "object",
                                        "description": "A parsed export.json from a Chemotion collection export (Chemotion uses its own format, not RO-Crate `.eln`). Reactions referencing synovai:taskId + synovai:routeIndex are ingested; others are reported as unmatched."
                                    },
                                    "source_label": {
                                        "type": "string",
                                        "maxLength": 120,
                                        "description": "Label for the origin system (e.g. \"elabftw\", \"chemotion\") used as the de-dup source key."
                                    }
                                }
                            },
                            "example": {
                                "source_label": "elabftw",
                                "outcomes": [
                                    {
                                        "task_id": "cm9x1abcd0001xyz",
                                        "route_index": 0,
                                        "status": "FAILED",
                                        "failure_mode": "PURIFICATION_FAILED",
                                        "yield_pct": 0,
                                        "failed_at_step": 2,
                                        "note": "Product formed but could not isolate.",
                                        "external_id": "eln-exp-4471"
                                    }
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Ingest summary. `recorded` = rows written/updated; `skipped` = ELN/Chemotion entities without a SynovAI route reference; `errors` = per-record failures (e.g. no task access).",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "recorded": 1,
                                    "skipped": [],
                                    "errors": []
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation failed (no body shape provided, or an invalid outcome).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "\ud83d\udd34 ELN ingest is a licensable capability and MAY BE EXCLUDED by your agreement (\u00a72.2). When it is, this endpoint refuses with `error: \"capability_not_licensed\"` and the prose in `message`. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CodedErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/jobs": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listJobs",
                "summary": "List jobs",
                "description": "Jobs this key may read, newest first. Metadata only (ids, status, timestamps, batch id): never a route or a result. Same access as `GET /jobs/{jobId}`: the key owner's own jobs, so every key of one owner sees the same list and another user's key sees none of them; a class chatbot key sees only the jobs it submitted for its class. `status` uses this endpoint's vocabulary (`running` `success` `error`).",
                "parameters": [
                    {
                        "in": "query",
                        "name": "batch_id",
                        "description": "Only the child jobs of this batch.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "status",
                        "schema": {
                            "type": "string",
                            "enum": ["running", "success", "error"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "in": "query",
                        "name": "cursor",
                        "description": "`next_cursor` from the previous page.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of jobs",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["status", "data"],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["ok"]
                                        },
                                        "data": {
                                            "type": "object",
                                            "required": ["jobs", "next_cursor"],
                                            "properties": {
                                                "jobs": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "required": ["job_id", "status", "created_at", "updated_at"],
                                                        "properties": {
                                                            "job_id": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": ["running", "success", "error"]
                                                            },
                                                            "batch_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "created_at": {
                                                                "type": "string",
                                                                "format": "date-time"
                                                            },
                                                            "updated_at": {
                                                                "type": "string",
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                },
                                                "next_cursor": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid query parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/jobs/{jobId}": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getJobStatus",
                "summary": "Get job status and results",
                "description": "Poll this endpoint to check job progress. Returns status 'running' while in progress, 'success' with results when complete, or 'error' if the job failed. A class chatbot key can read only the jobs it submitted for its class. Any other job id answers 404 `Job not found`. While a class run is `running`, the response also carries `queue_position` (1 = next to start; null once it has started) and `view_url` (where the student opens the result). Poll at a steady interval (every 15-30 seconds suits a single run; SuperSampling sweeps take longer), stop at `success` or `error`, and remember that every poll counts toward the key's per-minute rate limit. `error` covers every unsuccessful end (failed, canceled, rejected, no routes); the reason is in `error`.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "description": "The job ID returned from POST /execute",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Job status (running or success)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/JobRunningResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/JobSuccessResponse"
                                        },
                                        {
                                            "$ref": "#/components/schemas/JobErrorResponse"
                                        }
                                    ],
                                    "discriminator": {
                                        "propertyName": "status"
                                    }
                                },
                                "examples": {
                                    "running": {
                                        "summary": "Job still running",
                                        "value": {
                                            "status": "running",
                                            "job_id": "cm9abc123def456",
                                            "created_at": "2026-04-07T12:00:00.000Z"
                                        }
                                    },
                                    "success": {
                                        "summary": "Job completed",
                                        "value": {
                                            "status": "success",
                                            "job_id": "cm9abc123def456",
                                            "schema_version": "1.0",
                                            "result": {
                                                "path_dicts": [
                                                    {
                                                        "smiles": "CC(=O)OCC",
                                                        "route_scores": {
                                                            "average_confidence": 6.4,
                                                            "average_scalability": 7.1,
                                                            "no_reference_count": 0
                                                        },
                                                        "reference_metadata": {
                                                            "internal_reference_index": [12345],
                                                            "rxn_type": "Fischer esterification",
                                                            "est_yield": 88,
                                                            "std_yield": 4.2,
                                                            "confidenceestimate": 6.4,
                                                            "top_reagent": ["OS(=O)(=O)O"],
                                                            "top_solvent": ["CCO"]
                                                        },
                                                        "children": [
                                                            {
                                                                "smiles": "CC(=O)O"
                                                            },
                                                            {
                                                                "smiles": "CCO"
                                                            }
                                                        ]
                                                    }
                                                ]
                                            },
                                            "cost_usd": 5,
                                            "created_at": "2026-04-07T12:00:00.000Z",
                                            "completed_at": "2026-04-07T12:01:30.000Z"
                                        }
                                    },
                                    "error": {
                                        "summary": "Job failed",
                                        "value": {
                                            "status": "error",
                                            "job_id": "cm9abc123def456",
                                            "error": "Job failed",
                                            "created_at": "2026-04-07T12:00:00.000Z"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Job not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                },
                                "example": {
                                    "status": "error",
                                    "error": "Job not found"
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#/components/responses/ClassKeyForbidden"
                    }
                }
            },
            "patch": {
                "x-key-scope": "write",
                "operationId": "moveJob",
                "summary": "Move a job to another project, folder or pipeline stage",
                "description": "By exactly the rules the app uses, with the key owner as the actor. See \"Pipeline stages and moving a run\" above. A stage that needs approval answers 202 and does NOT move the job yet: it opens a decision for the project owner, recording the target stage, and returns it. Approving the decision moves the job (re-checked at approval time); rejecting or withdrawing it does not. The project owner moves straight in (200). Everything is checked before the first write, so a refused request changes nothing.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "minProperties": 1,
                                "additionalProperties": false,
                                "properties": {
                                    "project_id": {
                                        "type": "string",
                                        "description": "Another project of the same organization. Cannot be combined with `stage_id`."
                                    },
                                    "folder_id": {
                                        "type": "string",
                                        "nullable": true,
                                        "description": "A folder of the (new) project you can open; null for Unsorted."
                                    },
                                    "stage_id": {
                                        "type": "string",
                                        "nullable": true,
                                        "description": "A live stage of the job's project; null clears it."
                                    }
                                }
                            },
                            "example": {
                                "stage_id": "cm_stage_1"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done. `{ status: \"ok\", data: { job_id, project_id, folder_id, stage_id } }`, where the job is now.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["ok"]
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "job_id": {
                                                    "type": "string"
                                                },
                                                "project_id": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "folder_id": {
                                                    "type": "string",
                                                    "nullable": true
                                                },
                                                "stage_id": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "The stage needs approval. The job has NOT moved yet. `{ status: \"pending_approval\", message, data: { job_id, project_id, folder_id, stage_id, requested_stage_id, decision_id, decision: { id, status, target_stage_id, requested_by_user_id, approver_user_ids } } }`; `stage_id` is still the current one. The decision records `target_stage_id`; when its approver approves it, the job moves there. Asking again while it is open returns the same decision (and the same 202).",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "pending_approval",
                                    "message": "This stage needs approval, so the job has not moved yet. A decision is open for the project owner; approving it moves the job into the stage, and rejecting or withdrawing it leaves the job where it is.",
                                    "data": {
                                        "job_id": "cm_job",
                                        "project_id": "cm_project",
                                        "folder_id": null,
                                        "stage_id": null,
                                        "requested_stage_id": "cm_stage_2",
                                        "decision_id": "cm_decision",
                                        "decision": {
                                            "id": "cm_decision",
                                            "status": "open",
                                            "target_stage_id": "cm_stage_2",
                                            "requested_by_user_id": "cm_requester",
                                            "approver_user_ids": ["cm_project_owner"]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request` (a bad body, an unknown field, `project_id` with `stage_id`, or a stage needing approval sent with other fields), or `project_not_applicable` from a stateless key or for a stateless job."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "`forbidden`: you can see the job but may not do this to it (for example, moving another person's run when you are not a project admin). A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`)."
                    },
                    "404": {
                        "description": "`job_not_found`, `project_not_found`, `folder_not_found` or `stage_not_found`. Not-found and no access are the same answer."
                    },
                    "409": {
                        "description": "`move_refused` (locked by a project admin, another organization, back to Unsorted, a class run), `stage_archived`, or `job_not_filed`."
                    }
                }
            }
        },
        "/jobs/{jobId}/references": {
            "get": {
                "x-key-scope": "write",
                "operationId": "getJobReferences",
                "summary": "Get literature references for a completed job",
                "description": "Walks the result tree, collects every internal_reference_index from each non-leaf node, and returns the corresponding patents / experimental procedures / yields grouped by route \u2192 step. Use ?route=N to narrow to a single route. Part of the route-metrics bundle: charged once per canonical molecule, per API key, per billing period, shared with /jobs/{jobId}/analysis, /jobs/{jobId}/references, /jobs/{jobId}/convergence and /patents/check \u2014 whichever is called first for that molecule pays, the rest are free. For a job endpoint the molecule is the job's target (after desalting), not the job id.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The completed job ID."
                    },
                    {
                        "name": "route",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "1-based route index. Omit for all routes."
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "Reference catalog",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "routes": [
                                            {
                                                "route_index": 1,
                                                "steps": [
                                                    {
                                                        "step_index": 1,
                                                        "product_smiles": "CCO",
                                                        "reactant_smiles": ["CC=O"],
                                                        "reaction_type": "Hydrogenation",
                                                        "references": [
                                                            {
                                                                "index": 12345,
                                                                "reaction": "[CH3:1][CHO:2]>>[CH3:1][CH2:2][OH]",
                                                                "reaction_name": "Aldehyde reduction",
                                                                "yield": [88],
                                                                "reference": "WO2019/123456",
                                                                "paragraph_text": "To a solution of \u2026"
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/ReferencesResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Job not found"
                    },
                    "409": {
                        "description": "Job not yet complete"
                    },
                    "502": {
                        "description": "Reference service unavailable"
                    }
                }
            }
        },
        "/jobs/{jobId}/convergence": {
            "get": {
                "x-key-scope": "write",
                "operationId": "getJobConvergence",
                "summary": "Convergence analysis around a focal molecule",
                "description": "For a completed job, returns precursors (what makes the focal SMILES), products (what it makes), and partners (co-occurring at the same step) across every route. Useful for surfacing 'N of M routes use this intermediate'. Part of the route-metrics bundle: charged once per canonical molecule, per API key, per billing period, shared with /jobs/{jobId}/analysis, /jobs/{jobId}/references, /jobs/{jobId}/convergence and /patents/check \u2014 whichever is called first for that molecule pays, the rest are free. For a job endpoint the molecule is the job's target (after desalting), not the job id.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "smiles",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Focal molecule SMILES."
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "Convergence analysis",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "focal_smiles": "OCC(=O)c1ccccc1",
                                        "total_routes": 32,
                                        "routes_containing": 31,
                                        "precursors": [
                                            {
                                                "smiles": "BrCC(=O)c1ccccc1",
                                                "reactions": [
                                                    {
                                                        "reactionType": "Williamson ether synthesis",
                                                        "routeIndices": [1, 4, 17],
                                                        "partnerSmiles": ["[OH-]"]
                                                    }
                                                ]
                                            }
                                        ],
                                        "products": [
                                            {
                                                "smiles": "O=C(COC(=O)c1ccccc1)c1ccccc1",
                                                "reactions": [
                                                    {
                                                        "reactionType": "Esterification",
                                                        "routeIndices": [1, 4],
                                                        "partnerSmiles": ["OC(=O)c1ccccc1"]
                                                    }
                                                ]
                                            }
                                        ],
                                        "partners": [
                                            {
                                                "smiles": "OC(=O)c1ccccc1",
                                                "coOccurrenceCount": 2,
                                                "routeIndices": [1, 4]
                                            }
                                        ]
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/ConvergenceResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "smiles query param missing"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Job not found"
                    },
                    "409": {
                        "description": "Job not yet complete"
                    }
                }
            }
        },
        "/jobs/{jobId}/scored": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getJobScoredRoutes",
                "summary": "Rank routes under a scoring profile",
                "description": "Re-ranks a completed job's routes using the requested scoring profile. Built-in profile ids: discovery, medicinal, process, computational, materials, green, educational. Omit `profile` to use platform defaults. Returns each route with its composite feasibility score (0-10), per-dimension scores, confidence, and rationale.\n\nFiltering is free \u2014 a filter is a view of a result you already paid for. Excluded routes are RETURNED in `excluded` with their reasons rather than silently dropped, and `originalRouteIndex` survives filtering so ?route=N still means the same route.\n\n**Saved view.** With `view_id`, the response also carries `view_id`, `view_profile` and `unsupported_filters` (`{filter, reason, source}`; empty means every requested filter ran). Without `view_id`, `unsupported_filters` is an empty list.\n\n**Hazards are sourced.** `dimensions[].details` and `dimensions[].rationale` carry the metric argument only. They previously also carried SynovAI's own hazard judgement (\"3 hazardous reagents\", \"Multiple hazardous reagents flagged \u2014 process safety officer will want to see DSC/SADT data before scale-up.\", \"This route should survive an EHS review.\"); that wording is in-app only as of 2026-11-19 and no longer appears in any response. Hazard information now lives under `ranked[].hazards`: `ghs` is GHS as PubChem reports it with the source named (the same summariser `/analysis` uses), and `sds` is the supplier's own safety data sheet per material in three states \u2014 `found`, `none-published` (we loaded a supplier's product page and it publishes no sheet for that product) and `not-looked-up` with a `reason`. No state means a material is safe: a compound with no GHS record and no SDS is a compound nobody has looked up. `?ghs=0` skips the GHS lookup; `?sds=1` opts into the supplier SDS pass, which is off by default because it costs a vendor lookup plus a supplier page load per material, and without it every material reports `not-looked-up: not-attempted`.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "jobId",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "discovery",
                                "medicinal",
                                "process",
                                "computational",
                                "materials",
                                "green",
                                "educational"
                            ]
                        },
                        "description": "Built-in scoring profile id."
                    },
                    {
                        "name": "view_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "A saved view you can read (yours, or shared with a project you belong to; anything else is 404). Applies the view's filters and, when no `profile` is given, its profile, using the same code as `/v2/batch/{job_id}/ranked`. Filters of the view the server cannot apply are listed in `unsupported_filters` and were NOT applied. Combine with `exclude_reaction_type`, `max_hazard`, `exclude_smiles`."
                    },
                    {
                        "name": "exclude_reaction_type",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true,
                        "description": "Drop routes using these chemistries. Repeatable. Case-insensitive substring match, because the model's reaction-class strings are not a closed vocabulary."
                    },
                    {
                        "name": "max_hazard",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        },
                        "description": "Drop routes carrying a hazard flag at this severity or worse. 'warning' is the stricter setting and excludes dangers too."
                    },
                    {
                        "name": "exclude_smiles",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true,
                        "description": "Drop routes whose SMILES text contains one of these. NOTE: a substring match over SMILES text, NOT a chemical substructure search \u2014 'c1ccccc1' finds benzene written that way and misses 'C1=CC=CC=C1', the same ring. Canonicalise with /validate-smiles first if that matters."
                    },
                    {
                        "name": "ghs",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["0"]
                        },
                        "description": "Set to `0` to skip the sourced GHS lookup. `ranked[].hazards.ghs` is then null and `ghs_status` is `skipped-by-request`."
                    },
                    {
                        "name": "sds",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["1"]
                        },
                        "description": "Set to `1` to resolve supplier SDS links for this job's materials. Off by default: it costs a vendor lookup plus a supplier page load per material. Without it every material reports `not-looked-up` with reason `not-attempted` \u2014 never `none-published`, which is a claim about a supplier's page that we did not load."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Ranked routes with score breakdown",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "profile": {
                                            "id": "process",
                                            "name": "Process"
                                        },
                                        "total_routes": 32,
                                        "ranked": [
                                            {
                                                "originalRouteIndex": 7,
                                                "composite": 8.4,
                                                "compositeLabel": "good",
                                                "weakest_step": {
                                                    "confidence": 6.2,
                                                    "step_number": 3
                                                },
                                                "dimensions": [
                                                    {
                                                        "id": "route-confidence",
                                                        "name": "Route Confidence",
                                                        "score": 8.5,
                                                        "confidence": "high",
                                                        "details": "3 steps, all literature-precedented",
                                                        "rationale": null
                                                    },
                                                    {
                                                        "id": "process-viability",
                                                        "name": "Process Greenness",
                                                        "score": 6.2,
                                                        "confidence": "moderate",
                                                        "details": "EcoScale 55/100, solvents: amber",
                                                        "rationale": "Process greenness is mid-pack. Likely fixable via solvent or reagent swaps before kilo-scale."
                                                    }
                                                ],
                                                "hazards": {
                                                    "ghs": {
                                                        "coverage": {
                                                            "with_record": 2,
                                                            "not_looked_up": 3
                                                        },
                                                        "source": {
                                                            "name": "PubChem",
                                                            "url": "https://pubchem.ncbi.nlm.nih.gov/"
                                                        }
                                                    },
                                                    "ghs_status": "looked-up",
                                                    "sds": [
                                                        {
                                                            "smiles": "ClCCl",
                                                            "status": "found",
                                                            "url": "https://www.example-supplier.com/sds/12345.pdf",
                                                            "supplier": "Example Chemical Co.",
                                                            "reason": null,
                                                            "suppliersChecked": 3
                                                        },
                                                        {
                                                            "smiles": "CCO",
                                                            "status": "not-looked-up",
                                                            "url": null,
                                                            "supplier": null,
                                                            "reason": "not-attempted",
                                                            "suppliersChecked": 0
                                                        }
                                                    ],
                                                    "note": "Hazard information here is sourced: GHS as PubChem reports it, and the supplier\u2019s own safety data sheet. SynovAI does not publish its own hazard assessment, and the absence of a sourced record is not a finding that a material is safe."
                                                }
                                            }
                                        ]
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/ScoredResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Unknown profile id"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Job not found"
                    },
                    "409": {
                        "description": "Job not yet complete"
                    }
                }
            }
        },
        "/views": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listViews",
                "summary": "List your saved views",
                "description": "The saved views you could see in the app: your own, plus those shared with a project you own or belong to. Nothing else is enumerable. Free; recorded at zero price.",
                "responses": {
                    "200": {
                        "description": "Views",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "views": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "filters": {
                                                        "type": "object",
                                                        "description": "The app's saved-view filters, in the app's own camelCase shape: sortBy, activeProfile (a built-in profile id or a custom profile id), includedReactionTypes, excludedReactionTypes, reactionMatchMode, excludedHazardCategories, showFavoritesOnly, excludedSubstructure, patentRiskCeiling, patentRiskHideUnknown, overviewMode, favoritedIndices. Unknown keys are kept.",
                                                        "additionalProperties": true
                                                    },
                                                    "shared_with_project": {
                                                        "type": "string",
                                                        "nullable": true,
                                                        "description": "Set when the view is shared with a project; every member of that project can read it."
                                                    },
                                                    "shared_project_name": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "owned_by_you": {
                                                        "type": "boolean"
                                                    },
                                                    "author": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "name": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    },
                                                    "created_at": {
                                                        "type": "string",
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": "string",
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "createView",
                "summary": "Save a view",
                "description": "Saves a named filter preset, optionally shared with a project you own or belong to (`shared_with_project`; a project you cannot see is 404). Same validation and service as the app. Filters the server cannot apply (substructure, hazard categories, include-lists, patent ceiling, favorites-only) are saved as given and reported in `unsupported_filters` wherever the view is applied (`/v2/batch/{job_id}/ranked`, `/jobs/{jobId}/scored`): they are never applied silently and never dropped silently. A stateless key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name", "filters"],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "filters": {
                                        "type": "object",
                                        "additionalProperties": true,
                                        "description": "Same shape as `filters` on a view."
                                    },
                                    "shared_with_project": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "filters": {
                                            "type": "object",
                                            "description": "The app's saved-view filters, in the app's own camelCase shape: sortBy, activeProfile (a built-in profile id or a custom profile id), includedReactionTypes, excludedReactionTypes, reactionMatchMode, excludedHazardCategories, showFavoritesOnly, excludedSubstructure, patentRiskCeiling, patentRiskHideUnknown, overviewMode, favoritedIndices. Unknown keys are kept.",
                                            "additionalProperties": true
                                        },
                                        "shared_with_project": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "Set when the view is shared with a project; every member of that project can read it."
                                        },
                                        "shared_project_name": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "owned_by_you": {
                                            "type": "boolean"
                                        },
                                        "author": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        },
                                        "created_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "updated_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body, or a stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Project not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/views/{viewId}": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getView",
                "summary": "Read a saved view",
                "description": "A view you own, or one shared with a project you belong to. Anything else is 404, the same as a view that does not exist.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "viewId",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The view",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "filters": {
                                            "type": "object",
                                            "description": "The app's saved-view filters, in the app's own camelCase shape: sortBy, activeProfile (a built-in profile id or a custom profile id), includedReactionTypes, excludedReactionTypes, reactionMatchMode, excludedHazardCategories, showFavoritesOnly, excludedSubstructure, patentRiskCeiling, patentRiskHideUnknown, overviewMode, favoritedIndices. Unknown keys are kept.",
                                            "additionalProperties": true
                                        },
                                        "shared_with_project": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "Set when the view is shared with a project; every member of that project can read it."
                                        },
                                        "shared_project_name": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "owned_by_you": {
                                            "type": "boolean"
                                        },
                                        "author": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        },
                                        "created_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "updated_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "x-key-scope": "write",
                "operationId": "updateView",
                "summary": "Edit a saved view",
                "description": "Rename it, replace its filters, or change its sharing (`shared_with_project: null` makes it personal). Only the author can: a view shared with you is read-only (403), as in the app. A stateless key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "viewId",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "filters": {
                                        "type": "object",
                                        "additionalProperties": true,
                                        "description": "Same shape as `filters` on a view."
                                    },
                                    "shared_with_project": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The updated view",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "filters": {
                                            "type": "object",
                                            "description": "The app's saved-view filters, in the app's own camelCase shape: sortBy, activeProfile (a built-in profile id or a custom profile id), includedReactionTypes, excludedReactionTypes, reactionMatchMode, excludedHazardCategories, showFavoritesOnly, excludedSubstructure, patentRiskCeiling, patentRiskHideUnknown, overviewMode, favoritedIndices. Unknown keys are kept.",
                                            "additionalProperties": true
                                        },
                                        "shared_with_project": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "Set when the view is shared with a project; every member of that project can read it."
                                        },
                                        "shared_project_name": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "owned_by_you": {
                                            "type": "boolean"
                                        },
                                        "author": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "nullable": true
                                                }
                                            }
                                        },
                                        "created_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "updated_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body, or a stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Shared with you read-only. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "x-key-scope": "write",
                "operationId": "deleteView",
                "summary": "Delete a saved view",
                "description": "Author only: 403 for a view shared with you, 404 for one you cannot see. A stateless key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "viewId",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "400": {
                        "description": "A stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Shared with you read-only. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/batch-templates": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listBatchTemplates",
                "summary": "List your batch templates",
                "description": "Your templates, plus those shared with a project you own or belong to. Nothing else is enumerable. Free; recorded at zero price.",
                "responses": {
                    "200": {
                        "description": "Templates",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "templates": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/BatchTemplate"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "createBatchTemplate",
                "summary": "Save a batch template",
                "description": "Saves a named submit config plus lens that `POST /api/v2/batch` applies with `template_id`. The config is validated at save by the rules create applies (callback URL, spend cap, project and folder, workflow, and the lens through the same resolver as `/ranked`), so a template cannot hold something create would refuse; a stage_id or targets are refused. Optionally shared read-only with a project you own or belong to (`shared_with_project`; a project you cannot see is 404). A stateless API key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name", "config"],
                                "additionalProperties": false,
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "config": {
                                        "$ref": "#/components/schemas/BatchTemplateConfig"
                                    },
                                    "shared_with_project": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                }
                            },
                            "example": {
                                "name": "Weekly design screen",
                                "config": {
                                    "input": {
                                        "num_steps": 4,
                                        "temperature": "Standard"
                                    },
                                    "spend_cap_cents": 50000,
                                    "lens": {
                                        "profile": "balanced",
                                        "rank_by": "composite"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchTemplate"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or config, or a stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "The project is not one you can use",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/batch-templates/{templateId}": {
            "parameters": [
                {
                    "in": "path",
                    "name": "templateId",
                    "required": true,
                    "schema": {
                        "type": "string"
                    }
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "getBatchTemplate",
                "summary": "Read a batch template",
                "description": "A template you own, or one shared with a project you belong to. Anything else is 404. On one shared with you the author's `callback_url` is not shown.",
                "responses": {
                    "200": {
                        "description": "Template",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchTemplate"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found, or not visible to you",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "x-key-scope": "write",
                "operationId": "updateBatchTemplate",
                "summary": "Change a batch template",
                "description": "Any of `name`, `config` (replaces the whole config and is validated again) and `shared_with_project` (`null` makes it personal). Author only: 403 for one shared with you. A stateless API key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "config": {
                                        "$ref": "#/components/schemas/BatchTemplateConfig"
                                    },
                                    "shared_with_project": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchTemplate"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request or config, or a stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Shared with you read-only. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found, or not visible to you",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "x-key-scope": "write",
                "operationId": "deleteBatchTemplate",
                "summary": "Delete a batch template",
                "description": "Author only: 403 for one shared with you, 404 for one you cannot see. Batches already made from it are unchanged. A stateless API key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "responses": {
                    "204": {
                        "description": "Deleted"
                    },
                    "400": {
                        "description": "A stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Shared with you read-only. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found, or not visible to you",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/catalogs": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listCatalogs",
                "summary": "List your catalogs",
                "description": "Your own catalogs (stockrooms): personal ones, and those of teams you belong to. Pass an `id` as `catalog_id` on `POST /execute` (in `params`) or `POST /api/v2/batch` (in `input`) to filter or highlight routes by what you hold. Ids, names and counts only, never the contents. Free; recorded at zero price.",
                "responses": {
                    "200": {
                        "description": "Catalogs",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "catalogs": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": { "type": "string" },
                                                    "name": { "type": "string" },
                                                    "compound_count": { "type": "integer" },
                                                    "scope": { "type": "string", "enum": ["personal", "team"] },
                                                    "team": {
                                                        "type": "object",
                                                        "nullable": true,
                                                        "properties": {
                                                            "id": { "type": "string" },
                                                            "name": { "type": "string" }
                                                        }
                                                    },
                                                    "created_at": { "type": "string", "format": "date-time" }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/scoring-profiles": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listScoringProfiles",
                "summary": "List scoring profiles",
                "description": "The seven built-in profiles plus your own custom profiles. Use a built-in `id` as `profile=` and a custom `id` as `custom_profile_id=` on `/v2/batch/{job_id}/ranked`. Weights are listed for all nine dimensions; custom profiles carry the six the app lets you set, and the other three are 0. Free; recorded at zero price.",
                "responses": {
                    "200": {
                        "description": "Profiles",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "profiles": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "kind": {
                                                        "type": "string",
                                                        "enum": ["builtin", "custom"]
                                                    },
                                                    "description": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "weights": {
                                                        "type": "object",
                                                        "additionalProperties": {
                                                            "type": "number"
                                                        }
                                                    },
                                                    "filters": {
                                                        "type": "object",
                                                        "nullable": true,
                                                        "additionalProperties": true,
                                                        "description": "Bundled filter preferences of a custom profile."
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "createScoringProfile",
                "summary": "Create a custom scoring profile",
                "description": "Saves a custom profile your account's profile picker also shows. Six weights, each 0 to 1 (as in the app), and optional bundled `filters`. 409 if you already have a profile with that name. Built-in profiles cannot be edited. A stateless key is refused every write with 400 and code `stateless_write_refused`; reading still works.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "name",
                                    "route_confidence",
                                    "scalability",
                                    "material_accessibility",
                                    "route_efficiency",
                                    "process_viability",
                                    "harness_confidence"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 50
                                    },
                                    "route_confidence": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "scalability": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "material_accessibility": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "route_efficiency": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "process_viability": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "harness_confidence": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                    },
                                    "filters": {
                                        "type": "object",
                                        "nullable": true,
                                        "additionalProperties": true
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "201": {
                        "description": "Created"
                    },
                    "400": {
                        "description": "Invalid body, or a stateless key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked key",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Name already used",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/jobs/{jobId}/embed": {
            "post": {
                "x-key-scope": "read",
                "operationId": "createJobEmbedUrl",
                "summary": "Mint a signed, expiring embed URL for a job",
                "description": "Returns a URL that renders this job's route tree inside an iframe in your own application, with no second login and without making the job publicly readable. The URL carries a task-scoped, HS256-signed token that expires; it authorises exactly this job and nothing else. The job's visibility is never changed.\n\nYour SynovAI-facing origin must be on the server-side frame-ancestors allow-list before the page will render inside your app \u2014 ask SynovAI to add it.\n\nJobs submitted with a stateless API key cannot be embedded: no route tree is retained server-side.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "jobId",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "expires_in_seconds": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 86400,
                                        "default": 3600,
                                        "description": "Token lifetime in seconds. Defaults to 3600 (1 hour); 86400 (24 hours) is the hard maximum."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Embed URL minted",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "embed_url": "https://platform.synovai.net/embed/tasks/cm9abc123?t=eyJhbGciOiJIUzI1NiJ9...",
                                    "expires_at": "2026-08-28T18:30:00.000Z"
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["ok"]
                                        },
                                        "embed_url": {
                                            "type": "string",
                                            "format": "uri",
                                            "description": "Absolute URL carrying a task-scoped signed token in the query string. The token IS the authorisation \u2014 treat the whole URL as a credential and do not log it."
                                        },
                                        "expires_at": {
                                            "type": "string",
                                            "format": "date-time",
                                            "description": "After this the URL stops working; mint a new one."
                                        }
                                    },
                                    "required": ["status", "embed_url", "expires_at"],
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body, or expires_in_seconds outside 1..86400"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Job not found, or this API key has no access to it"
                    },
                    "409": {
                        "description": "Job was submitted with a stateless key and retains no route tree"
                    },
                    "501": {
                        "description": "\ud83d\udd34 Embedding is not enabled on this deployment (no signing secret configured). NOT TRANSIENT \u2014 do not retry; the same call will answer 501 until it is enabled for your account. Ask SynovAI support to turn it on. This answered 500 through spec 1.8.0, which reads as a transient server fault and sent clients into an indefinite retry loop.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CodedErrorResponse"
                                },
                                "example": {
                                    "status": "error",
                                    "error": "embed_not_configured",
                                    "message": "Embed URLs are not enabled on this deployment (no signing secret is configured). This is not transient \u2014 retrying will not help. Contact SynovAI support to have embedding enabled for your account."
                                }
                            }
                        }
                    }
                }
            }
        },
        "/library-convergence": {
            "post": {
                "x-key-scope": "read",
                "operationId": "libraryConvergence",
                "summary": "Find shared intermediates across many jobs",
                "description": "Given a list of completed job ids, walks each result tree and surfaces intermediates that recur most across the library. Useful for batch / library-synthesis workflows where the question is 'which common precursor would let me reach all of these targets in fewer steps'. The same chemistry function backs the in-app library convergence view.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["job_ids"],
                                "properties": {
                                    "job_ids": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 100,
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "min_molecule_fraction": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1,
                                        "description": "Minimum fraction of library molecules an intermediate must appear in to be included. Default 0.1."
                                    }
                                }
                            },
                            "example": {
                                "job_ids": ["cm9abc123", "cm9def456", "cm9ghi789"],
                                "min_molecule_fraction": 0.1
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Library convergence result",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "molecule_count": 3,
                                        "total_routes": 28,
                                        "intermediates": [
                                            {
                                                "smiles": "Oc1ccc(Br)cc1",
                                                "molecule_count": 3,
                                                "molecule_fraction": 1,
                                                "route_count": 14,
                                                "avg_depth": 2.1,
                                                "entries": [
                                                    {
                                                        "target_smiles": "CC(=O)Oc1ccc(C(=O)O)cc1",
                                                        "task_id": "cm9abc123",
                                                        "route_count": 5,
                                                        "route_fraction": 0.5
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "One or more jobs not found or not owned by the calling key"
                    },
                    "409": {
                        "description": "One or more jobs not yet complete"
                    }
                }
            }
        },
        "/validate-smiles": {
            "post": {
                "x-key-scope": "read",
                "operationId": "validateSmiles",
                "summary": "Canonicalize and validate a SMILES string",
                "description": "Wraps the same RDKit-backed validator used by the in-app submission form. Returns the canonical form so integrators can replace ad-hoc PubChem lookups with us.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["smiles"],
                                "properties": {
                                    "smiles": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 2048
                                    }
                                }
                            },
                            "example": {
                                "smiles": "CCO"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Validation result",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "input": "CCO",
                                        "valid": true,
                                        "canonical_smiles": "CCO",
                                        "message": ""
                                    }
                                },
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["ok"]
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "input": {
                                                    "type": "string",
                                                    "description": "Echoes the SMILES you sent, verbatim."
                                                },
                                                "valid": {
                                                    "type": "boolean"
                                                },
                                                "canonical_smiles": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "RDKit canonical form, or NULL when `valid` is false. Always present as a key \u2014 through spec 1.8.0 it could be omitted from the body entirely on the invalid path, which read to a generated client as a missing field rather than as \"no canonical form\"."
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "description": "Empty string when valid; the reason when not. Not a status word \u2014 branch on `valid`, not on this."
                                                }
                                            },
                                            "required": ["input", "valid", "canonical_smiles", "message"],
                                            "additionalProperties": true
                                        }
                                    },
                                    "required": ["status", "data"],
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing or invalid smiles input"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/usage": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getUsage",
                "summary": "Aggregate API usage and per-end-user spend",
                "description": "Returns total queries + cost plus a per-end-user breakdown for the calling key's owner. Used by API customers (e.g. resellers) to re-bill their own sub-tenants. Tag submissions with X-End-User-Id (REST) or end_user_id (MCP / body) so the breakdown is non-empty.",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "description": "Inclusive lower bound. Defaults to start of current month UTC."
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        },
                        "description": "Exclusive upper bound. Defaults to now."
                    },
                    {
                        "name": "end_user_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Filter to a single sub-tenant."
                    },
                    {
                        "name": "include_detail",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["1"]
                        },
                        "description": "Set to 1 to include the last 100 raw records inline."
                    },
                    {
                        "name": "key_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Restrict the report to one of YOUR API keys, e.g. to separate a sandbox key from a production key. Use the key's id (the `api_key_id` on a usage record). It must be a key you own: any other value, including the id of someone else's key or one that does not exist, is answered 404. Omit it for the whole-account report (all your keys). When set, `launch_credits` and `launch_cohort` describe that key. Added in v1.12.0."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Usage report",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["status", "data"],
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": ["ok"]
                                        },
                                        "data": {
                                            "type": "object",
                                            "required": ["from", "to", "total", "by_end_user", "launch_cohort"],
                                            "properties": {
                                                "from": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "nullable": true
                                                },
                                                "to": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "nullable": true
                                                },
                                                "total": {
                                                    "type": "object",
                                                    "required": [
                                                        "queries",
                                                        "cost_cents",
                                                        "cost_usd",
                                                        "succeeded",
                                                        "failed",
                                                        "pending"
                                                    ],
                                                    "properties": {
                                                        "queries": {
                                                            "type": "integer"
                                                        },
                                                        "cost_cents": {
                                                            "type": "integer"
                                                        },
                                                        "cost_usd": {
                                                            "type": "number"
                                                        },
                                                        "succeeded": {
                                                            "type": "integer",
                                                            "description": "Runs that completed. Only succeeded runs are billed."
                                                        },
                                                        "failed": {
                                                            "type": "integer",
                                                            "description": "Runs that failed. A failed run is not charged."
                                                        },
                                                        "pending": {
                                                            "type": "integer",
                                                            "description": "Submitted runs not yet resolved either way. `succeeded + failed + pending` equals `queries`."
                                                        }
                                                    }
                                                },
                                                "by_end_user": {
                                                    "type": "array",
                                                    "description": "One row per `end_user_id` you tagged, highest spend first. Spend with no end user appears as a row whose `end_user_id` is null.",
                                                    "items": {
                                                        "type": "object",
                                                        "required": [
                                                            "end_user_id",
                                                            "queries",
                                                            "cost_cents",
                                                            "cost_usd",
                                                            "succeeded",
                                                            "failed",
                                                            "pending",
                                                            "launch_credits"
                                                        ],
                                                        "properties": {
                                                            "end_user_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "queries": {
                                                                "type": "integer"
                                                            },
                                                            "cost_cents": {
                                                                "type": "integer"
                                                            },
                                                            "cost_usd": {
                                                                "type": "number"
                                                            },
                                                            "succeeded": {
                                                                "type": "integer"
                                                            },
                                                            "failed": {
                                                                "type": "integer"
                                                            },
                                                            "pending": {
                                                                "type": "integer"
                                                            },
                                                            "launch_credits": {
                                                                "allOf": [
                                                                    {
                                                                        "$ref": "#/components/schemas/LaunchCredits"
                                                                    }
                                                                ],
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                },
                                                "launch_cohort": {
                                                    "type": "array",
                                                    "description": "Your end customers that have spent every launch credit, earliest first, at most five (agreement \u00a74.3).",
                                                    "items": {
                                                        "type": "object",
                                                        "required": ["end_user_id", "exhausted_at"],
                                                        "properties": {
                                                            "end_user_id": {
                                                                "type": "string"
                                                            },
                                                            "exhausted_at": {
                                                                "type": "string",
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                },
                                                "records": {
                                                    "type": "array",
                                                    "description": "The most recent 100 usage records, newest first. Present only when `include_detail=1`.",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "end_user_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "task_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "api_key_id": {
                                                                "type": "string",
                                                                "nullable": true,
                                                                "description": "The key that made the call; the value `key_id` filters on."
                                                            },
                                                            "endpoint": {
                                                                "type": "string"
                                                            },
                                                            "product": {
                                                                "type": "string",
                                                                "description": "What this record is for, e.g. `HowSyn` or `WhatSyn`. `queries` counts different units for different products, so read it with `unit`."
                                                            },
                                                            "unit": {
                                                                "type": "string",
                                                                "description": "What one of `queries` is: `uncached step` for HowSyn, `route run` for WhatSyn."
                                                            },
                                                            "queries": {
                                                                "type": "integer",
                                                                "description": "Billed units on this record, counted in `unit`. A cached HowSyn step is free and is not counted."
                                                            },
                                                            "unit_price_cents": {
                                                                "type": "integer"
                                                            },
                                                            "cost_cents": {
                                                                "type": "integer"
                                                            },
                                                            "recorded_at": {
                                                                "type": "string",
                                                                "format": "date-time"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "from": "2026-04-01T00:00:00.000Z",
                                        "to": null,
                                        "total": {
                                            "queries": 47,
                                            "cost_cents": 2350,
                                            "cost_usd": 23.5
                                        },
                                        "by_end_user": [
                                            {
                                                "end_user_id": "alice@pfizer.example",
                                                "queries": 32,
                                                "cost_cents": 1600,
                                                "cost_usd": 16
                                            },
                                            {
                                                "end_user_id": "bob@pfizer.example",
                                                "queries": 15,
                                                "cost_cents": 750,
                                                "cost_usd": 7.5
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid date in `from` or `to`"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "`key_id` is not one of your API keys (another owner's key and a nonexistent id answer identically)."
                    }
                }
            }
        },
        "/mcp": {
            "post": {
                "x-key-scope": "read",
                "operationId": "mcpJsonRpc",
                "summary": "MCP server endpoint (JSON-RPC 2.0, Streamable HTTP)",
                "description": "Model Context Protocol entry point for AI-native clients (Claude Desktop, Cursor, MCP-aware agents). The same retrosynthesis tools the REST API exposes are available as MCP tools without hand-rolling REST scaffolding. Auth is the same Bearer token; tool catalog: submit_retrosynthesis, get_job_status, get_job_references, get_job_convergence, validate_smiles. Pass end_user_id as a tool argument for usage attribution.\n\n\ud83d\udd34 MCP server access is a licensable capability and MAY BE EXCLUDED by your agreement (\u00a72.2). When it is, this endpoint refuses. Note the body is JSON-RPC: there is no `status` field and `error` is an object.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["jsonrpc", "method"],
                                "properties": {
                                    "jsonrpc": {
                                        "type": "string",
                                        "enum": ["2.0"]
                                    },
                                    "id": {
                                        "oneOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "number"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    },
                                    "method": {
                                        "type": "string",
                                        "enum": [
                                            "initialize",
                                            "tools/list",
                                            "tools/call",
                                            "notifications/initialized",
                                            "prompts/list",
                                            "resources/list"
                                        ]
                                    },
                                    "params": {
                                        "type": "object"
                                    }
                                }
                            },
                            "example": {
                                "jsonrpc": "2.0",
                                "id": 1,
                                "method": "tools/call",
                                "params": {
                                    "name": "submit_retrosynthesis",
                                    "arguments": {
                                        "smiles": "CCO",
                                        "num_steps": 2,
                                        "end_user_id": "alice@pfizer.example"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "JSON-RPC response (or batched array when input is a batch)"
                    },
                    "204": {
                        "description": "Notification accepted (no body)"
                    },
                    "400": {
                        "description": "Invalid JSON-RPC envelope"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "\ud83d\udd34 MCP server access is a licensable capability and MAY BE EXCLUDED by your agreement (\u00a72.2). When it is, this endpoint refuses. Note the body is JSON-RPC: there is no `status` field and `error` is an object. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/JsonRpcErrorResponse"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "x-key-scope": "read",
                "operationId": "mcpServerInfo",
                "summary": "MCP server metadata probe",
                "description": "Some MCP clients GET the endpoint first to confirm transport support before issuing JSON-RPC.",
                "responses": {
                    "200": {
                        "description": "Server info",
                        "content": {
                            "application/json": {
                                "example": {
                                    "name": "synovai",
                                    "version": "1.0.0",
                                    "description": "SynovAI retrosynthesis and route-analysis tools.",
                                    "protocolVersion": "2025-06-18",
                                    "transport": "streamable-http",
                                    "endpoint": "/api/v1/mcp"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/patents/check": {
            "post": {
                "x-key-scope": "write",
                "operationId": "checkPatentOverlap",
                "summary": "Screen SMILES for patent overlap",
                "description": "Submit up to 1000 SMILES strings and receive per-molecule patent-landscape findings (known patents, claim type, freedom-to-operate signal). Useful for IP-risk screening before committing to a route. Part of the route-metrics bundle: charged once per canonical molecule, per API key, per billing period, shared with /jobs/{jobId}/analysis, /jobs/{jobId}/references, /jobs/{jobId}/convergence and /patents/check \u2014 whichever is called first for that molecule pays, the rest are free. Here each submitted SMILES is canonicalised and is its own molecule; a salt is a different molecule from its neutral parent (a patent query is not desalted).",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["smiles"],
                                "properties": {
                                    "smiles": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 1000,
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "SMILES strings to check (max 1000 per request)."
                                    }
                                }
                            },
                            "example": {
                                "smiles": ["CC(=O)Oc1ccccc1C(=O)O", "CCO"]
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "Patent overlap result",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PatentCheckResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body or > 1000 SMILES"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/webhooks": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listWebhooks",
                "summary": "List registered webhook endpoints",
                "description": "Returns webhook endpoints owned by the calling API key. Secrets are NOT included; they are returned only once at creation.",
                "responses": {
                    "200": {
                        "description": "List of endpoints",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "endpoints": [
                                            {
                                                "id": "wh_abc123",
                                                "url": "https://api.paramus.ai/webhooks/synovai",
                                                "events": ["task.completed", "task.failed"],
                                                "description": "Production sink",
                                                "isActive": true,
                                                "createdAt": "2026-05-14T12:00:00.000Z"
                                            }
                                        ],
                                        "supportedEvents": [
                                            "task.completed",
                                            "task.failed",
                                            "outcome.logged",
                                            "batch.progress",
                                            "batch.paused",
                                            "batch.completed"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "createWebhook",
                "summary": "Register a webhook endpoint",
                "description": "Subscribes the calling API key's owner to platform events: terminal-state job events (task.completed, task.failed) and data-flywheel outcome events (outcome.logged, fired when a reaction outcome is recorded via the app, the API, or an ELN sync), and batch events (batch.progress, throttled to at most one per batch per 60 seconds; batch.paused, once each time a chunked batch is paused, by you or automatically at its spend cap; batch.completed, exactly once when the last child reaches a terminal state and no targets are pending, including a cancelled batch, and again after a retry round finishes). Batch events cover batches made by the API and in the app, delivered to the batch owner's endpoints. Their `data` carries status and counts only, never structures or SMILES: `job_id`, `name`, `source` (ui | api | mcp | library), `workflow`, `state` (queued | running | paused | succeeded | failed | cancelled), `total`, `terminal`, `counts` (by child status), `submitted_at`, plus `completed_at` on batch.completed, and on batch.paused `pending`, `paused_reason` (user | spend_cap), `paused_at`, `spend_cap_cents` and `spent_cents`. Reconcile against `GET /v2/batch/{id}`. Returns the signing secret ONCE in the response; you must store it (used for HMAC verification on each delivery). After ~10 consecutive 5xx responses an endpoint is auto-deactivated and must be re-created or reactivated.\n\n## Verifying a delivery\n\nEach delivery carries:\n\n- `X-SynovAI-Signature: sha256=<hex>` \u2014 HMAC-SHA256 of the **raw request body**, keyed on the secret returned once at registration. Compare with a constant-time equality check against the bytes you received, before parsing them.\n- `X-SynovAI-Event: <event name>`\n\n```\nexpected = 'sha256=' + hmac_sha256(secret, raw_body).hexdigest()\nif not constant_time_equals(expected, request.header('X-SynovAI-Signature')): reject(401)\n```\n\nThere is no timestamp in the signature, so it does not by itself defend against replay; treat the job id as the idempotency key and ignore a delivery you have already applied.\n\n**Delivery is a single attempt, with no retry queue.** After 10 consecutive non-2xx responses the endpoint is deactivated and you must rotate the secret and re-enable it. Reconcile against `GET /jobs/{jobId}` rather than assuming delivery.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["url", "events"],
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Absolute URL the platform will POST to. Must be in ALLOWED_CALLBACK_DOMAINS."
                                    },
                                    "events": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "task.completed",
                                                "task.failed",
                                                "outcome.logged",
                                                "batch.progress",
                                                "batch.paused",
                                                "batch.completed"
                                            ]
                                        }
                                    },
                                    "description": {
                                        "type": "string",
                                        "nullable": true
                                    }
                                }
                            },
                            "example": {
                                "url": "https://api.paramus.ai/webhooks/synovai",
                                "events": ["task.completed", "task.failed"],
                                "description": "Production sink"
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "201": {
                        "description": "Webhook created. `data.secret` is returned ONCE.",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "id": "wh_abc123",
                                        "url": "https://api.paramus.ai/webhooks/synovai",
                                        "events": ["task.completed", "task.failed"],
                                        "description": "Production sink",
                                        "isActive": true,
                                        "createdAt": "2026-05-14T12:00:00.000Z",
                                        "secret": "whsec_<store-this-now>"
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid body, unsupported event, or URL domain not allowed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/webhooks/{id}": {
            "delete": {
                "x-key-scope": "write",
                "operationId": "deleteWebhook",
                "summary": "Delete a webhook endpoint",
                "parameters": [
                    {
                        "in": "path",
                        "name": "id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Webhook endpoint id."
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "Deleted"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Not found (or not owned by the calling key)"
                    }
                }
            }
        },
        "/api/v2/deep-link": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Overrides the /api/v1 servers default for this v2 path, and absolute for the same reason."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "mintDeepLink",
                "summary": "Mint a single-use deep-link token",
                "description": "Paramus Provider Spec deep-link mint endpoint (server-to-server). Returns a 60-second single-use token + the URL to redirect the user's browser to. Auto-provisions the SynovAI user if they don't exist (DEMO_TIER + 14-day trial, same as a magic-link signup). Per-user keys may only mint for their own owner (403 on cross-user); keys owned by paramus-* system users are treated as global.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["username", "intent"],
                                "properties": {
                                    "username": {
                                        "type": "string",
                                        "description": "Email of the SynovAI user this deep-link will sign in as."
                                    },
                                    "intent": {
                                        "type": "string",
                                        "enum": ["dashboard", "submit", "usage"],
                                        "description": "Which landing path the user should be redirected to after the token is consumed."
                                    }
                                }
                            },
                            "example": {
                                "username": "alice@novartis.example",
                                "intent": "dashboard"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Token minted",
                        "content": {
                            "application/json": {
                                "example": {
                                    "token": "QMg5k0ixTZhHhPkqDtVPrEXYecTCOIg0",
                                    "intent": "dashboard",
                                    "expires_in": 60,
                                    "target_url": "https://platform.synovai.net/deeplink?token=QMg5k0ixTZhHhPkqDtVPrEXYecTCOIg0"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Unsupported intent or missing field"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "Per-user key attempted to mint for a different user, or target user is deactivated. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`)."
                    }
                }
            }
        },
        "/api/v2/batch": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "listBatches",
                "summary": "List your batches",
                "description": "The caller's batches, newest first. Scoped to the key's owner, like `GET /api/v2/batch/{job_id}`: every key of the same owner sees the same batches, and another user's key sees none of them. Vocabulary is the batch one (`ingesting` `queued` `running` `paused` `succeeded` `failed` `cancelled`), not the `/v1/jobs` one. `state` is rolled up from the child tasks, so a sparse filter can return a short page with a `next_cursor`: keep paging until it is null. Errors are `{error, message}`.\n\nA chunked batch can be paused and resumed: `POST /api/v2/batch/{job_id}/pause` and `/resume`.",
                "parameters": [
                    {
                        "in": "query",
                        "name": "state",
                        "schema": {
                            "type": "string",
                            "enum": ["ingesting", "queued", "running", "paused", "succeeded", "failed", "cancelled"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "source",
                        "description": "Where the batch was created: `ui` (the app), `api`, `mcp` or `library`.",
                        "schema": {
                            "type": "string",
                            "enum": ["ui", "api", "mcp", "library"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "created_after",
                        "description": "ISO 8601 timestamp; only batches submitted after it.",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "in": "query",
                        "name": "cursor",
                        "description": "`next_cursor` from the previous page.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of batches",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": ["batches", "next_cursor"],
                                    "properties": {
                                        "batches": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "required": [
                                                    "job_id",
                                                    "workflow",
                                                    "status",
                                                    "source",
                                                    "child_count",
                                                    "completed_count",
                                                    "progress",
                                                    "submitted_at",
                                                    "updated_at"
                                                ],
                                                "properties": {
                                                    "job_id": {
                                                        "type": "string"
                                                    },
                                                    "workflow": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "queued",
                                                            "running",
                                                            "succeeded",
                                                            "failed",
                                                            "cancelled"
                                                        ]
                                                    },
                                                    "source": {
                                                        "type": "string",
                                                        "enum": ["ui", "api", "mcp", "library"]
                                                    },
                                                    "stateless": {
                                                        "type": "boolean"
                                                    },
                                                    "child_count": {
                                                        "type": "integer"
                                                    },
                                                    "pending_count": {
                                                        "type": "integer",
                                                        "description": "Chunked batches: accepted targets not yet made into runs. 0 for an inline batch."
                                                    },
                                                    "completed_count": {
                                                        "type": "integer"
                                                    },
                                                    "progress": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 100
                                                    },
                                                    "submitted_at": {
                                                        "type": "string",
                                                        "format": "date-time"
                                                    },
                                                    "updated_at": {
                                                        "type": "string",
                                                        "format": "date-time"
                                                    }
                                                }
                                            }
                                        },
                                        "next_cursor": {
                                            "type": "string",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid query parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "submitBatch",
                "summary": "Submit a batch / async workflow",
                "description": "Paramus Provider Spec Scenario 2. Fans out N child Tasks (one per input item), returns a batch job_id the caller polls. Supported workflows: screen_library (predict_route over up to 100 SMILES targets).\n\n**Callbacks.** When `callback_url` is supplied you receive one callback per molecule as each finishes, carrying that molecule's result, plus a single `batch.completed` event when the whole batch reaches a terminal state.\n\nEach per-molecule callback carries a `batch` object identifying which molecule it is, so you do not need to hold a task-id map. `job_id` at the top level is that molecule's own task id; `batch.position` is the 0-based index into the `targets` array exactly as you submitted it.\n\n```json\n{\n  \"status\": \"success\",\n  \"job_id\": \"clx_child_task_id\",\n  \"batch\": { \"job_id\": \"clx_batch_id\", \"position\": 7 },\n  \"schema_version\": \"1.0\",\n  \"result\": { \"path_dicts\": [] },\n  \"cost_usd\": 5.0\n}\n```\n\nThe same `batch` object is present on a failure callback, so an errored molecule can be correlated too. The completion event carries status and counts only, never structures: the results already arrived with the per-molecule callbacks.```json\n{\n  \"event\": \"batch.completed\",\n  \"job_id\": \"clx...\",\n  \"workflow\": \"screen_library\",\n  \"status\": \"succeeded\",\n  \"total\": 100,\n  \"counts\": { \"completed\": 98, \"failed\": 2 },\n  \"submitted_at\": \"2026-09-25T10:00:00.000Z\",\n  \"completed_at\": \"2026-09-25T10:42:11.000Z\"\n}\n```\n\n**Chunked ingestion (`mode: \"chunked\"`).** For more than 100 targets: create the batch, append chunks to it, then seal it. See `POST /api/v2/batch/{job_id}/targets` (JSON chunks), `POST /api/v2/batch/{job_id}/upload` (a CSV, SDF or SMILES file) and `POST /api/v2/batch/{job_id}/seal`. `input` is required for inline batches.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["workflow"],
                                "properties": {
                                    "workflow": {
                                        "type": "string",
                                        "enum": ["screen_library"]
                                    },
                                    "input": {
                                        "type": "object",
                                        "description": "Workflow-specific input. For screen_library: targets (string[]), num_steps (int), temperature (string), deep_search (bool), stock_filter (string[]), catalog_id (string) and catalog_mode (`filter` | `highlight`, default `filter`). `catalog_id` is one of your own catalogs (`GET /api/v1/catalogs`), frozen at submit and applied to every child's routes when they are read, exactly as on `POST /v1/execute` (see `catalog_id` there): 404 `catalog_not_found` for any other id, 400 `stateless_not_supported` on a stateless key. RouteSummary-backed views (`/ranked`, `/pareto`, `/convergence`, `/clusters`, `/export`) drop the routes a `filter` catalog removes, with the reason in `no_surviving_routes`."
                                    },
                                    "mode": {
                                        "type": "string",
                                        "enum": ["inline", "chunked"],
                                        "default": "inline",
                                        "description": "`inline` (default): targets in `input.targets`, up to 100, runs created now. `chunked`: an empty batch in state `ingesting`, returned with 201; append targets with `POST /api/v2/batch/{job_id}/targets` (up to 1,000 per call), then start it with `POST /api/v2/batch/{job_id}/seal`. With `chunked`, `input` holds only run settings (num_steps, temperature, deep_search, stock_filter, catalog_id, catalog_mode) and `input.targets` is refused. A chunked batch's catalog is frozen at create. \ud83d\udd34 Not available to stateless API keys (400 `stateless_not_supported`): chunked targets are stored until dispatch, which a stateless key promises never happens. Use inline with a callback_url."
                                    },
                                    "name": {
                                        "type": "string",
                                        "maxLength": 200,
                                        "description": "Optional label for a chunked batch."
                                    },
                                    "spend_cap_cents": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1000000000,
                                        "nullable": true,
                                        "description": "`mode: \"chunked\"` only (400 on an inline batch, which is priced whole at submit). The batch's own spend cap in cents. When the next run would take the batch past it, the batch pauses with `paused_reason: \"spend_cap\"` and fires `batch.paused`; raise it with `POST /api/v2/batch/{job_id}/resume` and `spend_cap_cents` to continue. The API key's daily and monthly caps still apply on top. Sandbox runs are never charged, so they never reach it."
                                    },
                                    "template_id": {
                                        "type": "string",
                                        "description": "A batch template (`GET /api/v1/batch-templates`) whose defaults this batch takes. **Precedence: an explicit field in this request always beats the template's.** `workflow`, `callback_url`, `spend_cap_cents`: the request's value if the field is present (even `null`), else the template's. `input`: merged key by key, the request's keys winning; `input.targets` is always yours. filing (project and folder): a pair; naming either in this request ignores the template's filing whole. `lens`: merged key by key (`profile` and `custom_profile_id` are one choice). Two template fields are not inherited and are listed under `template.ignored`: `callback_url` on a template shared with you (not yours), and `spend_cap_cents` on an inline batch. The merged result is validated like any request, and the safety guards run on every target exactly as without a template. 404 `template_not_found` for a template you cannot see; 409 `template_reference_missing` (naming the field) when the template's project, folder, saved view or custom profile no longer exists, never a quiet fall back to defaults. The 201/202 response gains `template` ({id, applied[], ignored[]})."
                                    },
                                    "lens": {
                                        "$ref": "#/components/schemas/BatchTemplateConfig/properties/lens",
                                        "description": "The lens to record on the batch (same fields as `/ranked`, validated by the same resolver). Echoed here and by `GET /api/v2/batch/{job_id}` as `lens`. It does not change what `/ranked` returns: pass its fields there to rank by it. Not kept for a stateless key."
                                    },
                                    "callback_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "nullable": true,
                                        "description": "Where to POST the result when the job finishes.\n\n\ud83d\udd34 TOP-LEVEL, beside `tool` and `params` \u2014 NOT inside `params`. Putting it in `params` is accepted and the callback then silently never fires.\n\n**Delivery is AT MOST ONCE on this channel.** Three attempts (immediate, +1s, +5s) against a 5-second timeout, then the delivery is dropped. There is no durable retry queue, so a delivery CAN be lost \u2014 if your user is waiting on it, they wait forever. **Reconcile:** poll `GET /jobs/{jobId}` for anything still outstanding after a sensible interval. That poll, not the callback, is what actually protects you.\n\n\ud83d\udd34 **This per-job callback is NOT signed.** Treat it as a notification, not as data: on receipt, fetch the job over the API before trusting anything in it. Registered webhooks (`POST /webhooks`) ARE signed \u2014 see that endpoint."
                                    },
                                    "user": {
                                        "type": "string",
                                        "pattern": "^[\\w@.+\\-:]{1,128}$",
                                        "description": "Attributes this batch to one of YOUR end customers. Opaque to us, recorded on the batch's usage record so you can re-bill your own users; per-end-user spend caps and launch credits key off it. Accepted but ignored before v1.2.0.\n\n🔴 **This field, in the body, is the ONLY way to attribute a batch.** `POST /api/v2/batch` does not read the `X-End-User-Id` header that `/execute` accepts. A header sent here is ignored and the whole batch is attributed to nobody — reported under `end_user_id: null` in `GET /usage`, earning and consuming no launch credits. One batch carries one end user; to attribute per molecule, submit per molecule on `/execute`.\n\n⚠️ Same character set as `X-End-User-Id` (`^[\\w@.+\\-:]{1,128}$`), and the same failure mode: a value outside it is dropped to null rather than refused. Check the `user` echoed in the 202 against what you sent."
                                    },
                                    "project_id": {
                                        "type": "string",
                                        "description": "The project for targets that do not name one. Without it they go in the API key's default project, \"API runs: <key label>\". Every target without its own project_id lands in the same project. See \"Projects, folders and pipeline stages\" above."
                                    },
                                    "folder_id": {
                                        "type": "string",
                                        "nullable": true,
                                        "description": "Optional. A subfolder of that project (or of the key's default project, without project_id) which the API key owner can open, from GET /projects/{project_id}/folders. Without it the run goes in Unsorted, which every project member can read."
                                    }
                                }
                            },
                            "example": {
                                "workflow": "screen_library",
                                "input": {
                                    "targets": ["CCO", "CC(=O)Oc1ccccc1C(=O)O"],
                                    "num_steps": 3
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`mode: \"chunked\"` only: the batch exists in state `ingesting`, with no runs yet.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": { "type": "string" },
                                        "state": { "type": "string", "enum": ["ingesting"] },
                                        "mode": { "type": "string", "enum": ["chunked"] },
                                        "submitted_at": { "type": "string", "format": "date-time" },
                                        "max_chunk_targets": { "type": "integer", "example": 1000 },
                                        "user": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "The end-user identifier this batch was attributed to, echoed back after validation. See the `user` request field: null after you sent one means it was dropped and the batch will bill unattributed."
                                        },
                                        "spend_cap_cents": { "type": "integer", "nullable": true },
                                        "project_id": {
                                            "type": "string",
                                            "description": "Org model only: the default project for targets that name none."
                                        },
                                        "folder_id": { "type": "string", "nullable": true }
                                    },
                                    "required": ["job_id", "state", "mode", "submitted_at", "max_chunk_targets"]
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "state": "ingesting",
                                    "mode": "chunked",
                                    "submitted_at": "2026-11-14T12:00:00.000Z",
                                    "max_chunk_targets": 1000
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Batch accepted; poll status endpoint until terminal. Children beyond your plan's concurrent-run cap wait in the queue and start as earlier ones finish; `queued_count` says how many.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "enum": ["queued"]
                                        },
                                        "submitted_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "child_count": {
                                            "type": "integer",
                                            "description": "Number of runs the batch fanned out to."
                                        },
                                        "user": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "The end-user identifier this batch was actually attributed to, echoed back after validation. null when you sent none — and also when what you sent was outside the accepted character set and was therefore dropped, in which case the batch runs and bills with no attribution and no launch credit. Compare it with what you sent."
                                        },
                                        "queued_count": {
                                            "type": "integer",
                                            "description": "How many of those runs are waiting behind your concurrent-run cap rather than starting immediately. 0 when all started.\n\n🔴 **Every target in a batch is one run.** A batch of N counts N against your concurrency, N against your queue depth and N against your daily run cap — it is not one unit of anything. Admission is all-or-nothing and happens before any child is created: if N does not fit in your remaining queue depth, the whole submission is refused 429 `capacity` with a message naming the limit, and nothing is created or charged. The same N is charged against the daily run cap. Only the per-minute REQUEST limit sees a batch as one, because it counts requests and not molecules.\n\nThe limits applied are the KEY's: a partner key uses the concurrency, queue depth and daily run cap agreed for that key; any other key uses its plan's. The inline ceiling of 100 targets per call bounds one request's size, not your volume."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Missing or invalid field, or unsupported workflow Also returned when a stateless API key omits callback_url: a stateless batch stores no results, so the callback is the only delivery channel."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "503": {
                        "description": "Worker unavailable or all child dispatches failed"
                    },
                    "403": {
                        "description": "A partner key whose agreed run limits have not been set yet. The body is `{ \"error\": \"partner_limits_not_configured\", \"message\": ... }` (batch carries the code in `error`). Nothing is created or billed; contact SynovAI to have the limits set. Also `dangerous_target` or `compound_blocked` (inline batches): a target is refused by the safety check or a blacklist, with the same code and message `/execute` returns for it. The whole batch is refused before anything is created or billed, and `failed_targets` lists each refused target by `index` (with `error` and `message`). A target that cannot be desalted is refused the same way with `invalid_smiles` (400). A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`)."
                    },
                    "402": {
                        "description": "Spend cap exceeded. The batch is priced as N x unit cost and checked BEFORE any work is dispatched, so nothing is created and nothing is billed \u2014 resubmit a smaller batch or raise the cap. Added in v1.2.0; this endpoint previously enforced no cap at all."
                    },
                    "409": {
                        "description": "`template_reference_missing`: the template points at a project, folder, saved view or custom profile that is gone. The body names it in `missing`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ErrorResponse"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`project_not_found` or `folder_not_found`, with `failed_targets`. Not-found and no access are the same answer."
                    }
                }
            }
        },
        "/api/v2/batch/compare": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "batchCompare",
                "summary": "Compare two batches under one lens (what improved, regressed, is new or gone)",
                "description": "Compares two of your batches (design iterations) under ONE lens: the standard `/ranked` parameters apply to both, so a delta is a difference between the batches and never between two scoring rules. Both are ranked per molecule.\n\nFree and read-only: computed from precomputed per-route summaries and target metadata (never a run's contents) and recorded at zero price. Access is `/v2/batch/{job_id}/ranked`'s, for BOTH batches: the key's owner only, 404 for a missing or foreign batch on either side, 401 for a revoked key, 410 for a stateless batch. The response never says which of the two failed.\n\n**Matching.** `match` states the basis. Molecules are paired on `external_id` when both batches carry one that is unique within each; whatever is left is paired on RDKit canonical target SMILES (`canonical_smiles`, stereo kept), or on the exact string (`smiles_exact`) if RDKit is unavailable. `match` is `mixed` when more than one basis paired molecules; `match_counts` and each row's `match` give the split.\n\n**Per matched molecule:** `composite_delta` and `step_delta` (b minus a; null unless both survive the lens), `rank_movement` (places gained from a to b under the lens, positive is better), and `survival` (`both`, `yes_to_no`, `no_to_yes`, `neither`). Molecules in only one batch are listed under `added` and `removed`, never counted as a regression. `summary` carries each batch's funnel counts and median composite, and their deltas.\n\n**Lens.** `lens_digest`, `computed_at` and `unsupported_filters` are echoed once; the same lens ran on both batches.\n\n**Bounded.** At most 5000 molecules per batch are compared (first by position) and each list holds at most 1000 rows; counts stay exact. `truncated`, `truncation` and `warnings` say what was cut. `sort` orders the matched rows before the cap.",
                "parameters": [
                    {
                        "in": "query",
                        "name": "a",
                        "required": true,
                        "description": "The first batch (the baseline).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "b",
                        "required": true,
                        "description": "The second batch. Deltas are b minus a.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "description": "Built-in scoring profile id (discovery, medicinal, process, computational, materials, green, educational). Omit for platform defaults. Not with `custom_profile_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "custom_profile_id",
                        "description": "One of your own custom scoring profiles. Its bundled filters apply too, or appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "view_id",
                        "description": "A saved view you can read. Its filters apply; ones the server cannot apply appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_reaction_type",
                        "description": "Drop routes with a step of this reaction type. Repeatable.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_hazard",
                        "description": "Drop routes carrying a hazard flag of this severity or worse.",
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_smiles",
                        "description": "Drop routes using this exact SMILES as a starting material. Repeatable. Not a substructure search.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_patent_risk",
                        "description": "Not applied yet: patent risk is not computed for batch routes. Accepted and reported in `unsupported_filters`.",
                        "schema": {
                            "type": "string",
                            "enum": ["low", "moderate", "high"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_composite",
                        "description": "Drop routes whose composite under this lens is below it.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10
                        }
                    },
                    {
                        "in": "query",
                        "name": "rank_by",
                        "description": "What to rank on. Counts rank fewer-first; `weakest_step` ranks the route whose lowest per-step model confidence is highest first (a route with no step confidence sorts last, never as 0); ties break on composite, then submission position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"],
                            "default": "composite"
                        }
                    },
                    {
                        "in": "query",
                        "name": "sort",
                        "description": "Order of `matched`: composite_delta (default), step_delta, rank_movement or position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite_delta", "step_delta", "rank_movement", "position"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "dir",
                        "description": "desc (default) or asc. Rows with no value for the sort key come last.",
                        "schema": {
                            "type": "string",
                            "enum": ["asc", "desc"]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The comparison",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "a": {
                                            "type": "string"
                                        },
                                        "b": {
                                            "type": "string"
                                        },
                                        "lens_digest": {
                                            "type": "string"
                                        },
                                        "computed_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "unsupported_filters": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "per": {
                                            "type": "string",
                                            "enum": ["molecule"]
                                        },
                                        "rank_by": {
                                            "type": "string"
                                        },
                                        "match": {
                                            "type": "string",
                                            "enum": ["external_id", "canonical_smiles", "smiles_exact", "mixed", "none"]
                                        },
                                        "match_counts": {
                                            "type": "object",
                                            "properties": {
                                                "external_id": {
                                                    "type": "integer"
                                                },
                                                "canonical_smiles": {
                                                    "type": "integer"
                                                },
                                                "smiles_exact": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "match_note": {
                                            "type": "string"
                                        },
                                        "canonicaliser": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "uncanonicalised_molecule_count": {
                                            "type": "integer"
                                        },
                                        "summary": {
                                            "type": "object",
                                            "properties": {
                                                "a": {
                                                    "type": "object"
                                                },
                                                "b": {
                                                    "type": "object"
                                                },
                                                "delta": {
                                                    "type": "object"
                                                },
                                                "counts": {
                                                    "type": "object",
                                                    "properties": {
                                                        "matched": {
                                                            "type": "integer"
                                                        },
                                                        "added": {
                                                            "type": "integer"
                                                        },
                                                        "removed": {
                                                            "type": "integer"
                                                        },
                                                        "improved": {
                                                            "type": "integer"
                                                        },
                                                        "regressed": {
                                                            "type": "integer"
                                                        },
                                                        "unchanged": {
                                                            "type": "integer"
                                                        },
                                                        "not_comparable": {
                                                            "type": "integer"
                                                        },
                                                        "surviving_yes_to_no": {
                                                            "type": "integer"
                                                        },
                                                        "surviving_no_to_yes": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "truncated": {
                                            "type": "boolean"
                                        },
                                        "truncation": {
                                            "type": "object"
                                        },
                                        "warnings": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "matched": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "match": {
                                                        "type": "string",
                                                        "enum": ["external_id", "canonical_smiles", "smiles_exact"]
                                                    },
                                                    "external_id": {
                                                        "type": "object",
                                                        "properties": {
                                                            "a": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "b": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "target_smiles": {
                                                        "type": "object",
                                                        "properties": {
                                                            "a": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "b": {
                                                                "type": "string",
                                                                "nullable": true
                                                            }
                                                        }
                                                    },
                                                    "a": {
                                                        "type": "object",
                                                        "properties": {
                                                            "position": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "task_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "completed",
                                                                    "empty",
                                                                    "failed",
                                                                    "in_progress",
                                                                    "pending"
                                                                ]
                                                            },
                                                            "survives_lens": {
                                                                "type": "boolean"
                                                            },
                                                            "rank": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "composite": {
                                                                "type": "number",
                                                                "nullable": true
                                                            },
                                                            "step_count": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            }
                                                        }
                                                    },
                                                    "b": {
                                                        "type": "object",
                                                        "properties": {
                                                            "position": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "task_id": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "completed",
                                                                    "empty",
                                                                    "failed",
                                                                    "in_progress",
                                                                    "pending"
                                                                ]
                                                            },
                                                            "survives_lens": {
                                                                "type": "boolean"
                                                            },
                                                            "rank": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            },
                                                            "composite": {
                                                                "type": "number",
                                                                "nullable": true
                                                            },
                                                            "step_count": {
                                                                "type": "integer",
                                                                "nullable": true
                                                            }
                                                        }
                                                    },
                                                    "composite_delta": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "step_delta": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "rank_movement": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "survival": {
                                                        "type": "string",
                                                        "enum": ["both", "yes_to_no", "no_to_yes", "neither"]
                                                    }
                                                }
                                            }
                                        },
                                        "added": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "position": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "task_id": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "completed",
                                                            "empty",
                                                            "failed",
                                                            "in_progress",
                                                            "pending"
                                                        ]
                                                    },
                                                    "survives_lens": {
                                                        "type": "boolean"
                                                    },
                                                    "rank": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "composite": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "step_count": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "external_id": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    }
                                                }
                                            }
                                        },
                                        "removed": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "position": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "task_id": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": [
                                                            "completed",
                                                            "empty",
                                                            "failed",
                                                            "in_progress",
                                                            "pending"
                                                        ]
                                                    },
                                                    "survives_lens": {
                                                        "type": "boolean"
                                                    },
                                                    "rank": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "composite": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "step_count": {
                                                        "type": "integer",
                                                        "nullable": true
                                                    },
                                                    "external_id": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid parameter"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch, view or custom profile not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to analyse"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "getBatchStatus",
                "summary": "Get batch status",
                "description": "Aggregate status derived from child tasks.\n\n\ud83d\udd34 **This endpoint's vocabulary is not the one `GET /v1/jobs/{jobId}` uses.** There are three in this API, for three different resources:\n\n| resource | values | poll until |\n|---|---|---|\n| `GET /v1/jobs/{jobId}` | `running` `success` `error` | `success` or `error` |\n| `GET /api/v2/batch/{job_id}` (this one) | `ingesting` `queued` `running` `paused` `succeeded` `failed` `cancelled` | `succeeded`, `failed` or `cancelled` |\n| a route inside `GET /api/v2/batch/{job_id}/result` | `completed` `empty` `failed` `rejected` `cancelled` | already terminal |\n\n`success` and `succeeded` are the same outcome spelled differently on two endpoints, and neither is `completed`. The internal task-status names (`COMPLETED`, `REJECTED`, `EMPTY`) are not wire values and appear on none of these.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Aggregate status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "workflow": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "ingesting",
                                                "queued",
                                                "running",
                                                "paused",
                                                "succeeded",
                                                "failed",
                                                "cancelled"
                                            ],
                                            "description": "Terminal values are `succeeded`, `failed` and `cancelled`. Stop polling on those three and on nothing else. `ingesting` (chunked batches only) means targets are still being appended and nothing runs until `/seal`. A chunked batch with targets still `pending` is never terminal: it reports `queued`, `running` or `paused` until every target has run. `paused` (chunked batches only) means no new targets are being started (see `paused_reason`); runs already started continue. It is not terminal: resume it, or cancel it."
                                        },
                                        "progress": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 100,
                                            "description": "Percentage of child tasks that COMPLETED. A batch can reach a terminal status with progress below 100 \u2014 `failed` means at least one child did not complete, so do not treat 100 as the finish condition. For a chunked batch the denominator includes pending targets."
                                        },
                                        "counts": {
                                            "type": "object",
                                            "description": "Per-state counts. `pending` is accepted chunked targets not yet made into runs (always 0 for an inline batch); the rest are runs.",
                                            "properties": {
                                                "pending": { "type": "integer" },
                                                "queued": { "type": "integer" },
                                                "running": { "type": "integer" },
                                                "completed": { "type": "integer" },
                                                "empty": { "type": "integer" },
                                                "failed": { "type": "integer" },
                                                "cancelled": { "type": "integer" }
                                            }
                                        },
                                        "ingestion": {
                                            "type": "object",
                                            "description": "Chunked batches only. Running ingestion totals.",
                                            "properties": {
                                                "accepted": { "type": "integer" },
                                                "invalid": { "type": "integer" },
                                                "duplicate": { "type": "integer" },
                                                "pending": { "type": "integer" },
                                                "materialised": { "type": "integer" },
                                                "cancelled": { "type": "integer" }
                                            }
                                        },
                                        "estimate": {
                                            "$ref": "#/components/schemas/BatchEstimate",
                                            "nullable": true,
                                            "description": "Chunked batches only: the estimate written at seal, or null before it."
                                        },
                                        "spend_cap_cents": {
                                            "type": "integer",
                                            "nullable": true,
                                            "description": "Chunked batches only: the batch's own spend cap, or null for none. The key's caps apply on top."
                                        },
                                        "spent_cents": {
                                            "type": "integer",
                                            "description": "Chunked batches only: what the batch has committed, in cents: settled charges plus the reservation for runs still in progress, the same ledger the key's spend cap reads. A failed run is not charged; its reservation is released when that window's usage line closes. Sandbox runs count zero."
                                        },
                                        "paused_reason": {
                                            "type": "string",
                                            "nullable": true,
                                            "enum": ["user", "spend_cap", null],
                                            "description": "Chunked batches only, when `status` is `paused`: `user` (paused with `/pause` or in the app) or `spend_cap` (the next run would take the batch past `spend_cap_cents`). Null otherwise."
                                        },
                                        "paused_at": {
                                            "type": "string",
                                            "format": "date-time",
                                            "nullable": true
                                        },
                                        "submitted_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "updated_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "error": {
                                            "type": "object",
                                            "nullable": true,
                                            "description": "Present only when `status` is `failed`, describing the FIRST failing child. Absent otherwise.",
                                            "properties": {
                                                "code": {
                                                    "type": "string",
                                                    "enum": ["failed", "rejected", "empty"],
                                                    "description": "The failing child's task status, lowercased."
                                                },
                                                "message": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": ["code", "message"]
                                        }
                                    },
                                    "required": [
                                        "job_id",
                                        "workflow",
                                        "status",
                                        "progress",
                                        "submitted_at",
                                        "updated_at"
                                    ],
                                    "additionalProperties": true
                                },
                                "example": {
                                    "job_id": "cm9batch001",
                                    "workflow": "screen_library",
                                    "status": "running",
                                    "progress": 40,
                                    "submitted_at": "2026-10-05T12:00:00.000Z",
                                    "updated_at": "2026-10-05T12:04:10.000Z"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch job not found (or not owned by calling key)"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/result": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "getBatchResult",
                "summary": "Get final result for a succeeded batch",
                "description": "Returns aggregate result + metrics only when status is succeeded. 409 otherwise.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Per-child results. Returned once every child is TERMINAL, not only when all succeeded \u2014 before v1.2.0 a single failed molecule made the whole batch unreadable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "schema_version": {
                                            "type": "string",
                                            "example": "1.0",
                                            "description": "Version of the route-tree shape (path_dicts and the TreeNode fields inside it), not of the HTTP API. Present on every response that carries routes. Minor bumps are additive and safe to ignore; a major bump changes or removes an existing field. Pin on the major if you parse the tree."
                                        },
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "workflow": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "enum": ["succeeded", "failed", "cancelled"],
                                            "description": "failed means at least one child ERRORED. A child that simply found no route is \"empty\", which is a normal screening outcome and does NOT fail the batch."
                                        },
                                        "result": {
                                            "type": "object",
                                            "properties": {
                                                "targets": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "routes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "position": {
                                                                "type": "integer"
                                                            },
                                                            "target_smiles": {
                                                                "type": "string",
                                                                "nullable": true
                                                            },
                                                            "task_id": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "enum": [
                                                                    "completed",
                                                                    "empty",
                                                                    "failed",
                                                                    "rejected",
                                                                    "cancelled"
                                                                ],
                                                                "description": "Per-child outcome. Distinguishes \"no route found\" from \"errored\" when result is null."
                                                            },
                                                            "result": {
                                                                "type": "object",
                                                                "nullable": true
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "summary": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "succeeded": {
                                                    "type": "integer"
                                                },
                                                "empty": {
                                                    "type": "integer",
                                                    "description": "Searched, no route found. Not an error."
                                                },
                                                "failed": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "metrics": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch job not found"
                    },
                    "409": {
                        "description": "Children are still running. Poll the status endpoint; the message names how many are outstanding."
                    },
                    "410": {
                        "description": "This batch was submitted with a stateless API key, so no results were retained. They were delivered to your callback_url and only there. Added in v1.2.0."
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/stream": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "streamBatchResults",
                "summary": "Page through a batch's per-molecule results as NDJSON, resumable by position",
                "description": "A resumable results feed for a batch. Each call returns up to `limit` lines of `application/x-ndjson`, one per molecule that has stopped, in batch-position order from `since_position`, then ONE trailer line `{\"next_position\": N, \"done\": bool}`. Poll again with `since_position=N` until `done` is true.\n\n**Paged, not held open.** The server does not hold the connection open and does not use response streaming; every call is a bounded page that ends. A dropped connection or a restarted client resumes from the last `next_position` it saw.\n\n**No gaps, no duplicates.** A page stops at the first molecule that has not finished, and `next_position` is that molecule's position, so a slower molecule holds the feed rather than being skipped. Resuming from `next_position` delivers every molecule exactly once. `done` is true when every molecule up to the end of the batch has been delivered.\n\n**Line fields (summary only).** `position`, `external_id`, `name`, `job_id`, `state` (`ranked`, `no_surviving_route`, `empty` or `failed`), `composite`, `label`, `step_count`, `leaf_count`. Scored under the default profile with no filters, from precomputed route summaries: `composite`, `label`, `step_count` and `leaf_count` describe the molecule's best route and are null unless `state` is `ranked`. Never route contents, structures or hazard data; fetch a route with `GET /api/v1/jobs/{id}` or re-rank under a lens with `/ranked`.\n\nAccess is `/v2/batch/{job_id}/ranked`'s: the key's owner only, 404 for anyone else, 401 for a revoked key, 410 for a stateless batch (nothing was retained). Free; recorded at zero price.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "since_position",
                        "description": "Resume point: the `next_position` of the previous response. Default 0.",
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "description": "Most lines in one response (1 to 1000, default 500).",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000,
                            "default": 500
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "NDJSON: zero or more result lines, then the trailer.",
                        "content": {
                            "application/x-ndjson": {
                                "schema": {
                                    "type": "string"
                                },
                                "example": "{\"position\":0,\"external_id\":\"A-1\",\"name\":\"A-1\",\"job_id\":\"clx...\",\"state\":\"ranked\",\"composite\":7.4,\"label\":\"Good\",\"step_count\":3,\"leaf_count\":4}\n{\"next_position\":1,\"done\":false}\n"
                            }
                        }
                    },
                    "400": {
                        "description": "since_position or limit is not valid"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to stream"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/ranked": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "rankBatch",
                "summary": "Rank every molecule of a batch under one lens",
                "description": "One lens (a scoring profile plus filters) applied across every completed molecule of the batch and re-ranked. Free: a ranking is a view of results you have already paid for, so nothing is charged and nothing is re-run. Read from precomputed per-route summaries, scored with the same code as `GET /api/v1/jobs/{id}/scored`, so for a one-molecule batch the order matches `/scored` under the same profile.\n\nScoped like `GET /api/v2/batch/{job_id}`: only the key's owner, 404 for anyone else, and 410 for a stateless batch. Errors are `{error, message}`.\n\n**Ranking.** `per=molecule` (default) ranks molecules by their best surviving route under the lens; `per=route` lists every surviving route across the batch. Weights come from, in order: `profile`, `custom_profile_id`, the `activeProfile` of `view_id`, then platform defaults. Unknown dimensions are left out of a composite and their weight shared across the rest, never scored as zero; `scored_dimensions` says how many of the weighted dimensions a row was scored on.\n\n**Partial batches.** Children still running are not ranked yet. `completed_of_total` and `partial` say so; ranks shift as molecules complete.\n\n**No silent drops.** A molecule whose every route the filters remove is counted in `no_surviving_routes_count` and listed (first 100) in `no_surviving_routes` with reasons. A requested filter the server cannot apply is listed in `unsupported_filters` and was NOT applied. An empty `unsupported_filters` means every requested filter ran. Today that list can contain: `max_patent_risk` (patent risk is not computed for batch routes yet), and from a saved view or custom profile: substructure exclusions (no server substructure search), hazard categories, reaction-type include-lists, patent ceilings and favorites-only.\n\n**Filter semantics.** `exclude_reaction_type` is a case-insensitive substring match on a route's reaction types. `max_hazard` is an input filter only (an internal route screen, not a hazard assessment): excluded routes are reported without any severity, and no per-molecule hazard value is returned. `hazard_note` points to the supplier SDS. `exclude_smiles` is an EXACT match on a route's starting materials (leaf SMILES), not a substring or substructure match, and differs from `/scored`, which matches substrings across the whole tree. Filters from `view_id` and from query params are combined. The `view_id` must be one you can read (yours, or shared with a project you belong to); another's is a 404.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "description": "Built-in scoring profile id (discovery, medicinal, process, computational, materials, green, educational). Omit for platform defaults. Not with `custom_profile_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "custom_profile_id",
                        "description": "One of your own custom scoring profiles. Its bundled filters apply too, or appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "view_id",
                        "description": "A saved view you can read. Its filters apply; ones the server cannot apply appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_reaction_type",
                        "description": "Drop routes with a step of this reaction type. Repeatable.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_hazard",
                        "description": "Drop routes carrying a hazard flag of this severity or worse.",
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_smiles",
                        "description": "Drop routes using this exact SMILES as a starting material. Repeatable. Not a substructure search.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_patent_risk",
                        "description": "Not applied yet: patent risk is not computed for batch routes. Accepted and reported in `unsupported_filters`.",
                        "schema": {
                            "type": "string",
                            "enum": ["low", "moderate", "high"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_composite",
                        "description": "Drop routes whose composite under this lens is below it.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10
                        }
                    },
                    {
                        "in": "query",
                        "name": "rank_by",
                        "description": "What to rank on. Counts rank fewer-first; `weakest_step` ranks the route whose lowest per-step model confidence is highest first (a route with no step confidence sorts last, never as 0); ties break on composite, then submission position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"],
                            "default": "composite"
                        }
                    },
                    {
                        "in": "query",
                        "name": "per",
                        "description": "`molecule`: best surviving route per molecule. `route`: every surviving route.",
                        "schema": {
                            "type": "string",
                            "enum": ["molecule", "route"],
                            "default": "molecule"
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "description": "",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "in": "query",
                        "name": "cursor",
                        "description": "`next_cursor` from the previous page. Only valid with the same profile, filters, `rank_by` and `per`; it names a place in the order, so molecules completing between pages do not repeat or skip rows.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The ranking",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "job_id",
                                        "per",
                                        "rank_by",
                                        "profile",
                                        "unsupported_filters",
                                        "completed_of_total",
                                        "partial",
                                        "no_surviving_routes_count",
                                        "ranked",
                                        "next_cursor"
                                    ],
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "per": {
                                            "type": "string",
                                            "enum": ["molecule", "route"]
                                        },
                                        "rank_by": {
                                            "type": "string"
                                        },
                                        "profile": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "enum": ["builtin", "custom", "default"]
                                                }
                                            }
                                        },
                                        "view_id": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "filters_applied": {
                                            "type": "object",
                                            "description": "The filters that actually ran, after merging a view with query params."
                                        },
                                        "unsupported_filters": {
                                            "type": "array",
                                            "description": "Filters that were asked for and NOT applied.",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "filter": {
                                                        "type": "string"
                                                    },
                                                    "reason": {
                                                        "type": "string"
                                                    },
                                                    "source": {
                                                        "type": "string",
                                                        "enum": ["query", "view", "custom_profile"]
                                                    }
                                                }
                                            }
                                        },
                                        "exclude_smiles_semantics": {
                                            "type": "string"
                                        },
                                        "hazard_note": {
                                            "type": "string",
                                            "description": "Pointer only: SynovAI returns no hazard assessment. Read the supplier SDS for every material."
                                        },
                                        "completed_of_total": {
                                            "type": "object",
                                            "properties": {
                                                "completed": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "partial": {
                                            "type": "boolean"
                                        },
                                        "counts": {
                                            "type": "object",
                                            "properties": {
                                                "completed": {
                                                    "type": "integer"
                                                },
                                                "empty": {
                                                    "type": "integer"
                                                },
                                                "failed": {
                                                    "type": "integer"
                                                },
                                                "in_progress": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "ranked_count": {
                                            "type": "integer",
                                            "description": "Rows in the whole ranking, across all pages."
                                        },
                                        "no_surviving_routes_count": {
                                            "type": "integer"
                                        },
                                        "no_surviving_routes": {
                                            "type": "array",
                                            "description": "First 100 completed molecules left with no route, with reasons.",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "task_id": {
                                                        "type": "string"
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "reasons": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "ranked": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "rank": {
                                                        "type": "integer"
                                                    },
                                                    "position": {
                                                        "type": "integer",
                                                        "description": "Index of the target in the batch."
                                                    },
                                                    "task_id": {
                                                        "type": "string",
                                                        "description": "The job to fetch with GET /api/v1/jobs/{id}."
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "route_index": {
                                                        "type": "integer",
                                                        "description": "1-based, the same as `/scored`'s originalRouteIndex."
                                                    },
                                                    "composite": {
                                                        "type": "number"
                                                    },
                                                    "composite_label": {
                                                        "type": "string"
                                                    },
                                                    "scored_dimensions": {
                                                        "type": "object",
                                                        "properties": {
                                                            "scored": {
                                                                "type": "integer"
                                                            },
                                                            "of": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    },
                                                    "step_count": {
                                                        "type": "integer"
                                                    },
                                                    "max_depth": {
                                                        "type": "integer"
                                                    },
                                                    "leaf_count": {
                                                        "type": "integer"
                                                    },
                                                    "weakest_step": {
                                                        "type": "object",
                                                        "nullable": true,
                                                        "description": "Lowest per-step model confidence (0-10) of the route and which step (1-based, as `/scored`'s `weakest_step`). Null = unknown (a summary not yet refreshed, or no step confidence), never 0.",
                                                        "properties": {
                                                            "confidence": {
                                                                "type": "number"
                                                            },
                                                            "step_number": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    },
                                                    "reaction_types": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "surviving_routes": {
                                                        "type": "integer",
                                                        "description": "per=molecule only."
                                                    }
                                                }
                                            }
                                        },
                                        "next_cursor": {
                                            "type": "string",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid parameter, or a cursor from a different lens"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch, view or custom profile not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to rank"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/convergence": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "batchConvergence",
                "summary": "Starting materials shared across a batch's molecules (consolidated purchasing view)",
                "description": "Which starting materials recur across the molecules of a batch, under one lens, with how many molecules use each, which, and their share of the molecules that have a surviving route. Building blocks are ranked by coverage (\"covers N of M molecules\"), which is the consolidated purchasing view. No prices: sourcing is not part of this endpoint.\n\nFree and read-only: computed on request from precomputed per-route summaries (never a run's contents) and recorded at zero price. Access is the same as `/v2/batch/{job_id}/ranked`: only the key's owner, 404 for anyone else, 401 for a revoked key, 410 for a stateless batch.\n\n**Lens.** Same parameters and resolver as `/ranked`; `unsupported_filters` lists any requested filter that was NOT applied. The response echoes `lens_digest` and `computed_at`. Counts use every route that survives the lens for each molecule; `per` and `rank_by` do not change them.\n\n**Matching.** `match` states the basis. `canonical_smiles`: starting materials are grouped on RDKit canonical SMILES (stereo kept). `exact_smiles`: grouped on the exact stored string (used if canonicalisation is unavailable). Leaves RDKit cannot parse stay as written and are counted in `uncanonicalised_leaf_count`. Salts, tautomers and stereoisomers are different blocks; this is a structure-string match, not a claim of chemical identity.\n\n**Bounded.** At most 5000 completed molecules (first by batch position) are analysed; `truncated` and `truncation` say so. Blocks are listed from `min_molecules` (default 2) up to `limit`; `molecule_refs` lists at most 50 molecules per block while `molecules` is exact.\n\n**Shared intermediates** are not offered: route summaries keep starting materials only. `shared_intermediates.available` is false.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "description": "Built-in scoring profile id (discovery, medicinal, process, computational, materials, green, educational). Omit for platform defaults. Not with `custom_profile_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "custom_profile_id",
                        "description": "One of your own custom scoring profiles. Its bundled filters apply too, or appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "view_id",
                        "description": "A saved view you can read. Its filters apply; ones the server cannot apply appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_reaction_type",
                        "description": "Drop routes with a step of this reaction type. Repeatable.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_hazard",
                        "description": "Drop routes carrying a hazard flag of this severity or worse.",
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_smiles",
                        "description": "Drop routes using this exact SMILES as a starting material. Repeatable. Not a substructure search.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_patent_risk",
                        "description": "Not applied yet: patent risk is not computed for batch routes. Accepted and reported in `unsupported_filters`.",
                        "schema": {
                            "type": "string",
                            "enum": ["low", "moderate", "high"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_composite",
                        "description": "Drop routes whose composite under this lens is below it.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10
                        }
                    },
                    {
                        "in": "query",
                        "name": "rank_by",
                        "description": "What to rank on. Counts rank fewer-first; `weakest_step` ranks the route whose lowest per-step model confidence is highest first (a route with no step confidence sorts last, never as 0); ties break on composite, then submission position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"],
                            "default": "composite"
                        }
                    },
                    {
                        "in": "query",
                        "name": "per",
                        "description": "`molecule`: best surviving route per molecule. `route`: every surviving route.",
                        "schema": {
                            "type": "string",
                            "enum": ["molecule", "route"],
                            "default": "molecule"
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_molecules",
                        "description": "Only list building blocks used by at least this many molecules. Default 2.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 2
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "description": "Maximum building blocks listed. Default 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000,
                            "default": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Building blocks ranked by coverage",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "lens_digest": {
                                            "type": "string"
                                        },
                                        "computed_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "unsupported_filters": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "match": {
                                            "type": "string",
                                            "enum": ["canonical_smiles", "exact_smiles"]
                                        },
                                        "match_note": {
                                            "type": "string"
                                        },
                                        "canonicaliser": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "uncanonicalised_leaf_count": {
                                            "type": "integer"
                                        },
                                        "molecules_considered": {
                                            "type": "integer",
                                            "description": "Molecules with at least one surviving route; the denominator of `share`."
                                        },
                                        "molecules_without_surviving_routes": {
                                            "type": "integer"
                                        },
                                        "truncated": {
                                            "type": "boolean"
                                        },
                                        "truncation": {
                                            "type": "object"
                                        },
                                        "distinct_building_blocks": {
                                            "type": "integer"
                                        },
                                        "shared_building_blocks": {
                                            "type": "integer"
                                        },
                                        "building_blocks": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "rank": {
                                                        "type": "integer"
                                                    },
                                                    "smiles": {
                                                        "type": "string"
                                                    },
                                                    "molecules": {
                                                        "type": "integer"
                                                    },
                                                    "routes": {
                                                        "type": "integer"
                                                    },
                                                    "share": {
                                                        "type": "number"
                                                    },
                                                    "molecule_refs": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "position": {
                                                                    "type": "integer"
                                                                },
                                                                "task_id": {
                                                                    "type": "string"
                                                                },
                                                                "target_smiles": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "building_blocks_truncated": {
                                            "type": "boolean"
                                        },
                                        "shared_intermediates": {
                                            "type": "object",
                                            "properties": {
                                                "available": {
                                                    "type": "boolean"
                                                },
                                                "reason": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid parameter"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch, view or custom profile not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to analyse"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/pareto": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "batchPareto",
                "summary": "Pareto front and weighted multi-objective trade-offs across a batch's molecules",
                "description": "Each molecule's best surviving route under one lens, its Pareto front (1 = no other molecule beats it on all chosen objectives and strictly on one; front 2 is what remains once front 1 is removed, and so on), and its objective values.\n\nFree and read-only: computed on request from precomputed per-route summaries (never a run's contents) and recorded at zero price. Access is the same as `/v2/batch/{job_id}/ranked`: only the key's owner, 404 for anyone else, 401 for a revoked key, 410 for a stateless batch.\n\n**Objectives.** `objectives` is 2 to 4 comma-separated keys from a fixed allow-list, each optionally `key:max` or `key:min` (default shown in `available_objectives`): `composite` (max), `step_count` (min), `leaf_count` (min), `depth` (min), and the scored dimensions `route-confidence`, `scalability`, `material-accessibility`, `process-viability`, `harness-confidence`, `domestic-accessibility` (max). Staff accounts see further internal efficiency dimensions; they are not available to other callers.\n\n**Unknown is never imputed.** A molecule whose best route has no score for a chosen objective (an unknown dimension) is not placed on any front. It is listed in `not_comparable` with `missing[]` giving the objective and the reason, and counted in `not_comparable_count`; nothing is filled in with zero or an average.\n\n**Lens.** Same parameters and resolver as `/ranked`; `unsupported_filters` lists any requested filter that was NOT applied. The response echoes `lens_digest` and `computed_at`. The representative route of a molecule is its first route under `rank_by`; `per` does not change it and the objectives do not choose it.\n\n**Algorithm and bound.** `algorithm` states the method: non-dominated sort by lexicographic order and dominator rank, O(n log n + n^2 * d) time and O(n) extra memory. At most 5000 molecules (first by batch position) are analysed; `truncated` and `truncation` say so. `points` lists comparable molecules by front then batch position, up to `limit`; `points_truncated` says if cut. `normalisation` describes how a weighted score should scale axes (min-max, direction-aware); the endpoint itself returns raw values.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "objectives",
                        "required": true,
                        "description": "2 to 4 objective keys, comma-separated, each optionally `key:max` or `key:min`. Example: `composite:max,step_count:min`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "description": "Built-in scoring profile id (discovery, medicinal, process, computational, materials, green, educational). Omit for platform defaults. Not with `custom_profile_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "custom_profile_id",
                        "description": "One of your own custom scoring profiles. Its bundled filters apply too, or appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "view_id",
                        "description": "A saved view you can read. Its filters apply; ones the server cannot apply appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_reaction_type",
                        "description": "Drop routes with a step of this reaction type. Repeatable.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_hazard",
                        "description": "Drop routes carrying a hazard flag of this severity or worse.",
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_smiles",
                        "description": "Drop routes using this exact SMILES as a starting material. Repeatable. Not a substructure search.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_patent_risk",
                        "description": "Not applied yet: patent risk is not computed for batch routes. Accepted and reported in `unsupported_filters`.",
                        "schema": {
                            "type": "string",
                            "enum": ["low", "moderate", "high"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_composite",
                        "description": "Drop routes whose composite under this lens is below it.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10
                        }
                    },
                    {
                        "in": "query",
                        "name": "rank_by",
                        "description": "What to rank on. Counts rank fewer-first; `weakest_step` ranks the route whose lowest per-step model confidence is highest first (a route with no step confidence sorts last, never as 0); ties break on composite, then submission position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"],
                            "default": "composite"
                        }
                    },
                    {
                        "in": "query",
                        "name": "per",
                        "description": "`molecule`: best surviving route per molecule. `route`: every surviving route.",
                        "schema": {
                            "type": "string",
                            "enum": ["molecule", "route"],
                            "default": "molecule"
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "description": "Most comparable molecules listed in `points` (default 1000, max 5000). Fronts are computed over all analysed molecules regardless.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 5000,
                            "default": 1000
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Pareto fronts and objective values",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "lens_digest": {
                                            "type": "string"
                                        },
                                        "computed_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "profile": {
                                            "type": "object"
                                        },
                                        "view_id": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "filters_applied": {
                                            "type": "object"
                                        },
                                        "unsupported_filters": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "completed_of_total": {
                                            "type": "object"
                                        },
                                        "partial": {
                                            "type": "boolean"
                                        },
                                        "lens_note": {
                                            "type": "string"
                                        },
                                        "available_objectives": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "default_direction": {
                                                        "type": "string",
                                                        "enum": ["max", "min"]
                                                    }
                                                }
                                            }
                                        },
                                        "objectives": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "direction": {
                                                        "type": "string",
                                                        "enum": ["max", "min"]
                                                    }
                                                }
                                            }
                                        },
                                        "algorithm": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": "string"
                                                },
                                                "complexity": {
                                                    "type": "string"
                                                },
                                                "note": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "normalisation": {
                                            "type": "string"
                                        },
                                        "molecules_considered": {
                                            "type": "integer"
                                        },
                                        "comparable_molecules": {
                                            "type": "integer"
                                        },
                                        "not_comparable_count": {
                                            "type": "integer"
                                        },
                                        "no_surviving_routes_count": {
                                            "type": "integer"
                                        },
                                        "fronts": {
                                            "type": "integer"
                                        },
                                        "front_1_size": {
                                            "type": "integer"
                                        },
                                        "max_molecules": {
                                            "type": "integer"
                                        },
                                        "truncated": {
                                            "type": "boolean"
                                        },
                                        "truncation": {
                                            "type": "object",
                                            "properties": {
                                                "max_molecules": {
                                                    "type": "integer"
                                                },
                                                "completed_molecules": {
                                                    "type": "integer"
                                                },
                                                "analysed_molecules": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "points": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "task_id": {
                                                        "type": "string"
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "route_index": {
                                                        "type": "integer"
                                                    },
                                                    "pareto_rank": {
                                                        "type": "integer",
                                                        "minimum": 1
                                                    },
                                                    "values": {
                                                        "type": "object",
                                                        "additionalProperties": {
                                                            "type": "object",
                                                            "properties": {
                                                                "value": {
                                                                    "type": "number",
                                                                    "nullable": true
                                                                },
                                                                "reason": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "points_truncated": {
                                            "type": "boolean"
                                        },
                                        "not_comparable": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "task_id": {
                                                        "type": "string"
                                                    },
                                                    "target_smiles": {
                                                        "type": "string",
                                                        "nullable": true
                                                    },
                                                    "route_index": {
                                                        "type": "integer"
                                                    },
                                                    "values": {
                                                        "type": "object"
                                                    },
                                                    "missing": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "objective": {
                                                                    "type": "string"
                                                                },
                                                                "reason": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "not_comparable_truncated": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "objectives missing, not 2 to 4 keys, unknown, duplicated or a bad direction; or a bad limit or lens parameter"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch, view or custom profile not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to analyse"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/clusters": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "batchClusters",
                "summary": "Strategy clusters: a batch's molecules grouped by the reaction types of their best route",
                "description": "Groups a batch's molecules by how they are made. Each molecule is represented by its best surviving route under one lens (the first route under `rank_by`; `per` does not change it). Molecules whose routes use the same SET of reaction types share a cluster.\n\nFree and read-only: computed on request from precomputed per-route summaries (never a run's contents) and recorded at zero price. Access is the same as `/v2/batch/{job_id}/ranked`: only the key's owner, 404 for anyone else, 401 for a revoked key, 410 for a stateless batch.\n\n**Cluster key.** The unordered set of reaction types, compared case-insensitively. Route summaries store distinct, sorted types only, so step order and repeats are not part of the key. Reaction-type names are not a closed vocabulary: these are groupings, not classifications. `key` states the basis.\n\n**Per cluster.** `molecules` is the exact member count; `members` lists at most 50 by batch position (`members_truncated` says if cut); `median_composite` and `median_step_count` are medians over the members' best routes; `representative` is the best-ranked member. Clusters are ordered by size, then label; `clusters` is cut at `limit` and `clusters_truncated` says so.\n\n**Not available.** Grouping by key disconnection (`key_disconnection.available` is false: summaries do not record per-step disconnections) and by Bemis-Murcko target scaffold (`scaffold.available` is false: the server RDKit has no scaffold function). `by=scaffold` is a 400.\n\n**Lens.** Same parameters and resolver as `/ranked`; `unsupported_filters` lists any requested filter that was NOT applied. The response echoes `lens_digest` and `computed_at`. **Bound.** At most 5000 completed molecules (first by batch position) are analysed; `truncated` and `truncation` say so.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "profile",
                        "description": "Built-in scoring profile id (discovery, medicinal, process, computational, materials, green, educational). Omit for platform defaults. Not with `custom_profile_id`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "custom_profile_id",
                        "description": "One of your own custom scoring profiles. Its bundled filters apply too, or appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "view_id",
                        "description": "A saved view you can read. Its filters apply; ones the server cannot apply appear in `unsupported_filters`.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_reaction_type",
                        "description": "Drop routes with a step of this reaction type. Repeatable.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_hazard",
                        "description": "Drop routes carrying a hazard flag of this severity or worse.",
                        "schema": {
                            "type": "string",
                            "enum": ["warning", "danger"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "exclude_smiles",
                        "description": "Drop routes using this exact SMILES as a starting material. Repeatable. Not a substructure search.",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "style": "form",
                        "explode": true
                    },
                    {
                        "in": "query",
                        "name": "max_patent_risk",
                        "description": "Not applied yet: patent risk is not computed for batch routes. Accepted and reported in `unsupported_filters`.",
                        "schema": {
                            "type": "string",
                            "enum": ["low", "moderate", "high"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "min_composite",
                        "description": "Drop routes whose composite under this lens is below it.",
                        "schema": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 10
                        }
                    },
                    {
                        "in": "query",
                        "name": "rank_by",
                        "description": "What to rank on. Counts rank fewer-first; `weakest_step` ranks the route whose lowest per-step model confidence is highest first (a route with no step confidence sorts last, never as 0); ties break on composite, then submission position.",
                        "schema": {
                            "type": "string",
                            "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"],
                            "default": "composite"
                        }
                    },
                    {
                        "in": "query",
                        "name": "per",
                        "description": "`molecule`: best surviving route per molecule. `route`: every surviving route.",
                        "schema": {
                            "type": "string",
                            "enum": ["molecule", "route"],
                            "default": "molecule"
                        }
                    },
                    {
                        "in": "query",
                        "name": "by",
                        "description": "Only `strategy` is supported. `scaffold` is refused with 400 (not available).",
                        "schema": {
                            "type": "string",
                            "enum": ["strategy"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "description": "Most clusters to return, 1 to 1000 (default 100).",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Strategy clusters",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "lens_digest": {
                                            "type": "string"
                                        },
                                        "computed_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "profile": {
                                            "type": "object"
                                        },
                                        "view_id": {
                                            "type": "string",
                                            "nullable": true
                                        },
                                        "filters_applied": {
                                            "type": "object"
                                        },
                                        "unsupported_filters": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        },
                                        "completed_of_total": {
                                            "type": "object"
                                        },
                                        "partial": {
                                            "type": "boolean"
                                        },
                                        "lens_note": {
                                            "type": "string"
                                        },
                                        "no_surviving_routes_count": {
                                            "type": "integer"
                                        },
                                        "truncated": {
                                            "type": "boolean"
                                        },
                                        "truncation": {
                                            "type": "object",
                                            "properties": {
                                                "max_molecules": {
                                                    "type": "integer"
                                                },
                                                "completed_molecules": {
                                                    "type": "integer"
                                                },
                                                "analysed_molecules": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "by": {
                                            "type": "string",
                                            "enum": ["strategy"]
                                        },
                                        "key": {
                                            "type": "object",
                                            "properties": {
                                                "basis": {
                                                    "type": "string",
                                                    "enum": ["reaction_type_set"]
                                                },
                                                "ordered": {
                                                    "type": "boolean"
                                                },
                                                "note": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "molecules_considered": {
                                            "type": "integer"
                                        },
                                        "molecules_with_surviving_routes": {
                                            "type": "integer"
                                        },
                                        "cluster_count": {
                                            "type": "integer"
                                        },
                                        "clusters": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "reaction_types": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "molecules": {
                                                        "type": "integer"
                                                    },
                                                    "share": {
                                                        "type": "number"
                                                    },
                                                    "median_composite": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "median_step_count": {
                                                        "type": "number",
                                                        "nullable": true
                                                    },
                                                    "representative": {
                                                        "type": "object",
                                                        "properties": {
                                                            "task_id": {
                                                                "type": "string"
                                                            },
                                                            "position": {
                                                                "type": "integer"
                                                            },
                                                            "route_index": {
                                                                "type": "integer"
                                                            },
                                                            "composite": {
                                                                "type": "number"
                                                            }
                                                        }
                                                    },
                                                    "members": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "position": {
                                                                    "type": "integer"
                                                                },
                                                                "task_id": {
                                                                    "type": "string"
                                                                },
                                                                "target_smiles": {
                                                                    "type": "string",
                                                                    "nullable": true
                                                                },
                                                                "route_index": {
                                                                    "type": "integer"
                                                                },
                                                                "composite": {
                                                                    "type": "number"
                                                                },
                                                                "step_count": {
                                                                    "type": "integer"
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "members_truncated": {
                                                        "type": "boolean"
                                                    }
                                                }
                                            }
                                        },
                                        "clusters_truncated": {
                                            "type": "boolean"
                                        },
                                        "key_disconnection": {
                                            "type": "object",
                                            "properties": {
                                                "available": {
                                                    "type": "boolean",
                                                    "enum": [false]
                                                },
                                                "reason": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "scaffold": {
                                            "type": "object",
                                            "properties": {
                                                "available": {
                                                    "type": "boolean",
                                                    "enum": [false]
                                                },
                                                "reason": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "by is not strategy, or a bad limit or lens parameter"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch, view or custom profile not found (or not yours)"
                    },
                    "410": {
                        "description": "Stateless batch: nothing was retained to analyse"
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/export": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "read",
                "operationId": "exportBatch",
                "summary": "Download a batch's shortlist or ranked molecules as CSV or SDF",
                "description": "Exports either the batch's shortlist (`shortlist: true`) or every molecule the lens ranks (the default), as a CSV or SDF file. `lens` takes the `/ranked` parameters (`profile`, `custom_profile_id`, `view_id`, `exclude_reaction_type`, `max_hazard`, `exclude_smiles`, `max_patent_risk`, `min_composite`, `rank_by`, `per`); a shortlist export is ranked under that lens and keeps its lens rank, and a shortlisted molecule with no surviving route is listed with `status` `no_surviving_route`.\n\nColumns: rank, name, external_id, smiles, route_index, composite, composite_label, scored_dimensions, step_count, max_depth, starting_material_count, status, lens_profile, lens_filters, unsupported_filters, job_id, batch_id, run_link. `unsupported_filters` lists filters that were asked for and NOT applied. The CSV starts with two `#` comment lines: the platform version and commit stamp, and a note about hazards. SDF records carry the same fields as data fields; they have NO 2D structure (an empty molblock), so build structures from the `SMILES` field.\n\n**No hazard data is included.** Check the supplier SDS (and the sourced GHS entry) for every starting material. Route efficiency is not exported.\n\nFree, and recorded at zero price. Scoped like `/ranked`: only the key's owner (another key of the same owner works), 404 for anyone else, 410 for a stateless batch. Synchronous by default: over the row limit (5,000 rows by default) the response is 413 `export_too_large`. Send `\"async\": true` to build the file in the background instead (any size, up to the 50 MB file cap): the response is 202 `{export_id, state}`; poll `GET /api/v2/batch/{job_id}/export/{export_id}` until `ready`, then fetch its `download_url`. The async trigger is explicit, never automatic, so the 200 / 413 contract is unchanged. At most 3 exports may be queued or building per owner (429 `too_many_exports`).",
                "parameters": [{ "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } }],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["format"],
                                "properties": {
                                    "format": { "type": "string", "enum": ["csv", "sdf"] },
                                    "shortlist": {
                                        "type": "boolean",
                                        "description": "true exports the shortlist (400 `shortlist_empty` if it is empty). Default false: the lens ranking."
                                    },
                                    "lens": {
                                        "type": "object",
                                        "description": "The `/ranked` parameters. Unknown keys are a 400."
                                    },
                                    "async": {
                                        "type": "boolean",
                                        "description": "true queues a background export and answers 202 instead of the file. Default false."
                                    }
                                }
                            },
                            "example": { "format": "csv", "shortlist": true, "lens": { "profile": "process" } }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "The file, as an attachment.",
                        "content": {
                            "text/csv": { "schema": { "type": "string" } },
                            "chemical/x-mdl-sdfile": { "schema": { "type": "string" } }
                        }
                    },
                    "202": {
                        "description": "Queued (`async: true`). Poll the status endpoint.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "export_id": { "type": "string" },
                                        "state": { "type": "string", "enum": ["queued"] }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request`, or `shortlist_empty`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "401": { "$ref": "#/components/responses/Unauthorized" },
                    "404": {
                        "description": "Batch not found, or not yours.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`nothing_to_export`: no molecule survives the lens.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "`stateless_no_results`: the batch was submitted statelessly and keeps no results.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`export_too_large`: more rows than the synchronous limit. Repeat the request with `async: true`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`too_many_exports`: you already have 3 exports queued or building.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/export/{export_id}": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "getBatchExportStatus",
                "summary": "Status of an asynchronous batch export",
                "description": "State of an export queued with `async: true`: `queued`, `building`, `ready`, `failed` or `expired`. When `ready` it carries `download_url`, a link with an expiring token (about 10 minutes) scoped to this one export; fetch it with a browser or `curl -L` (no API key needed). Ask again for a fresh link while the file is kept. The file is stored in the platform database (never an object store) and its bytes are deleted at `expires_at` (24 hours after it was built by default). `failed` carries `error.code`: `too_large` (over the 50 MB size cap), `shortlist_empty`, `nothing_to_export`, `worker_timeout` or `build_failed`. Only the batch owner can read it (404 for anyone else). Treat `download_url` as a credential: do not log or share it.",
                "parameters": [
                    { "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } },
                    { "in": "path", "name": "export_id", "required": true, "schema": { "type": "string" } }
                ],
                "responses": {
                    "200": {
                        "description": "Export status.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "export_id": { "type": "string" },
                                        "batch_id": { "type": "string" },
                                        "state": {
                                            "type": "string",
                                            "enum": ["queued", "building", "ready", "failed", "expired"]
                                        },
                                        "format": { "type": "string", "enum": ["csv", "sdf"] },
                                        "shortlist": { "type": "boolean" },
                                        "row_count": { "type": "integer", "nullable": true },
                                        "size_bytes": { "type": "integer", "nullable": true },
                                        "filename": { "type": "string", "nullable": true },
                                        "created_at": { "type": "string", "format": "date-time" },
                                        "expires_at": { "type": "string", "format": "date-time", "nullable": true },
                                        "error": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "code": { "type": "string" },
                                                "message": { "type": "string" }
                                            }
                                        },
                                        "download_url": {
                                            "type": "string",
                                            "nullable": true,
                                            "description": "Only when `ready`."
                                        },
                                        "download_url_expires_at": {
                                            "type": "string",
                                            "format": "date-time",
                                            "nullable": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": { "$ref": "#/components/responses/Unauthorized" },
                    "404": {
                        "description": "Export not found, or not yours.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/export/{export_id}/download": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "get": {
                "x-key-scope": "read",
                "operationId": "downloadBatchExport",
                "summary": "Download a finished asynchronous batch export",
                "description": "The file itself, as an attachment, identical to what the synchronous export returns. Authenticated by the `token` in the `download_url` from the status endpoint (HMAC-signed, expires in about 10 minutes, valid for this one export and its owner only), not by an API key. A missing, tampered, expired or other-export token is 404. 410 once the file has expired. Never log the URL.",
                "security": [],
                "parameters": [
                    { "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } },
                    { "in": "path", "name": "export_id", "required": true, "schema": { "type": "string" } },
                    { "in": "query", "name": "token", "required": true, "schema": { "type": "string" } }
                ],
                "responses": {
                    "200": {
                        "description": "The file, as an attachment.",
                        "content": {
                            "text/csv": { "schema": { "type": "string" } },
                            "chemical/x-mdl-sdfile": { "schema": { "type": "string" } }
                        }
                    },
                    "404": {
                        "description": "Bad, expired or mismatched token, or no such export.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "`export_expired`: the file was deleted at its TTL.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/handoff": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "handoffBatch",
                "summary": "Hand a batch's shortlist to a project",
                "description": "Files every shortlisted run (`shortlist: true`) or the runs in `job_ids` into `project_id`, optionally into `folder_id` and `stage_id`, assigns one chemist (`assignee_user_id`) and leaves one `comment` on each run.\n\n**Same rules as `PATCH /v1/jobs/{id}`.** Each run is moved by the function behind that route, so every per-run access check is the app's own: a filed run moves only by `moveRunToProject`'s rules, a stage that needs approval opens a decision and does not move the run until that decision is approved. Stage is a second step after the project move, so a run can be filed and still refused its stage; the report then shows where it is.\n\n**Partial failure.** The call answers 200 with one entry per run: `moved`, `pending_approval` (with `decision_id` and `requested_stage_id`) or `refused` (with the `PATCH /v1/jobs/{id}` `code`, or `job_not_found` for an id that is not in this batch). Nothing is reported moved that did not move.\n\n**Assignee.** Must already be the project's owner or a member, else 400 `assignee_not_member` and nothing is moved. The assigned route is each molecule's best route under `lens` (the `/ranked` parameters; default profile otherwise); a molecule with no surviving route is reported `assignment: skipped_no_route`.\n\n**Idempotent.** Sending the same handoff again adds no comment (identical text on a run by you is posted once), no assignment (already on that route to that person) and no decision (an open one is reused).\n\nAt most 200 runs per request (413 `handoff_too_large`). Scoped like `/ranked`: only the key's owner (404 for anyone else), 410 for a stateless batch; a stateless key files nothing (400). Free, recorded at zero price. Organization model only. The ZIP package (shortlist CSV and SDF plus README) is a download on the batch page; it carries no hazard data.",
                "parameters": [{ "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } }],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["project_id"],
                                "properties": {
                                    "shortlist": {
                                        "type": "boolean",
                                        "description": "true: the batch's shortlist (400 `shortlist_empty` if empty). Send this or `job_ids`."
                                    },
                                    "job_ids": {
                                        "type": "array",
                                        "items": { "type": "string" },
                                        "minItems": 1,
                                        "description": "Named runs of this batch. Send this or `shortlist`."
                                    },
                                    "project_id": { "type": "string" },
                                    "folder_id": { "type": "string", "nullable": true },
                                    "stage_id": { "type": "string", "nullable": true },
                                    "assignee_user_id": { "type": "string" },
                                    "comment": { "type": "string", "maxLength": 3500 },
                                    "lens": {
                                        "type": "object",
                                        "description": "The `/ranked` parameters; picks which route is assigned."
                                    }
                                }
                            },
                            "example": {
                                "shortlist": true,
                                "project_id": "clx...",
                                "stage_id": "clx...",
                                "assignee_user_id": "clx...",
                                "comment": "Please start with these."
                            }
                        }
                    }
                },
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "A per-run report. Some or all runs may be refused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "batch_id": { "type": "string" },
                                        "project_id": { "type": "string" },
                                        "folder_id": { "type": "string", "nullable": true },
                                        "stage_id": { "type": "string", "nullable": true },
                                        "assignee_user_id": { "type": "string", "nullable": true },
                                        "summary": {
                                            "type": "object",
                                            "properties": {
                                                "total": { "type": "integer" },
                                                "moved": { "type": "integer" },
                                                "pending_approval": { "type": "integer" },
                                                "refused": { "type": "integer" }
                                            }
                                        },
                                        "results": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "job_id": { "type": "string" },
                                                    "status": {
                                                        "type": "string",
                                                        "enum": ["moved", "pending_approval", "refused"]
                                                    },
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Why a run was refused."
                                                    },
                                                    "message": { "type": "string" },
                                                    "decision_id": {
                                                        "type": "string",
                                                        "description": "The open stage-approval decision."
                                                    },
                                                    "requested_stage_id": { "type": "string" },
                                                    "placement": {
                                                        "type": "object",
                                                        "properties": {
                                                            "project_id": { "type": "string", "nullable": true },
                                                            "folder_id": { "type": "string", "nullable": true },
                                                            "stage_id": { "type": "string", "nullable": true }
                                                        }
                                                    },
                                                    "assignment": {
                                                        "type": "string",
                                                        "enum": [
                                                            "assigned",
                                                            "already_assigned",
                                                            "skipped_no_route",
                                                            "refused"
                                                        ]
                                                    },
                                                    "comment": {
                                                        "type": "string",
                                                        "enum": ["posted", "already_posted", "refused"]
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request`, `shortlist_empty`, `assignee_not_member` or `project_not_applicable` (stateless key).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "401": { "$ref": "#/components/responses/Unauthorized" },
                    "404": {
                        "description": "Batch not found or not yours, or `project_not_found`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "410": {
                        "description": "`stateless_no_results`: the batch keeps no results.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`handoff_too_large`: more than 200 runs.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/targets": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "appendBatchTargets",
                "summary": "Append a chunk of targets to a chunked batch",
                "description": "Up to 1,000 targets per call, to a batch in state `ingesting`. **Idempotent on `chunk_index`**: sending the same chunk again returns what the first call stored (`replayed: true`, 200); a different chunk under a used index is 409 `chunk_conflict`. Send chunks in any order; runs are made in `chunk_index`, then list, order.\n\nEach target is validated with the same validator inline `POST /api/v2/batch` uses (a non-empty string of at most 2,048 characters; there is no server-side structure parse on this path). A target that fails is stored as `invalid` with an error code, not refused with the chunk. **Duplicates are by exact SMILES string within the batch** (no canonicalisation, so `CCO` and `OCC` are two targets); the first wins and later copies are stored as `duplicate`.\n\n**Projects.** A target is filed in its own `project_id`/`folder_id`, else the batch's, else the key's default project, with the same rules and error codes as inline submit; a target that cannot be filed there is `invalid` with that code (for example `project_not_found`).\n\nOnly the key that created the batch may append (403 `wrong_key` for another key of the same owner). Stateless keys: 400 `stateless_not_supported`. After seal or cancel: 409 `batch_not_ingesting`. A batch holds at most 100,000 targets (413 `batch_too_large`).",
                "parameters": [{ "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } }],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["chunk_index", "targets"],
                                "properties": {
                                    "chunk_index": { "type": "integer", "minimum": 0, "maximum": 99999 },
                                    "targets": {
                                        "type": "array",
                                        "minItems": 1,
                                        "maxItems": 1000,
                                        "items": {
                                            "oneOf": [
                                                { "type": "string", "description": "A SMILES string." },
                                                {
                                                    "type": "object",
                                                    "required": ["smiles"],
                                                    "additionalProperties": false,
                                                    "properties": {
                                                        "smiles": { "type": "string" },
                                                        "external_id": {
                                                            "type": "string",
                                                            "maxLength": 256,
                                                            "description": "Your id, echoed in the validation report."
                                                        },
                                                        "name": { "type": "string", "maxLength": 256 },
                                                        "project_id": { "type": "string", "nullable": true },
                                                        "folder_id": { "type": "string", "nullable": true }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            },
                            "example": {
                                "chunk_index": 0,
                                "targets": ["CCO", { "smiles": "CC(=O)Oc1ccccc1C(=O)O", "external_id": "cmpd-0042" }]
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Chunk stored.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": { "type": "string" },
                                        "chunk_index": { "type": "integer" },
                                        "replayed": { "type": "boolean" },
                                        "chunk": {
                                            "type": "object",
                                            "properties": {
                                                "accepted": { "type": "integer" },
                                                "invalid": { "type": "integer" },
                                                "duplicate": { "type": "integer" }
                                            }
                                        },
                                        "totals": {
                                            "type": "object",
                                            "properties": {
                                                "accepted": { "type": "integer" },
                                                "invalid": { "type": "integer" },
                                                "duplicate": { "type": "integer" },
                                                "pending": { "type": "integer" },
                                                "materialised": { "type": "integer" },
                                                "cancelled": { "type": "integer" }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "chunk_index": 0,
                                    "replayed": false,
                                    "chunk": { "accepted": 998, "invalid": 1, "duplicate": 1 },
                                    "totals": {
                                        "accepted": 998,
                                        "invalid": 1,
                                        "duplicate": 1,
                                        "pending": 998,
                                        "materialised": 0,
                                        "cancelled": 0
                                    }
                                }
                            }
                        }
                    },
                    "200": { "description": "Replay of a chunk already stored: the same counts, nothing written." },
                    "400": {
                        "description": "Malformed body or target, or stateless key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked API key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`wrong_key`: append with the key that created the batch. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No chunked batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`chunk_conflict` or `batch_not_ingesting`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`batch_too_large`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "x-key-scope": "read",
                "operationId": "listBatchTargets",
                "summary": "Validation report for a chunked batch",
                "description": "One row per target in submission order (`chunk_index`, then `ordinal`), with its state and, for `invalid` and `duplicate`, an error code. **No SMILES are returned**; identify rows by `chunk_index` + `ordinal` or your `external_id`. `position` is `chunk_index x 1000 + ordinal`, the same number per-molecule callbacks carry in `batch.position`. A `materialised` row carries the run's `task_id` while you can still read that run.\n\nStates: `pending` (accepted, not yet a run), `materialised` (a run exists), `invalid`, `duplicate`, `cancelled`. Readable by any key of the batch's owner, as with other batch reads.",
                "parameters": [
                    { "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } },
                    {
                        "in": "query",
                        "name": "state",
                        "schema": {
                            "type": "string",
                            "enum": ["pending", "invalid", "duplicate", "materialised", "cancelled"]
                        }
                    },
                    {
                        "in": "query",
                        "name": "limit",
                        "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }
                    },
                    {
                        "in": "query",
                        "name": "cursor",
                        "schema": { "type": "string" },
                        "description": "`next_cursor` from the previous page."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page of the report.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": { "type": "string" },
                                        "targets": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "chunk_index": { "type": "integer" },
                                                    "ordinal": { "type": "integer" },
                                                    "position": { "type": "integer" },
                                                    "external_id": { "type": "string", "nullable": true },
                                                    "name": { "type": "string", "nullable": true },
                                                    "state": {
                                                        "type": "string",
                                                        "enum": [
                                                            "pending",
                                                            "invalid",
                                                            "duplicate",
                                                            "materialised",
                                                            "cancelled"
                                                        ]
                                                    },
                                                    "error": {
                                                        "type": "object",
                                                        "nullable": true,
                                                        "properties": {
                                                            "code": {
                                                                "type": "string",
                                                                "description": "`invalid_smiles`, `duplicate`, `dangerous_target` or `compound_blocked` (refused by the safety check or a blacklist, at append or again when the target is made into a run), or a filing code such as `project_not_found`, `folder_not_found`, `project_required`."
                                                            },
                                                            "message": { "type": "string" }
                                                        }
                                                    },
                                                    "task_id": { "type": "string", "nullable": true },
                                                    "project_id": { "type": "string", "nullable": true },
                                                    "folder_id": { "type": "string", "nullable": true }
                                                }
                                            }
                                        },
                                        "totals": {
                                            "type": "object",
                                            "properties": {
                                                "accepted": { "type": "integer" },
                                                "invalid": { "type": "integer" },
                                                "duplicate": { "type": "integer" },
                                                "pending": { "type": "integer" },
                                                "materialised": { "type": "integer" },
                                                "cancelled": { "type": "integer" }
                                            }
                                        },
                                        "next_cursor": { "type": "string", "nullable": true }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad state, limit or cursor.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked API key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No chunked batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/upload": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "uploadBatchFile",
                "summary": "Append a CSV, SDF or SMILES file of targets to a chunked batch",
                "description": "Sends a file instead of JSON chunks. The file is parsed on our side **in memory and discarded**: it is not written to disk or a bucket, only the validated rows are stored, as `BatchTarget` rows. The rows go through the same append path as `POST /targets`, 1,000 per chunk, so validation, exact-SMILES duplicate handling, project filing and the report from `GET /targets` are identical to sending the same targets there. Chunk indexes continue after what the batch already holds, so a second file appends.\n\n**Formats.** `csv`: a header row; the SMILES column is the first header named `smiles`, `canonical_smiles` or `isomeric_smiles` (any case), or the column named by `smiles_column`; optional `external_id` (or `id`) and `name` columns; comma, semicolon or tab separated. `smi`: one record per line, the SMILES then optional whitespace and a title (stored as `name`); blank lines and lines starting with `#` are skipped. `sdf`: one record per `$$$$`. The structure comes from a `SMILES`/`canonical_smiles`/`isomeric_smiles` data field when the record has one, taken as written, and otherwise from the molblock, converted to SMILES by server-side RDKit (canonical form). `external_id` comes from an `external_id`, `id` or `compound_id` field and `name` from a `name` field or the molblock title.\n\n**Nothing is dropped silently.** Every record becomes one target row. A record that cannot become a target is stored as `invalid` with a code and a message naming its line or record number: `missing_smiles` (empty SMILES cell), `no_structure` (an SDF record with no structure and no SMILES field), `unreadable_molblock` (RDKit could not read it), `field_too_long` (`external_id` or `name` over 256 characters). Read them with `GET /targets?state=invalid`. A file with no usable SMILES column is refused whole (400 `no_smiles_column`, 400 `smiles_column_not_found`).\n\n**Limits.** At most 8 MiB and 25,000 rows per file by default (413 `file_too_large`, 413 `too_many_rows`; the response carries `max_bytes` and `max_rows`; a deployment can change them with `BATCH_UPLOAD_MAX_BYTES` and `BATCH_UPLOAD_MAX_ROWS`). A batch holds at most 100,000 targets in all (413 `batch_too_large`); for larger sets send chunks to `POST /targets`.\n\nOnly the key that created the batch may upload (403 `wrong_key` for another key of the same owner; another user's batch is 404). Stateless keys: 400 `stateless_not_supported`. After seal or cancel: 409 `batch_not_ingesting`.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": ["file", "format"],
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "The file, UTF-8 text."
                                    },
                                    "format": {
                                        "type": "string",
                                        "enum": ["csv", "sdf", "smi"]
                                    },
                                    "smiles_column": {
                                        "type": "string",
                                        "description": "csv only: the header of the SMILES column, when it is not one of the names above."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "File read and its rows appended.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "format": {
                                            "type": "string",
                                            "enum": ["csv", "sdf", "smi"]
                                        },
                                        "rows": {
                                            "type": "integer",
                                            "description": "Records in the file; one target row each."
                                        },
                                        "chunks": {
                                            "type": "integer"
                                        },
                                        "unreadable": {
                                            "type": "integer",
                                            "description": "Of the rows, how many were refused at parse and stored as `invalid`."
                                        },
                                        "totals": {
                                            "type": "object",
                                            "properties": {
                                                "accepted": {
                                                    "type": "integer"
                                                },
                                                "invalid": {
                                                    "type": "integer"
                                                },
                                                "duplicate": {
                                                    "type": "integer"
                                                },
                                                "pending": {
                                                    "type": "integer"
                                                },
                                                "materialised": {
                                                    "type": "integer"
                                                },
                                                "cancelled": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "format": "csv",
                                    "rows": 5000,
                                    "chunks": 5,
                                    "unreadable": 2,
                                    "totals": {
                                        "accepted": 4890,
                                        "invalid": 4,
                                        "duplicate": 106,
                                        "pending": 4890,
                                        "materialised": 0,
                                        "cancelled": 0
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid multipart body, unknown `format`, no SMILES column, an empty file, or a stateless key (`stateless_not_supported`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`wrong_key`: another key of the same owner created this batch. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Batch not found.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`batch_not_ingesting`: the batch is sealed or cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "`file_too_large`, `too_many_rows` or `batch_too_large`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "string"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/seal": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "sealBatch",
                "summary": "Estimate and start a chunked batch",
                "description": "Writes the estimate onto the batch, moves it from `ingesting` to `queued`, and makes accepted targets into runs through the same admission inline submit uses: the key's spend caps (daily and monthly, and a sandbox key's run quota), your plan's run queue (or a partner key's agreed concurrency, queue and daily run cap) and, with projects, the filing check.\n\n**At most what admission accepts now is made into runs** (and at most 1,000 per seal); the rest stay `pending`, `held_reason` says why, and the status endpoint reports them under `counts.pending`. Pending targets are not queued runs and do not count against your queue. The batch feeder then makes pending targets into runs as your queue frees (checked every minute, through the same admission, at most 50 per batch per minute, batches taking turns), until none are left, the batch is paused, or it reaches its own `spend_cap_cents`. If not even one target can be admitted, the seal is refused (402 `spend_cap_exceeded`, 429 `capacity`) and the batch stays `ingesting` so you can retry.\n\n**Batch spend cap.** With `spend_cap_cents` set at create, seal makes at most what fits under it. If not even one run fits, the batch is sealed `paused` (`paused_reason: \"spend_cap\"`, `batch.paused` fires) so you can raise the cap with `/resume`.\n\n**`dry_run=true`** (query or body) returns the same estimate and how many would be made into runs now, and changes nothing.\n\nOnly the key that created the batch may seal it (403 `wrong_key`).",
                "parameters": [
                    { "in": "path", "name": "job_id", "required": true, "schema": { "type": "string" } },
                    { "in": "query", "name": "dry_run", "schema": { "type": "boolean", "default": false } }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": { "type": "object", "properties": { "dry_run": { "type": "boolean" } } }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Sealed.",
                        "content": {
                            "application/json": {
                                "schema": { "$ref": "#/components/schemas/BatchSealResponse" },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "dry_run": false,
                                    "state": "queued",
                                    "materialised": 105,
                                    "pending": 893,
                                    "held_reason": "Queue full. ...",
                                    "estimate": {
                                        "run_count": 998,
                                        "invalid_count": 1,
                                        "duplicate_count": 1,
                                        "unit_price_usd": 0.5,
                                        "estimated_cost_usd": 499,
                                        "currency": "USD",
                                        "eta": null,
                                        "eta_reason": "not_measured",
                                        "note": "Indicative. Billed per completed run at the price in force when it runs; the invoice is authoritative.",
                                        "computed_at": "2026-11-14T12:05:00.000Z"
                                    }
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "Dry run: the estimate; nothing changed.",
                        "content": {
                            "application/json": { "schema": { "$ref": "#/components/schemas/BatchSealResponse" } }
                        }
                    },
                    "400": {
                        "description": "`no_targets`, or a stateless key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid or revoked API key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "`spend_cap_exceeded`: not even one run fits the key's caps.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`wrong_key`, worker approval required, or a partner key with no agreed limits. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No chunked batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`batch_not_ingesting`: already sealed or cancelled.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "`capacity`: your queue has no room for even one run.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "The retrosynthesis worker is unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": { "error": { "type": "string" }, "message": { "type": "string" } }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/pause": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "pauseBatch",
                "summary": "Pause a chunked batch",
                "description": "Stops making the batch's pending targets into runs. Runs already made (queued or running) continue and finish. Idempotent: pausing a paused batch returns it unchanged, with its existing `paused_reason`. Fires `batch.paused` once per pause (gated on your organization's outbound-webhooks setting).\n\nOnly the API key that created the batch may pause it (403 `wrong_key` for another key of the same owner, which can still read it). A batch that is not yours is 404. Only chunked batches can be paused (409 `not_pausable` for an inline batch, whose runs were all made at submit).",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paused.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlResponse"
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "state": "paused",
                                    "paused_reason": "user",
                                    "spend_cap_cents": null,
                                    "spent_cents": 10500,
                                    "pending": 893
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "`wrong_key`: not the key that created the batch. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`not_pausable` (an inline batch) or `batch_not_running` (still ingesting, or cancelled).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/resume": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "resumeBatch",
                "summary": "Resume a chunked batch, optionally raising its spend cap",
                "description": "Resumes a paused batch; the feeder continues it within about a minute. `spend_cap_cents` sets the batch's own cap first, in the same update: this is how a cap is raised after a `spend_cap` pause (`null` removes the cap). A batch whose cap leaves no room for one more run is not resumed (409 `spend_cap_reached`), so a resume never bounces straight back into a pause. On a batch that is running, `spend_cap_cents` just updates the cap.\n\nThe key's own daily and monthly caps still apply on top: when they are reached the batch waits (it is not paused) and continues when they reset.\n\nOnly the API key that created the batch may resume it.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "spend_cap_cents": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1000000000,
                                        "nullable": true,
                                        "description": "The new batch spend cap in cents, or null for none. Omit to leave it unchanged."
                                    }
                                }
                            },
                            "example": {
                                "spend_cap_cents": 50000
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Resumed (or cap updated).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlResponse"
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "state": "queued",
                                    "paused_reason": null,
                                    "spend_cap_cents": 50000,
                                    "spent_cents": 25000,
                                    "pending": 893
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request`: spend_cap_cents is not a whole number of cents in range, or null; or the body is not a JSON object.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "`wrong_key`: not the key that created the batch. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`spend_cap_reached` (raise spend_cap_cents), `not_pausable` (an inline batch) or `batch_not_running` (still ingesting, or cancelled).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/retry": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "retryBatch",
                "summary": "Retry a chunked batch's failed runs",
                "description": "Puts the batch's failed (and rejected) runs back as pending targets, at the same position with the same structure. The batch feeder then runs them again under the same admission and caps as any target, including the batch's `spend_cap_cents`. EMPTY results (the model found no route) are an answer, not a failure, and are not retried; cancelled runs are not either.\n\nThe failed run leaves the batch, so status, counts and results describe the new attempt; the run itself stays in your history. A batch that had finished becomes `running` again and sends `batch.completed` again when the retried runs finish. A paused batch's retried targets wait for `/resume`.\n\nUp to 1,000 per call; `more: true` means call again. Only the API key that created the batch may retry it. Chunked batches only.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Failed runs put back.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "job_id": {
                                            "type": "string"
                                        },
                                        "retried": {
                                            "type": "integer"
                                        },
                                        "more": {
                                            "type": "boolean"
                                        },
                                        "state": {
                                            "type": "string",
                                            "enum": ["queued", "paused"]
                                        }
                                    },
                                    "required": ["job_id", "retried", "more", "state"]
                                },
                                "example": {
                                    "job_id": "cm9batch002",
                                    "retried": 12,
                                    "more": false,
                                    "state": "queued"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "`wrong_key`: not the key that created the batch. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No batch with this id belongs to the key's owner.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`not_pausable` (an inline batch) or `batch_not_running` (still ingesting, or cancelled).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BatchControlError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v2/batch/{job_id}/cancel": {
            "servers": [
                {
                    "url": "https://platform.synovai.net",
                    "description": "Production root. Batch is on /api/v2, NOT under this document's /api/v1 default, so the full URL is https://platform.synovai.net/api/v2/batch. Absolute first so an imported spec works in Postman and codegen without editing a host in."
                },
                {
                    "url": "/",
                    "description": "Relative root, for the same-origin interactive docs."
                }
            ],
            "post": {
                "x-key-scope": "write",
                "operationId": "cancelBatch",
                "summary": "Cancel pending children of a batch",
                "description": "Marks every still-QUEUED child task as CANCELLED. Tasks already running or terminal are left alone.\n\nFor a chunked batch this also cancels every `pending` target (`cancelled_targets` in the response) and closes ingestion. A paused batch can be cancelled. Any key of the owner may cancel.",
                "parameters": [
                    {
                        "in": "path",
                        "name": "job_id",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "Cancel processed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "Batch job not found"
                    }
                }
            }
        },
        "/deeplink": {
            "servers": [
                {
                    "url": "/",
                    "description": "Absolute root \u2014 overrides the /api/v1 servers default for this browser-facing path."
                }
            ],
            "get": {
                "operationId": "consumeDeepLink",
                "summary": "Consume a deep-link token + sign in",
                "description": "Paramus Provider Spec deep-link consume endpoint (browser-facing, step 2 of the handshake). Looks up the token, atomically marks it consumed (single-use), creates a NextAuth Session for the bound user, sets the session cookie, and redirects to the intent's landing path. On invalid / expired / consumed tokens, redirects to /auth-error.",
                "security": [],
                "parameters": [
                    {
                        "in": "query",
                        "name": "token",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "The single-use token returned from POST /api/v2/deep-link."
                    }
                ],
                "responses": {
                    "302": {
                        "description": "Redirect to the intent's landing path (or /auth-error on failure)"
                    }
                }
            }
        },
        "/jobs/{jobId}/analysis": {
            "get": {
                "x-key-scope": "write",
                "operationId": "getJobAnalysis",
                "summary": "Cost per kg, green metrics and scalability for a completed job",
                "description": "Everything the agreement lists as returned with every route that is not the route itself: estimated cost per kilogram (with its assumptions and whose cost base produced it), green metrics (atom economy, PMI, rating), scalability (per-step index plus the largest scale each step has literature precedent for), plus a `hazard_note` pointer: SynovAI returns no hazard assessment here (sourced GHS per material is in `data.ghs`, reproduced from PubChem with the original source named and a `verify_url`, and in `/lab-prep` `hazards_markdown`; the supplier SDS is the authority).\n\n**`data.ghs`.** One entry per distinct material across the returned routes: `smiles`, `status`, `signal_word`, `h_codes` (`code` and `statement`), `source` and `verify_url` (the PubChem page). `status` is `found`, `no_classification` (PubChem was asked and holds no GHS classification for it; this is not a statement that the material is safe) or `not_looked_up` (the lookup timed out or failed, or your team's egress policy blocks PubChem; this is NOT \"no hazards\"). The lookup runs under a 15 second deadline and never fails the response. It makes no paid call and adds no charge. SynovAI does not assess or certify hazards; the supplier SDS is the authority. Send `ghs=0` to skip it.\n\n**`data.routes[].ghs_summary`.** A per-route summary of that same lookup (no further PubChem call), built only from sourced GHS: `h_codes` and `hazard_classes`, each with the number of compounds carrying it and the `steps` they are in; `high_concern`, the compounds and steps carrying the fixed highest-concern GHS codes (carcinogenicity, germ cell mutagenicity and reproductive toxicity category 1: H340, H350, H360 and letter variants; acute toxicity category 1-2: H300, H310, H330; explosives: H200-H205, H240, H241; pyrophorics: H250), with `count` the number of highest-concern classifications summed over compounds, usable for sorting. The list is a GHS-defined ordering, not a SynovAI judgement. `coverage` says how many compounds have a GHS record (`with_record`), how many PubChem holds none for (`no_record`) and how many were not looked up or failed (`not_looked_up`); neither of the last two is a statement that a compound is safe, and a low `count` with low coverage says little about the route. `source` names PubChem (with its URL) and the original sources it cited. Absent when `ghs=0`. SynovAI does not assess or certify hazards; the supplier SDS is the authority.\n\nBilled as the route-metrics bundle, which is charged once per canonical molecule, per API key, per billing period \u2014 not per job. The molecule is the job's target (the parent structure that actually ran, after any desalting), canonicalised, with stereochemistry kept. Calling this plus /references, /convergence or /patents/check for the same molecule in the same period costs one bundle charge, whichever is called first, not several; two jobs on the same target in one period also pay one bundle. A salt sent to /patents/check is a different molecule from the neutral target its job ran (a patent query is not desalted).\n\n`scale=0` skips the demonstrated-scale tier (a literature lookup).\n\nThe route ceiling is the WEAKEST step, not the strongest: a route can only run at the scale its most limiting step supports.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "route",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "1-based route index. Omit for every route."
                    },
                    {
                        "name": "scale",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["0", "1"]
                        },
                        "description": "0 to skip the literature-derived scale tier."
                    },
                    {
                        "name": "ghs",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["0", "1"]
                        },
                        "description": "0 to skip the PubChem GHS lookup (`data.ghs`)."
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "routes": [
                                            {
                                                "route_index": 1,
                                                "target_smiles": "CC(=O)OCC",
                                                "step_count": 2,
                                                "cost_per_kg": {
                                                    "total_usd": 412.5,
                                                    "material_usd": 180.0,
                                                    "processing_usd": 200.0,
                                                    "waste_usd": 32.5,
                                                    "confidence": "rough",
                                                    "basis": "industry-average cost parameters",
                                                    "parameters_source": "industry-defaults",
                                                    "assumptions": [
                                                        "Yield defaults to 75% where the model reported none"
                                                    ],
                                                    "has_incomplete_data": false
                                                },
                                                "green_metrics": {
                                                    "atom_economy_pct": 73.2,
                                                    "estimated_pmi": 81.4,
                                                    "pmi_rating": "excellent",
                                                    "step_count": 2,
                                                    "unbalanced_steps": 0,
                                                    "atom_economy_complete": true
                                                },
                                                "scalability": {
                                                    "average_index": 7.1,
                                                    "route_ceiling": {
                                                        "tier": "kg",
                                                        "label": "Kilogram"
                                                    }
                                                },
                                                "hazard_note": "SynovAI returns no hazard assessment. Read the supplier SDS for every material; sourced GHS per material is in data.ghs and the lab-prep hazards_markdown.",
                                                "ghs_summary": {
                                                    "source": {
                                                        "name": "PubChem",
                                                        "url": "https://pubchem.ncbi.nlm.nih.gov/",
                                                        "original_sources": ["ECHA C&L Inventory"]
                                                    },
                                                    "coverage": {
                                                        "compounds": 4,
                                                        "with_record": 1,
                                                        "no_record": 1,
                                                        "not_looked_up": 2,
                                                        "resolved_fraction": 0.5,
                                                        "classified": 1
                                                    },
                                                    "high_concern": {
                                                        "count": 0,
                                                        "compounds": 0,
                                                        "groups": [],
                                                        "ordering_note": "The highest-concern list is fixed by GHS category: ... It is a GHS-defined ordering, not a SynovAI judgement."
                                                    },
                                                    "h_codes": [
                                                        {
                                                            "code": "H225",
                                                            "reported_as": [],
                                                            "hazard_class": "Flammable liquids",
                                                            "category": "2",
                                                            "statement": "Highly Flammable liquid and vapor",
                                                            "high_concern": false,
                                                            "compounds": 1,
                                                            "steps": [1],
                                                            "smiles": ["CCO"]
                                                        }
                                                    ],
                                                    "hazard_classes": [
                                                        {
                                                            "hazard_class": "Flammable liquids",
                                                            "kind": "physical",
                                                            "h_codes": ["H225"],
                                                            "compounds": 1,
                                                            "steps": [1]
                                                        }
                                                    ],
                                                    "note": "Classifications as reported by PubChem's sources; check the supplier SDS before handling. Compounds without a GHS record are not assumed safe."
                                                },
                                                "steps": [
                                                    {
                                                        "step_number": 1,
                                                        "product_smiles": "CC(=O)OCC",
                                                        "reaction_type": "Fischer esterification",
                                                        "estimated_yield": 88,
                                                        "confidence": 6.4,
                                                        "scalability_index": 7.1,
                                                        "demonstrated_scale": {
                                                            "tier": "kg",
                                                            "label": "Kilogram"
                                                        }
                                                    }
                                                ]
                                            }
                                        ],
                                        "ghs": [
                                            {
                                                "smiles": "CCO",
                                                "status": "found",
                                                "signal_word": "Danger",
                                                "h_codes": [
                                                    {
                                                        "code": "H225",
                                                        "statement": "Highly Flammable liquid and vapor"
                                                    }
                                                ],
                                                "source": "PubChem GHS Classification (original source: ECHA C&L Inventory)",
                                                "verify_url": "https://pubchem.ncbi.nlm.nih.gov/compound/702#section=Safety-and-Hazards"
                                            },
                                            {
                                                "smiles": "CC(=O)O",
                                                "status": "not_looked_up",
                                                "signal_word": null,
                                                "h_codes": [],
                                                "source": "PubChem GHS Classification",
                                                "verify_url": null
                                            }
                                        ]
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/AnalysisResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "Spend cap or quota would be exceeded."
                    },
                    "404": {
                        "description": "Job not found."
                    },
                    "409": {
                        "description": "Job not yet complete."
                    },
                    "410": {
                        "description": "Stateless key \u2014 results are not retained server-side."
                    }
                }
            }
        },
        "/jobs/{jobId}/sourcing": {
            "get": {
                "x-key-scope": "write",
                "operationId": "getJobSourcing",
                "summary": "Vendor availability, jurisdiction and purchasability for a job's compounds",
                "description": "Named suppliers with links, where each supplier is based, and whether a compound is purchasable.\n\nLeaves only by default \u2014 a route's starting materials are what a chemist orders. `all=1` includes intermediates and costs more, because it is more lookups.\n\nBilled per COMPOUND, de-duplicated: a convergent route reaching the same building block twice is one charge. The whole fan-out is checked against your spend cap BEFORE any lookup runs, so you are refused up front rather than served a partial answer.\n\nIMPORTANT: `purchasable` has THREE states. `true` = suppliers found. `false` = the supplier database answered and has no match. `null` = we do not know \u2014 this is NOT a statement about the compound. Check `lookup_error`.\n\n`null` covers TWO distinct cases, and `lookup_error` tells them apart:\n\n- an error string: the lookup ran and failed.\n- `\"not_checked\"`: we never asked. The vendor lookup is time-budgeted per call, so a large fan-out can run out of budget before every compound is reached, and the supplier circuit breaker can cut it short too. `exit_reason` on the envelope says which (`complete`, `batch-budget`, `circuit-open`, `policy_blocked`).\n\nEvery compound also carries `checked`. When `checked` is `false` the accompanying `vendor_count: 0` is an ABSENCE OF DATA, not a measurement \u2014 do not read it as \"no suppliers\". Re-request the job to pick up the skipped compounds: lookups are cached for 30 days, so the second call fills the gaps and the already-resolved compounds come back from cache.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "route",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "1-based route index. Omit for every route."
                    },
                    {
                        "name": "all",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": ["0", "1"]
                        },
                        "description": "1 to include intermediates, not just starting materials."
                    }
                ],
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/ReadOnlyKeyForbidden"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "exit_reason": "batch-budget",
                                        "compounds": [
                                            {
                                                "smiles": "CC(=O)O",
                                                "purchasable": true,
                                                "vendor_count": 64,
                                                "lookup_error": null,
                                                "resolved_negative": false,
                                                "checked": true,
                                                "vendors": [
                                                    {
                                                        "name": "Sigma-Aldrich",
                                                        "url": "https://...",
                                                        "registry_id": "A6283",
                                                        "country_code": "US",
                                                        "region": "NA"
                                                    }
                                                ],
                                                "jurisdictions": ["US", "DE"]
                                            },
                                            {
                                                "smiles": "O=C(O)/C=C/C(=O)O",
                                                "purchasable": null,
                                                "vendor_count": 0,
                                                "lookup_error": "not_checked",
                                                "resolved_negative": false,
                                                "checked": false,
                                                "vendors": [],
                                                "jurisdictions": []
                                            }
                                        ]
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/SourcingResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "Spend cap or quota would be exceeded."
                    },
                    "404": {
                        "description": "Job not found."
                    },
                    "409": {
                        "description": "Job not yet complete."
                    },
                    "410": {
                        "description": "Stateless key \u2014 results are not retained server-side."
                    }
                }
            }
        },
        "/jobs/{jobId}/lab-prep": {
            "get": {
                "x-key-scope": "read",
                "operationId": "getJobLabPrep",
                "summary": "Bench-ready preparation sheet for one route",
                "description": "The procedure as markdown, the reagent list as CSV, `hazards_markdown`, a green summary, and a de-duplicated shopping list.\n\n`hazards_markdown` carries no SynovAI hazard assessment: no severity, no alert text. For each material in the route it reproduces the GHS classification (signal word and H-codes) exactly as PubChem returned it, names the source (PubChem, and the original source it cites where recorded), links the PubChem entry to verify, and points to the supplier SDS, which is the authority. A material with no lookup result is stated as not looked up, never as safe. The markdown starts with a GHS summary table for the route (counts per H-code and GHS hazard class with the steps they are in, the fixed highest-concern GHS codes, and a coverage line: with a record, no record, not looked up or failed), built only from that PubChem data. The field name and type are unchanged.\n\nFree: this returns nothing you have not already bought \u2014 it is the route you paid to generate, formatted as a prep sheet.",
                "parameters": [
                    {
                        "name": "jobId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "route",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "1-based route index. Defaults to 1."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "ok",
                                    "data": {
                                        "job_id": "cm9abc123",
                                        "route_index": 1,
                                        "target_smiles": "CC(=O)OCC",
                                        "step_count": 2,
                                        "procedure_markdown": "## Step 1 ...",
                                        "reagent_csv": "name,smiles,role\\n...",
                                        "hazards_markdown": "# Hazards: sourced GHS and supplier SDS\\n\\n## Ethanol\\n- Steps: 1\\n- Signal word: Danger\\n- H225: Highly Flammable liquid and vapor\\n- Source: PubChem GHS Classification (original source: ECHA C&L Inventory)\\n- SDS: request from the supplier.\\n",
                                        "green_summary_markdown": "...",
                                        "shopping_list": {
                                            "reagents": ["OS(=O)(=O)O"],
                                            "solvents": ["CCO"],
                                            "catalysts": []
                                        }
                                    }
                                },
                                "schema": {
                                    "$ref": "#/components/schemas/LabPrepResponse"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "Spend cap or quota would be exceeded."
                    },
                    "403": {
                        "description": "`dangerous_target` or `compound_blocked`: a material in the route (the target, an intermediate, a starting material, or a reagent, solvent or catalyst) is refused by the safety check or a blacklist. Same codes as `/execute` returns for a target. The body is `{ \"status\": \"error\", \"code\": ..., \"error\": ... }`; the message says where in the route the material is (step and role). No prep sheet is returned and the call is not recorded as usage."
                    },
                    "404": {
                        "description": "Job not found."
                    },
                    "409": {
                        "description": "Job not yet complete."
                    },
                    "410": {
                        "description": "Stateless key \u2014 results are not retained server-side."
                    },
                    "422": {
                        "description": "`invalid_material_smiles`: a material in the route cannot be read as a structure (or a route node has no SMILES), so it cannot be checked against the safety lists; the route is refused rather than exported unchecked. `route_too_large`: the route names more distinct materials than the safety check covers. Same body shape as 403."
                    }
                }
            }
        },
        "/class/projects": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listClassProjects",
                "summary": "List the class's open projects (class chatbot keys)",
                "description": "For a class chatbot key only: the class's projects open for runs, the run types and route lengths the class allows, and (with `on_behalf_of`) how many runs the student may still start in each project (the smaller of their own and their group's remaining allowance; null = that run type is not available). Any other key is refused with `code: class_key_required`.",
                "parameters": [
                    {
                        "name": "on_behalf_of",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "email"
                        },
                        "description": "A student's email. Adds `runs_left` and `group` to each project. An email with no enrolled student returns HTTP 200 with `code: student_not_enrolled`."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Open projects, or a coded error.",
                        "content": {
                            "application/json": {
                                "example": {
                                    "status": "success",
                                    "class": {
                                        "id": "cm9class0000001",
                                        "name": "CHM 310 Organic II"
                                    },
                                    "run_types": ["predict_route", "super_sample"],
                                    "allowed_lengths": [2, 4, 7],
                                    "closes_at": "2027-05-01T00:00:00.000Z",
                                    "projects": [
                                        {
                                            "id": "cm9classproj001",
                                            "title": "Project 1: plan a route",
                                            "brief": "Choose a drug-like target and plan a synthesis.",
                                            "target_smiles": null,
                                            "opens_at": null,
                                            "due_at": "2027-02-15T05:00:00.000Z",
                                            "group_work": true,
                                            "runs_left": {
                                                "predict_route": 2,
                                                "super_sample": 1
                                            },
                                            "group": {
                                                "name": "Group 1",
                                                "locked": false
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/ClassKeyForbidden"
                    }
                }
            }
        },
        "/projects": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listProjects",
                "summary": "List the projects you can see, to file runs in",
                "description": "`fileable` is false for a viewer, and on every project for a stateless key. Archived and class projects are not listed. Paginated, in id order.",
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "`next_cursor` from the previous page."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`{ projects: [{ id, name, role, fileable }], next_cursor }`. `next_cursor` is null on the last page.",
                        "content": {
                            "application/json": {
                                "example": {
                                    "projects": [
                                        {
                                            "id": "cm_project",
                                            "name": "Kinase series",
                                            "role": "editor",
                                            "fileable": true
                                        }
                                    ],
                                    "next_cursor": null
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request`: a bad `limit`."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/projects/{project_id}/folders": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listProjectFolders",
                "summary": "List the folders you can see in a project",
                "description": "`navigation_only` true means an ancestor of a folder you can open, and it is not fileable. No hidden folders and no run counts. Unsorted is not listed: it is what no `folder_id` means, and it is fileable when `project.fileable` is.",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "name": "cursor",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "`next_cursor` from the previous page."
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`{ project: { id, name, role, fileable }, folders: [{ id, name, parent_id, navigation_only, fileable }], next_cursor }`."
                    },
                    "400": {
                        "description": "`invalid_request`: a bad `limit`."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "`project_not_found`. Not-found and no access are the same answer."
                    }
                }
            }
        },
        "/projects/{project_id}/stages": {
            "get": {
                "x-key-scope": "read",
                "operationId": "listProjectStages",
                "summary": "List a project's pipeline stages",
                "description": "The live stages, in pipeline order, for anyone on the project. Archived stages are left out: they take no runs. One page: a project has few stages.",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`{ project: { id, name, role, fileable }, stages: [Stage] }`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "project": {
                                            "type": "object"
                                        },
                                        "stages": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "kind": {
                                                        "type": "string",
                                                        "nullable": true,
                                                        "description": "The stage's meaning when it came from a template (`DESIGN`, `ROUTE_SELECTION`, ...); `CUSTOM` for one added by hand."
                                                    },
                                                    "color": {
                                                        "type": "string",
                                                        "nullable": true,
                                                        "example": "#146082"
                                                    },
                                                    "position": {
                                                        "type": "integer",
                                                        "description": "Pipeline order, from 0."
                                                    },
                                                    "requires_approval": {
                                                        "type": "boolean",
                                                        "description": "Moving a run in opens a decision instead (202 on PATCH /jobs/{jobId}); approving it moves the run. The project owner moves straight in."
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "project": {
                                        "id": "cm_project",
                                        "name": "Kinase series",
                                        "role": "editor",
                                        "fileable": true
                                    },
                                    "stages": [
                                        {
                                            "id": "cm_stage_1",
                                            "name": "Route selection",
                                            "kind": "ROUTE_SELECTION",
                                            "color": "#7c3aed",
                                            "position": 0,
                                            "requires_approval": false
                                        },
                                        {
                                            "id": "cm_stage_2",
                                            "name": "In lab queue",
                                            "kind": "IN_LAB_QUEUE",
                                            "color": "#f59e0b",
                                            "position": 1,
                                            "requires_approval": true
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "description": "`project_not_found`. Not-found, no access, archived and class projects are the same answer."
                    }
                }
            },
            "post": {
                "x-key-scope": "write",
                "operationId": "createProjectStage",
                "summary": "Add a pipeline stage to a project",
                "description": "Adds a stage at the end of the pipeline. The project owner or a non-viewer member may, as in the app. Renaming, reordering and archiving stay in the app.",
                "parameters": [
                    {
                        "name": "project_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": ["name"],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 80
                                    },
                                    "color": {
                                        "type": "string",
                                        "nullable": true,
                                        "pattern": "^#[0-9a-fA-F]{6}$"
                                    },
                                    "requires_approval": {
                                        "type": "boolean",
                                        "default": false
                                    }
                                }
                            },
                            "example": {
                                "name": "Safety review",
                                "requires_approval": true
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`{ project_id, stage: Stage }`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "project_id": {
                                            "type": "string"
                                        },
                                        "stage": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "description": "The stage's meaning when it came from a template (`DESIGN`, `ROUTE_SELECTION`, ...); `CUSTOM` for one added by hand."
                                                },
                                                "color": {
                                                    "type": "string",
                                                    "nullable": true,
                                                    "example": "#146082"
                                                },
                                                "position": {
                                                    "type": "integer",
                                                    "description": "Pipeline order, from 0."
                                                },
                                                "requires_approval": {
                                                    "type": "boolean",
                                                    "description": "Moving a run in opens a decision instead (202 on PATCH /jobs/{jobId}); approving it moves the run. The project owner moves straight in."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "`invalid_request` (a bad body or unknown field), or `project_not_applicable` from a stateless key."
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "description": "`forbidden`: a viewer, or anyone else on the project who is not its owner or a non-viewer member. A read-only key gets `key_scope_read_only` (`ReadOnlyKeyRefusal`)."
                    },
                    "404": {
                        "description": "`project_not_found`. Not-found and no access are the same answer."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "BearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "API key provided as a Bearer token in the Authorization header."
            },
            "ApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key",
                "description": "API key provided in the X-API-Key header (Paramus-compatible)."
            }
        },
        "responses": {
            "ReadOnlyKeyForbidden": {
                "description": "A read-only API key called an endpoint that spends, submits, stores, changes or moves something. Use a full key. The `X-Key-Scope: read_only` header is set too.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ReadOnlyKeyRefusal"
                        },
                        "example": {
                            "error": "key_scope_read_only",
                            "code": "key_scope_read_only"
                        }
                    }
                }
            },
            "Unauthorized": {
                "description": "Authentication failed",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ErrorResponse"
                        },
                        "example": {
                            "status": "error",
                            "error": "Missing or invalid Authorization header",
                            "code": "missing_authorization"
                        }
                    }
                }
            },
            "ClassKeyForbidden": {
                "description": "Class chatbot key refused (scope, add-on off, key no longer active).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ClassKeyRefusal"
                        },
                        "example": {
                            "status": "error",
                            "error": "This is a class chatbot key. It can only submit class runs (POST /v1/execute with on_behalf_of), read the jobs it submitted (GET /v1/jobs/{job_id}) and list the class projects (GET /v1/class/projects).",
                            "code": "class_key_scope"
                        }
                    }
                }
            }
        },
        "schemas": {
            "ReadOnlyKeyRefusal": {
                "type": "object",
                "required": ["error"],
                "description": "A read-only key refused on a write. `error` is always the machine code `key_scope_read_only`, whatever shape the endpoint's other errors use, so one check covers every route. `code` repeats it where the endpoint also sends codes; `message` is present on the refusals a handler makes itself (async export). On `/mcp` the refusal is a JSON-RPC error with the code in `error.data.code` (HTTP 403, or 200 inside a JSON-RPC batch).",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "error": {
                        "type": "string",
                        "enum": ["key_scope_read_only"]
                    },
                    "code": {
                        "type": "string",
                        "enum": ["key_scope_read_only"]
                    },
                    "message": {
                        "type": "string"
                    }
                }
            },
            "BatchEstimate": {
                "type": "object",
                "description": "Indicative estimate for a chunked batch. Priced at the calling key's effective unit price (its negotiated rate card, else its unit-price override, else list). You are billed per completed run at the price in force when it runs; the invoice is authoritative.",
                "properties": {
                    "run_count": { "type": "integer", "description": "Accepted targets still to run." },
                    "invalid_count": { "type": "integer" },
                    "duplicate_count": { "type": "integer" },
                    "unit_price_usd": { "type": "number" },
                    "estimated_cost_usd": {
                        "type": "number",
                        "description": "run_count x unit price. 0 on a sandbox key."
                    },
                    "would_cost_usd": {
                        "type": "number",
                        "description": "Sandbox keys only: what a production key with the same pricing would pay."
                    },
                    "currency": { "type": "string", "enum": ["USD"] },
                    "eta": {
                        "type": "object",
                        "nullable": true,
                        "description": "A completion-time band from MEASURED run durations: the p50 and p90 of compute time over the worker's most recent completed runs (up to 500, last 14 days), applied to this batch plus your runs already in progress at your parallel allowance (plan or partner concurrency, bounded by the pool's dispatch slots). Null when there is no reliable measurement; never a guess.",
                        "properties": {
                            "low_seconds": { "type": "integer" },
                            "high_seconds": { "type": "integer" },
                            "basis": {
                                "type": "object",
                                "properties": {
                                    "sample_size": { "type": "integer" },
                                    "window_days": { "type": "integer" },
                                    "p50_run_seconds": { "type": "integer" },
                                    "p90_run_seconds": { "type": "integer" },
                                    "parallel_runs": { "type": "integer" },
                                    "runs_ahead": { "type": "integer" },
                                    "excludes": {
                                        "type": "string",
                                        "description": "What the band does not account for."
                                    }
                                }
                            }
                        }
                    },
                    "eta_reason": {
                        "type": "string",
                        "enum": ["not_measured", "capacity_unknown"],
                        "description": "Present when eta is null. `not_measured`: fewer than 30 measured runs in the window. `capacity_unknown`: your parallel allowance could not be read (for example the spend cap refused even one run)."
                    },
                    "note": { "type": "string" },
                    "computed_at": { "type": "string", "format": "date-time" }
                },
                "required": [
                    "run_count",
                    "invalid_count",
                    "duplicate_count",
                    "unit_price_usd",
                    "estimated_cost_usd",
                    "currency",
                    "eta",
                    "note",
                    "computed_at"
                ]
            },
            "BatchControlResponse": {
                "type": "object",
                "description": "A chunked batch's pause state after `/pause` or `/resume`.",
                "properties": {
                    "job_id": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string",
                        "enum": ["queued", "paused"],
                        "description": "Stored state. `queued` means the feeder is making targets into runs; the polled `status` may read `running`."
                    },
                    "paused_reason": {
                        "type": "string",
                        "nullable": true,
                        "enum": ["user", "spend_cap", null]
                    },
                    "spend_cap_cents": {
                        "type": "integer",
                        "nullable": true
                    },
                    "spent_cents": {
                        "type": "integer"
                    },
                    "pending": {
                        "type": "integer",
                        "description": "Accepted targets not yet made into runs."
                    }
                },
                "required": ["job_id", "state", "paused_reason", "spend_cap_cents", "spent_cents", "pending"]
            },
            "BatchControlError": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "required": ["error"]
            },
            "BatchSealResponse": {
                "type": "object",
                "properties": {
                    "job_id": { "type": "string" },
                    "dry_run": { "type": "boolean" },
                    "state": { "type": "string", "enum": ["ingesting", "queued", "paused"] },
                    "paused_reason": {
                        "type": "string",
                        "enum": ["spend_cap"],
                        "description": "Present when the seal left the batch paused: its spend_cap_cents is below the price of one run."
                    },
                    "estimate": { "$ref": "#/components/schemas/BatchEstimate" },
                    "materialised": {
                        "type": "integer",
                        "description": "Dry run: how many would be made into runs now. Otherwise: how many were."
                    },
                    "pending": { "type": "integer", "description": "Accepted targets left pending." },
                    "held_reason": {
                        "type": "string",
                        "description": "Present when not every accepted target is made into a run now."
                    }
                },
                "required": ["job_id", "dry_run", "state", "estimate", "materialised", "pending"]
            },
            "BatchTemplateConfig": {
                "type": "object",
                "additionalProperties": false,
                "description": "A saved `POST /api/v2/batch` submit config plus a lens. Every field is optional; checked at save by the same rules create applies. Never holds targets. No `stage_id`: batch create cannot place runs in a pipeline stage.",
                "properties": {
                    "workflow": {
                        "type": "string",
                        "enum": ["screen_library"]
                    },
                    "input": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "Run settings only.",
                        "properties": {
                            "num_steps": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 8
                            },
                            "temperature": {
                                "type": "string",
                                "enum": ["Well-Precedented", "Standard", "Exploratory", "Novel"]
                            },
                            "deep_search": {
                                "type": "boolean"
                            },
                            "stock_filter": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "maxItems": 50
                            }
                        }
                    },
                    "project_id": {
                        "type": "string",
                        "description": "Where the batch is filed (organization model). Checked now: a project you cannot use is refused at save."
                    },
                    "folder_id": {
                        "type": "string",
                        "description": "A folder of `project_id`."
                    },
                    "spend_cap_cents": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000000000,
                        "nullable": true,
                        "description": "Applies to `mode: \"chunked\"` batches only."
                    },
                    "callback_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Checked like `callback_url` on create. Inherited only by the template's author."
                    },
                    "lens": {
                        "type": "object",
                        "additionalProperties": false,
                        "description": "The `/v2/batch/{job_id}/ranked` lens params as JSON: profile | custom_profile_id, view_id, exclude_reaction_type[], max_hazard, exclude_smiles[], max_patent_risk, min_composite, rank_by, per. Checked by the same resolver `/ranked` runs.",
                        "properties": {
                            "profile": {
                                "type": "string"
                            },
                            "custom_profile_id": {
                                "type": "string"
                            },
                            "view_id": {
                                "type": "string"
                            },
                            "exclude_reaction_type": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "max_hazard": {
                                "type": "string",
                                "enum": ["warning", "danger"]
                            },
                            "exclude_smiles": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "max_patent_risk": {
                                "type": "string",
                                "enum": ["low", "moderate", "high"]
                            },
                            "min_composite": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 10
                            },
                            "rank_by": {
                                "type": "string",
                                "enum": ["composite", "step_count", "leaf_count", "max_depth", "weakest_step"]
                            },
                            "per": {
                                "type": "string",
                                "enum": ["molecule", "route"]
                            }
                        }
                    }
                }
            },
            "BatchTemplate": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "config": {
                        "$ref": "#/components/schemas/BatchTemplateConfig"
                    },
                    "callback_url_set": {
                        "type": "boolean",
                        "description": "Only on a template shared with you: whether the author set a callback_url, which is not shown to you."
                    },
                    "shared_with_project": {
                        "type": "string",
                        "nullable": true
                    },
                    "shared_project_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "owned_by_you": {
                        "type": "boolean"
                    },
                    "author": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string",
                                "nullable": true
                            }
                        }
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "ErrorResponse": {
                "type": "object",
                "required": ["status", "error"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "error": {
                        "type": "string"
                    },
                    "code": {
                        "type": "string",
                        "description": "Stable machine-readable reason. Present on every `/execute` error body (e.g. invalid_request, invalid_json, unknown_tool, invalid_smiles, invalid_route_length, invalid_callback_url, callback_url_required, too_many_exclusions, catalog_not_found (404: `catalog_id` is not one of your catalogs), stateless_not_supported (400: `catalog_id` on a stateless key), pipeline_unavailable, spend_cap_exceeded, busy, partner_limits_not_configured (403: a partner key whose agreed run limits have not been set yet; contact SynovAI), dangerous_target and compound_blocked (403: the target, or its desalted parent, is refused by the safety check or a blacklist; nothing is created or billed), feature_required (403: the key owner's plan does not include the tool, e.g. `super_sample` below Professional), student_not_enrolled, project_closed, run_limit_reached, SUBMIT_FAILED, RESERVE_FAILED; and, from the shared API-key check, missing_authorization and invalid_api_key on 401 and rate_limit_exceeded on 429). Class chatbot keys: see `ClassRunError`. Branch on this rather than on the HTTP status so your client is correct whether or not it opts in to real status codes."
                    }
                },
                "description": "The usual error shape: human-readable prose in `error`. \ud83d\udd34 It is NOT the only shape this API returns \u2014 see `CodedErrorResponse` and `JsonRpcErrorResponse`. A handler that renders `json.error` directly will print `[object Object]` for an MCP error and a bare machine code for a capability refusal. Branch on the shape, not on the status code."
            },
            "HealthResponse": {
                "type": "object",
                "required": ["status", "database", "models", "timestamp"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "database": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "models": {
                        "type": "string",
                        "enum": ["ok", "degraded", "unreachable", "unknown"]
                    },
                    "timestamp": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "ToolParam": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string"
                    },
                    "required": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "min": {
                        "type": "integer"
                    },
                    "max": {
                        "type": "integer"
                    },
                    "enum": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "items": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string"
                            },
                            "enum": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "Tool": {
                "type": "object",
                "required": ["name", "description", "cost_per_call_usd", "params"],
                "properties": {
                    "name": {
                        "type": "string",
                        "enum": ["predict_route", "predict_route_f"]
                    },
                    "description": {
                        "type": "string"
                    },
                    "cost_per_call_usd": {
                        "type": "number"
                    },
                    "params": {
                        "type": "object",
                        "additionalProperties": {
                            "$ref": "#/components/schemas/ToolParam"
                        }
                    }
                }
            },
            "ForecastRequest": {
                "type": "object",
                "required": ["tool"],
                "properties": {
                    "tool": {
                        "type": "string",
                        "enum": ["predict_route", "predict_route_f"],
                        "description": "The tool name to get cost for"
                    }
                }
            },
            "ForecastResponse": {
                "type": "object",
                "required": ["cost_usd"],
                "properties": {
                    "cost_usd": {
                        "type": "number",
                        "description": "Cost in USD for a single call. 0 on a sandbox key."
                    },
                    "would_cost_usd": {
                        "type": "number",
                        "description": "Sandbox keys only (absent on production keys). The production price this same call would cost with this key's rate card or override, shown because `cost_usd` is 0 on a sandbox key. Display only: nothing is billed."
                    }
                }
            },
            "ExecuteRequest": {
                "type": "object",
                "required": ["tool", "params"],
                "properties": {
                    "tool": {
                        "type": "string",
                        "enum": ["predict_route", "predict_route_f", "super_sample"],
                        "description": "The tool to execute\n\n`super_sample` runs EVERY parameter permutation for one target \u2014 precedence level x route length x deep search \u2014 and merges every unique route into one job. Three axes are independently controllable: route length (`min_steps`/`max_steps` for a range, `num_steps` for one, or `lengths` for any set such as `[2, 4, 7]`), precedence (`precedence`), and deep search (`deep_search`). It is BILLED PER PERMUTATION, so the grid size is the price: 56 for the untouched default, 24 for \"2-4 steps\", 8 for \"8 steps only\", down to 1. The accepted response quotes `grid_size` and the total `cost_usd` up front. Permutations that fail are not charged, and the grid counts toward volume bands like any other route runs."
                    },
                    "callback_url": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true,
                        "description": "Where to POST the result when the job finishes.\n\n\ud83d\udd34 TOP-LEVEL, beside `tool` and `params` \u2014 NOT inside `params`. Putting it in `params` is accepted and the callback then silently never fires.\n\n**Delivery is AT MOST ONCE on this channel.** Three attempts (immediate, +1s, +5s) against a 5-second timeout, then the delivery is dropped. There is no durable retry queue, so a delivery CAN be lost \u2014 if your user is waiting on it, they wait forever. **Reconcile:** poll `GET /jobs/{jobId}` for anything still outstanding after a sensible interval. That poll, not the callback, is what actually protects you.\n\n\ud83d\udd34 **This per-job callback is NOT signed.** Treat it as a notification, not as data: on receipt, fetch the job over the API before trusting anything in it. Registered webhooks (`POST /webhooks`) ARE signed \u2014 see that endpoint."
                    },
                    "end_user_id": {
                        "type": "string",
                        "nullable": true,
                        "pattern": "^[\\w@.+\\-:]{1,128}$",
                        "description": "Attributes this run to one of YOUR end customers, for clients that cannot set a custom header. TOP-LEVEL, beside `tool` and `params` \u2014 not inside `params`.\n\nThe `X-End-User-Id` header carries the same value and WINS if both are sent. See that header for what the value may contain, what `GET /usage` and launch credits do with it, and the fact that an out-of-pattern value is dropped to null rather than refused.\n\n\u26a0\ufe0f On `POST /api/v2/batch` the field is called `user`, not `end_user_id`, and no header is read. The three surfaces spell it differently: `end_user_id` here, `user` on batch, `end_user_id` as a tool argument on `/mcp`."
                    },
                    "params": {
                        "type": "object",
                        "required": ["smiles"],
                        "properties": {
                            "smiles": {
                                "type": "string",
                                "description": "Target molecule SMILES string. Send it as a JSON string in the body (a JSON library escapes any backslash for you); never put it in a URL without percent-encoding it. See \"SMILES in URLs\" in the API description."
                            },
                            "num_steps": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 8,
                                "nullable": true,
                                "description": "Target route length the search aims for. The 2-8 range bounds the INPUT, not the output: returned routes are not strictly capped by it and have come back longer (depth 9 observed at num_steps=8). Treat it as a guide, not a guarantee.\n\n\ud83d\udd34 OPTIONAL on `predict_route`, and it DEFAULTS TO 3 \u2014 omitting it starts a billed search at 3 steps rather than returning an error, so send it explicitly unless 3 is what you want. (Through spec 1.8.0 this description said \"Required\" while the schema's `required` array listed only `smiles`; the schema was the accurate one. The in-app form for this same pipeline does require it, which is where the wording came from.) A value outside 2-8, a non-integer, or a numeric string is refused.\n\nFor `super_sample` this parameter is OPTIONAL and means something different: it PINS the sweep to one route length instead of walking 2-8, dropping the grid from 56 permutations to 8 \u2014 and the cost with it.\n\nOn `super_sample` it is the shorthand for a SINGLE length (min_steps = max_steps = n) and wins over min/max when both are given."
                            },
                            "deep_search": {
                                "default": false,
                                "description": "Enable deep search for more diverse routes\n\nOn `super_sample` this is an AXIS: pass an array to say which settings to sweep. `[true]` runs every permutation deep, `[false]` is the cheap sweep, omitted sweeps both. A plain boolean is accepted and read as a one-element array.",
                                "oneOf": [
                                    {
                                        "type": "boolean"
                                    },
                                    {
                                        "type": "array",
                                        "items": {
                                            "type": "boolean"
                                        }
                                    }
                                ]
                            },
                            "temperature": {
                                "type": "string",
                                "enum": ["Well-Precedented", "Standard", "Exploratory", "Novel"],
                                "default": "Standard",
                                "description": "Route generation temperature"
                            },
                            "stock_filter": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "enum": ["Enamine", "Buyables", "eMolecules"]
                                },
                                "nullable": true,
                                "description": "Filter routes by commercial stock availability. A hard filter in the model: a route is returned only when every starting material is in the named stock."
                            },
                            "catalog_id": {
                                "type": "string",
                                "description": "`predict_route` only. One of your own catalogs (`GET /catalogs`): personal, or shared with a team you belong to. Its contents are frozen when the job is submitted (editing the catalog later does not change this job) and applied to the routes when the result is read, on the poll and the callback. Any other id is 404 `catalog_not_found`. Refused on stateless keys (400 `stateless_not_supported`): the filter runs when a stored result is read, and a stateless key stores nothing. The catalog's SMILES are never sent to the model.\n\nMatching is on canonical SMILES (RDKit), so two spellings of one molecule match and benzene never matches cyclohexane."
                            },
                            "catalog_mode": {
                                "type": "string",
                                "enum": ["filter", "highlight"],
                                "default": "filter",
                                "description": "Needs `catalog_id`. `filter`: drop routes with a starting material outside your catalog. With `stock_filter` as well, the model has already kept only routes whose starting materials are all in that vendor stock, so every returned route counts as available (vendor OR your catalog) and none is dropped; your catalog's starting materials are still reported. `highlight`: drop nothing; report which starting materials are in your catalog."
                            },
                            "exclude_smiles": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "maxItems": 20,
                                "description": "Compounds to route around \u2014 the 'alternative routes' capability. Up to 20.\n\nIMPORTANT: this is a RE-RUN WITH POST-FILTERING, not constrained generation. The model has no exclusion constraint. Supplying this forces the Novel precedence level (the most-precedented routes are the ones most likely to reuse what you rejected), and any returned route still containing one of these compounds is dropped on the way out.\n\nThe consequence: a run with exclusions can come back with FEWER routes than usual, or none. That is the mechanism working, not a failure. The job response reports `routes_generated` and `routes_after_exclusion` so you can tell the two apart.",
                                "example": ["CC(=O)O"]
                            },
                            "min_steps": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 8,
                                "description": "`super_sample` only. Lower bound of the route-length sweep. Default 2."
                            },
                            "max_steps": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 8,
                                "description": "`super_sample` only. Upper bound of the route-length sweep. Default 8. With `min_steps` this makes the length axis a RANGE \u2014 \"2 to 4 steps\" is 3 lengths, not 7 and not 1."
                            },
                            "lengths": {
                                "type": "array",
                                "items": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 8
                                },
                                "minItems": 1,
                                "uniqueItems": true,
                                "example": [2, 4, 7],
                                "description": "`super_sample` (and, from a class chatbot key, `predict_route` with exactly ONE entry, the same as `num_steps`). An explicit SET of route lengths to sweep, for selections a range cannot express: `[4, 7, 2]` sweeps exactly lengths 2, 4 and 7 (order does not matter; duplicates are ignored). The grid is |lengths| x precedence levels x deep-search settings, so `[2, 4, 7]` at the defaults is 24 permutations. Must be a non-empty array of integers 2-8 and CANNOT be combined with `num_steps`, `min_steps` or `max_steps` — doing so is refused with `status: error`."
                            },
                            "precedence": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "enum": ["Well-Precedented", "Standard", "Exploratory", "Novel"]
                                },
                                "description": "`super_sample` only. Which precedence levels to sweep. Default: all four. Every level you leave in costs a full set of permutations, so narrow it when you already know which chemistry you trust."
                            }
                        }
                    },
                    "on_behalf_of": {
                        "type": "string",
                        "format": "email",
                        "description": "Class chatbot keys only (a key a teacher creates for a class with the class WhatSyn add-on). The email of the student the run is for. Required with a class key, and refused (`code: on_behalf_of_not_allowed`) from any other key. The student must be enrolled in the class with this email; otherwise `code: student_not_enrolled`. TOP-LEVEL, beside `tool` (also accepted inside `params`). With a class key only `predict_route` (one length: `num_steps`, or `lengths` with one entry) and `super_sample` (`lengths` or `num_steps`; every precedence level and both deep-search settings) are available; `callback_url`, `min_steps`, `max_steps`, `precedence`, `deep_search`, `exclude_smiles` and `starting_material` are refused. The run is owned by the student, filed in their group's project and never charged to the student. Refusals always carry `status: error` and a `code` (see `ClassRunError` for the full list): `invalid_request`, `invalid_smiles`, `student_not_enrolled`, `project_closed`, `class_project_required` (with `projects`), `project_locked`, `run_type_not_allowed`, `lengths_not_allowed`, `run_limit_reached` (with `limit`: `student` | `group`), `dangerous_target`, `compound_blocked`, `models_unavailable`, `submit_failed`, `addon_inactive`, `class_key_scope`, `class_busy`, `engine_busy`. A class key gets real HTTP status codes by default (400 bad input, 403 not allowed, 404 unknown student, 409 project closed or locked, 422 run limit reached, 429 busy with `Retry-After`, 500/503 our faults). With `SynovAI-Errors: legacy` every class refusal answers HTTP 200 except `class_key_scope` (403) and `class_busy` / `engine_busy` (429 with `Retry-After`), which keep their status in both modes."
                    },
                    "class_project": {
                        "type": "string",
                        "description": "Class chatbot keys only (a key a teacher creates for a class with the class WhatSyn add-on). The class project the run is for (an id from `GET /class/projects`). Optional when exactly one project is open; with several open the call is refused with `code: class_project_required` and the open projects listed."
                    },
                    "name": {
                        "type": "string",
                        "maxLength": 120,
                        "description": "Class chatbot keys only (a key a teacher creates for a class with the class WhatSyn add-on). Optional name for the run, shown to the student and teacher."
                    },
                    "project_id": {
                        "type": "string",
                        "description": "Optional. The project to file the run in. The API key owner must be able to add runs to it. List them with GET /projects. Without it the run is filed in the key's default project, \"API runs: <key label>\", which is made on first use and owned by the key owner."
                    },
                    "folder_id": {
                        "type": "string",
                        "nullable": true,
                        "description": "Optional. A subfolder of that project (or of the key's default project, without project_id) which the API key owner can open, from GET /projects/{project_id}/folders. Without it the run goes in Unsorted, which every project member can read."
                    }
                }
            },
            "ExecuteAcceptedResponse": {
                "type": "object",
                "required": ["status", "job_id", "poll_url", "cost_usd"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["accepted"]
                    },
                    "schema_version": {
                        "type": "string",
                        "example": "1.0",
                        "description": "Version of the route-tree shape (path_dicts and the TreeNode fields inside it), not of the HTTP API. Present on every response that carries routes. Minor bumps are additive and safe to ignore; a major bump changes or removes an existing field. Pin on the major if you parse the tree."
                    },
                    "job_id": {
                        "type": "string",
                        "description": "Unique job identifier for polling"
                    },
                    "poll_url": {
                        "type": "string",
                        "description": "Relative URL to poll for job status"
                    },
                    "cost_usd": {
                        "type": "number",
                        "description": "Cost charged for this execution. 0 on a sandbox key."
                    },
                    "would_cost_usd": {
                        "type": "number",
                        "description": "Sandbox keys only (absent on production keys). The production price this same call would cost with this key's rate card or override, shown because `cost_usd` is 0 on a sandbox key. Display only: nothing is billed."
                    },
                    "desalted": {
                        "type": "object",
                        "description": "Present only when the submitted `smiles` was a salt or solvate and a common counter-ion was removed, so the parent structure is what ran. Absent when nothing changed. A mixture of different compounds, a metal-containing input, or an input with no parent left is refused instead (400).",
                        "required": ["original_smiles", "submitted_smiles", "removed", "neutralized", "note"],
                        "properties": {
                            "original_smiles": {
                                "type": "string",
                                "description": "The SMILES you submitted."
                            },
                            "submitted_smiles": {
                                "type": "string",
                                "description": "The parent SMILES that was actually run."
                            },
                            "removed": {
                                "type": "array",
                                "items": { "type": "string" },
                                "description": "The counter-ions or solvates that were removed."
                            },
                            "neutralized": {
                                "type": "boolean",
                                "description": "Whether the parent was also neutralized."
                            },
                            "note": {
                                "type": "string",
                                "description": "A one-sentence human-readable summary of what was done."
                            }
                        }
                    },
                    "view_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Class runs only. Where the student (and teacher) open the result in SynovAI."
                    },
                    "project_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Class runs only. The student's group project, where all the group's runs are filed."
                    },
                    "queued": {
                        "type": "boolean",
                        "description": "true when your concurrent runs were all in use, so the job is accepted and WAITS; the scheduler starts it as one of your runs finishes. `status` is still `accepted` — there is no `status: \"queued\"` on this endpoint, and `queued` is the only field that tells you the job is waiting.\n\nHow many may wait is a property of the KEY, not of this document. A partner key waits up to the queue depth agreed for that key (`partnerMaxQueued`); any other key waits up to its plan's allowance. Past that depth the request is refused 429 `busy` with a \"Queue full\" message, which names the limit that was applied. A stateless key is never queued: it is refused 429 at the concurrency cap instead."
                    },
                    "queue_message": {
                        "type": "string",
                        "description": "Present only when `queued` is true: a human-readable note that your concurrent runs are all in use and the job will start as one finishes."
                    },
                    "end_user_id": {
                        "type": "string",
                        "nullable": true,
                        "description": "The end-user identifier this run was actually attributed to, echoed back after validation.\n\n🔑 **Compare it with what you sent.** null here after you sent an identifier means the value was outside the accepted character set or too long, so it was dropped: the run is accepted and billed, but it is attributed to nobody, it appears under `end_user_id: null` in `GET /usage`, and it consumes no launch credit. This echo is the only signal at submit time."
                    },
                    "queue_position": {
                        "type": "integer",
                        "nullable": true,
                        "description": "The job's 1-based place among the runs still waiting to start, by scheduling order rather than arrival order. Also returned (with `queued`) while `GET /jobs/{jobId}` reports `running`.\n\n⚠️ **Not guaranteed.** The key is always present in the response, but the value is null whenever `queued` is false, AND it can be null even when `queued` is true: the position is read after the job is admitted, so a job the scheduler has already started in the meantime no longer has a position to report, and a position that cannot be computed answers null rather than failing the submit. Treat it as advisory, never as a count you can poll for progress — use `GET /jobs/{jobId}` for that. Do not branch on it being present; branch on `queued`."
                    },
                    "class_project": {
                        "type": "string",
                        "description": "Class runs only. The class project the run was filed under."
                    },
                    "on_behalf_of": {
                        "type": "string",
                        "description": "Class runs only. The student's email, echoed."
                    },
                    "lengths": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        },
                        "description": "Class runs only. The route lengths run."
                    }
                }
            },
            "JobRunningResponse": {
                "type": "object",
                "required": ["status", "job_id", "created_at"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["running"]
                    },
                    "schema_version": {
                        "type": "string",
                        "example": "1.0",
                        "description": "Version of the route-tree shape (path_dicts and the TreeNode fields inside it), not of the HTTP API. Present on every response that carries routes. Minor bumps are additive and safe to ignore; a major bump changes or removes an existing field. Pin on the major if you parse the tree."
                    },
                    "job_id": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "queue_position": {
                        "type": "integer",
                        "nullable": true,
                        "description": "Class chatbot keys only. See ExecuteAcceptedResponse.queue_position."
                    },
                    "view_url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Class chatbot keys only. Where the student opens the result."
                    }
                }
            },
            "JobSuccessResponse": {
                "type": "object",
                "required": ["status", "job_id", "result", "cost_usd", "created_at", "completed_at"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["success"]
                    },
                    "schema_version": {
                        "type": "string",
                        "example": "1.0",
                        "description": "Version of the route-tree shape (path_dicts and the TreeNode fields inside it), not of the HTTP API. Present on every response that carries routes. Minor bumps are additive and safe to ignore; a major bump changes or removes an existing field. Pin on the major if you parse the tree.",
                        "x-stable": true
                    },
                    "job_id": {
                        "type": "string"
                    },
                    "result": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/RouteResult"
                            }
                        ],
                        "description": "Route trees for this job. See RouteResult / TreeNode for the field surface and which fields are designated stable."
                    },
                    "cost_usd": {
                        "type": "number",
                        "description": "Cost charged for this job. 0 on a sandbox key."
                    },
                    "would_cost_usd": {
                        "type": "number",
                        "description": "Sandbox keys only (absent on production keys). The production price this same call would cost with this key's rate card or override, shown because `cost_usd` is 0 on a sandbox key. Display only: nothing is billed."
                    },
                    "catalog": {
                        "$ref": "#/components/schemas/CatalogApplied"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "completed_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                }
            },
            "CatalogApplied": {
                "type": "object",
                "description": "Present only when the job was submitted with `catalog_id`. Also on the completion callback. Says what your own catalog did to `result`; never carries the catalog's contents.",
                "properties": {
                    "mode": {
                        "type": "string",
                        "enum": ["filter", "highlight"]
                    },
                    "catalogs": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "catalog_id": { "type": "string" },
                                "name": {
                                    "type": "string",
                                    "description": "The catalog's name when the job was submitted."
                                },
                                "content_hash": {
                                    "type": "string",
                                    "description": "`sha256:` of the frozen contents this job was judged against. Changes when the catalog is edited, for later jobs only."
                                },
                                "compound_count": { "type": "integer" },
                                "captured_at": { "type": "string", "format": "date-time" }
                            }
                        }
                    },
                    "vendor_stock": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "Vendor stocks the model was restricted to (`stock_filter`)."
                    },
                    "basis_available": {
                        "type": "boolean",
                        "description": "False when the catalog has since been deleted. Then nothing is dropped, because the job can no longer say what was in it."
                    },
                    "routes_generated": { "type": "integer" },
                    "routes_after_catalog": { "type": "integer" },
                    "kept_route_indices": {
                        "type": "array",
                        "items": { "type": "integer" },
                        "description": "1-based indices, into the result before the catalog filter, of the routes in `result`, in order."
                    },
                    "in_catalog_smiles": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "Starting materials, as the route trees write them, that are in your catalog."
                    }
                }
            },
            "JobErrorResponse": {
                "type": "object",
                "required": ["status", "job_id", "error", "created_at"],
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "schema_version": {
                        "type": "string",
                        "example": "1.0",
                        "description": "Version of the route-tree shape (path_dicts and the TreeNode fields inside it), not of the HTTP API. Present on every response that carries routes. Minor bumps are additive and safe to ignore; a major bump changes or removes an existing field. Pin on the major if you parse the tree."
                    },
                    "job_id": {
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "TreeNode": {
                "type": "object",
                "description": "One node of a retrosynthesis route tree. A node with `children` is a reaction step and its children are that step's reactants; a node without `children` is a leaf (a starting material). Walk depth-first to read a route from starting materials to target.\n\nSTABLE FIELDS (schema-stability policy): `smiles`, `children`, `route_scores`, and within `reference_metadata` the keys `internal_reference_index` and `references`. These are removed, renamed, re-typed or re-positioned only under a new `schema_version`, with 90 days' notice and both versions served for 90 days after the effective date.\n\nEvery OTHER key inside `reference_metadata` is DIAGNOSTIC: it may change without notice and should not be relied on in a production interface. Ask us to designate one as stable if you need it \u2014 designation takes effect on written confirmation.\n\nAdding fields, nodes or permitted values is never a breaking change and does not bump `schema_version`. Ignore keys you do not recognise.",
                "required": ["smiles"],
                "properties": {
                    "smiles": {
                        "type": "string",
                        "x-stable": true,
                        "description": "SMILES of the molecule at this node. STABLE.",
                        "example": "CC(=O)OCC"
                    },
                    "children": {
                        "type": "array",
                        "x-stable": true,
                        "items": {
                            "$ref": "#/components/schemas/TreeNode"
                        },
                        "description": "Reactants of the step that produces this node. Absent or empty on a leaf. STABLE."
                    },
                    "route_scores": {
                        "type": "object",
                        "x-stable": true,
                        "description": "Route-level scores, present on the root of a route. STABLE.",
                        "properties": {
                            "average_confidence": {
                                "type": "number"
                            },
                            "average_scalability": {
                                "type": "number"
                            },
                            "no_reference_count": {
                                "type": "integer",
                                "description": "Steps in the route with no literature precedent."
                            }
                        }
                    },
                    "reference_metadata": {
                        "type": "object",
                        "description": "Per-step metadata. Only `internal_reference_index` and `references` are stable; everything else here is diagnostic and may change without notice.",
                        "properties": {
                            "internal_reference_index": {
                                "type": "array",
                                "items": {
                                    "type": "integer"
                                },
                                "x-stable": true,
                                "description": "Precedent ids for this step. Resolve them with GET /jobs/{jobId}/references. STABLE."
                            },
                            "references": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "x-stable": true,
                                "description": "Reference identifiers for this step. STABLE."
                            },
                            "rxn_type": {
                                "type": "string",
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Reaction class for this step, as the model emits it. Note the spelling: the raw tree uses `rxn_type`. The derived endpoint GET /jobs/{jobId}/references normalises it to `reaction_type` in its own response; the two names refer to the same value in different payloads.",
                                "example": "Hydrogenation"
                            },
                            "est_yield": {
                                "type": "number",
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Estimated yield for the step, percent, as the model emits it: the mean of precedent yields, which is not range-checked, so a value can exceed 100. Treat anything above 100 as 100. Derived fields such as `estimated_yield` on route analysis are already capped."
                            },
                            "std_yield": {
                                "type": "number",
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Standard deviation of the yield estimate, in percentage points. Emitted alongside `est_yield` on every node that carries one, so a client can render `est_yield \u00b1 std_yield` instead of implying a point estimate."
                            },
                            "confidenceestimate": {
                                "type": "number",
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Per-step confidence, 0-10. 0 means no literature precedent was found, not that the step is impossible."
                            },
                            "scalabilityindex": {
                                "type": "number",
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Per-step scalability index, 0-10."
                            },
                            "top_reagent": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "x-stable": false,
                                "description": "DIAGNOSTIC. Reagents most frequently seen in the literature precedents retrieved for this step. Precedent-derived reference metadata, not a model-predicted procedure."
                            },
                            "top_solvent": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "x-stable": false,
                                "description": "DIAGNOSTIC. As `top_reagent`, for solvents."
                            },
                            "top_catalyst": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "x-stable": false,
                                "description": "DIAGNOSTIC. As `top_reagent`, for catalysts."
                            }
                        },
                        "additionalProperties": true
                    }
                }
            },
            "RouteResult": {
                "type": "object",
                "description": "The route payload. Routes live under `path_dicts` \u2014 note the key; it is not `trees`. STABLE.",
                "required": ["path_dicts"],
                "properties": {
                    "path_dicts": {
                        "type": "array",
                        "x-stable": true,
                        "items": {
                            "$ref": "#/components/schemas/TreeNode"
                        },
                        "description": "One entry per route, each the root TreeNode of that route. STABLE."
                    }
                },
                "additionalProperties": true
            },
            "CodedErrorResponse": {
                "type": "object",
                "description": "Returned where the reason is machine-actionable, chiefly a capability your contract excludes. `error` is a stable CODE and the prose moves to `message`. Show `message` to a human and branch on `error`.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "error": {
                        "type": "string",
                        "example": "capability_not_licensed",
                        "description": "A stable machine code."
                    },
                    "message": {
                        "type": "string",
                        "description": "Human-readable explanation."
                    }
                },
                "required": ["status", "error"]
            },
            "JsonRpcErrorResponse": {
                "type": "object",
                "description": "\ud83d\udd34 The MCP endpoint speaks JSON-RPC 2.0, so its errors do not look like the rest of the API at all: there is NO `status` field, and `error` is an OBJECT rather than a string. Read `error.message`.",
                "properties": {
                    "jsonrpc": {
                        "type": "string",
                        "enum": ["2.0"]
                    },
                    "id": {
                        "nullable": true,
                        "description": "Echoes the request id."
                    },
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
                                "example": -32600
                            },
                            "message": {
                                "type": "string"
                            }
                        },
                        "required": ["code", "message"]
                    }
                },
                "required": ["jsonrpc", "error"]
            },
            "ReactionLink": {
                "type": "object",
                "description": "One transformation connecting a node to the focal molecule. \ud83d\udd34 These keys are camelCase inside an otherwise snake_case API. That is a wart, not a typo on your side, and it is why this schema exists.",
                "properties": {
                    "reactionType": {
                        "type": "string",
                        "nullable": true
                    },
                    "routeIndices": {
                        "type": "array",
                        "items": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Route numbers containing this transformation, 1-BASED \u2014 the same numbering `route_index` reports and `?route=` accepts everywhere else in this API. Not an offset into any array. (Before spec 1.9.0 this field was 0-based; if you integrated against 1.8.0 or earlier, drop your +1.)"
                    },
                    "partnerSmiles": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Other reactants or products in the step."
                    }
                },
                "required": ["reactionType", "routeIndices", "partnerSmiles"],
                "additionalProperties": true
            },
            "ConvergenceNode": {
                "type": "object",
                "description": "A molecule that shares chemistry with the focal molecule. The published example has every array EMPTY, which made element shapes undiscoverable; this is what they contain.",
                "properties": {
                    "smiles": {
                        "type": "string"
                    },
                    "reactions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ReactionLink"
                        }
                    }
                },
                "required": ["smiles", "reactions"],
                "additionalProperties": true
            },
            "ConvergencePartner": {
                "type": "object",
                "description": "A molecule that co-occurs with the focal molecule at the same reaction step \u2014 another reactant in the same transformation, not a precursor or product of it. \ud83d\udd34 This is a DIFFERENT shape from ConvergenceNode: it carries counts, not `reactions`. The spec typed it as a ConvergenceNode through 1.8.0, which no payload ever matched; a strict validator rejected every element. Top 20 by co-occurrence.",
                "properties": {
                    "smiles": {
                        "type": "string"
                    },
                    "coOccurrenceCount": {
                        "type": "integer",
                        "description": "How many routes it co-occurs in. Always equal to `routeIndices.length`."
                    },
                    "routeIndices": {
                        "type": "array",
                        "items": {
                            "type": "integer",
                            "minimum": 1
                        },
                        "description": "Route numbers it co-occurs in, 1-BASED, as on ReactionLink."
                    }
                },
                "required": ["smiles", "coOccurrenceCount", "routeIndices"],
                "additionalProperties": true
            },
            "LaunchCredits": {
                "type": "object",
                "description": "Free successful runs granted to one of YOUR end customers (agreement \u00a74.2). Null when the row has no end user or no grant applies.",
                "properties": {
                    "granted": {
                        "type": "integer"
                    },
                    "used": {
                        "type": "integer"
                    },
                    "remaining": {
                        "type": "integer"
                    },
                    "expires_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "expired": {
                        "type": "boolean"
                    }
                },
                "required": ["granted", "used", "remaining", "expired"],
                "additionalProperties": true
            },
            "PatentRecord": {
                "type": "object",
                "description": "One patent a structure appears in.",
                "properties": {
                    "patentId": {
                        "type": "string",
                        "example": "US20210123456A1"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "assignee": {
                        "type": "string",
                        "nullable": true
                    },
                    "filingDate": {
                        "type": "string",
                        "nullable": true,
                        "description": "ISO date."
                    },
                    "jurisdiction": {
                        "type": "string",
                        "nullable": true,
                        "example": "US"
                    }
                },
                "required": ["patentId"],
                "additionalProperties": true
            },
            "PatentHit": {
                "type": "object",
                "description": "Patents found for one submitted structure. \ud83d\udd34 These keys are camelCase inside an otherwise snake_case API. That is a wart, not a typo on your side, and it is why this schema exists.",
                "properties": {
                    "smiles": {
                        "type": "string"
                    },
                    "patents": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/PatentRecord"
                        }
                    },
                    "totalCount": {
                        "type": "integer",
                        "description": "Total patents for this structure, which may exceed the records returned."
                    }
                },
                "required": ["smiles", "patents", "totalCount"],
                "additionalProperties": true
            },
            "AnalysisResponse": {
                "type": "object",
                "description": "Per-route analysis.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "routes": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": true,
                                    "properties": {
                                        "ghs_summary": {
                                            "type": "object",
                                            "description": "Sourced GHS (PubChem and the original source it cites) summarised for this route. Absent when `ghs=0`. Never a SynovAI hazard assessment; compounds without a record are not assumed safe.",
                                            "properties": {
                                                "source": {
                                                    "type": "object",
                                                    "properties": {
                                                        "name": { "type": "string", "enum": ["PubChem"] },
                                                        "url": { "type": "string" },
                                                        "original_sources": {
                                                            "type": "array",
                                                            "items": { "type": "string" }
                                                        }
                                                    }
                                                },
                                                "coverage": {
                                                    "type": "object",
                                                    "description": "Always present. `with_record + no_record + not_looked_up = compounds`. `no_record` (PubChem holds no GHS classification) and `not_looked_up` (timed out, failed or blocked by egress policy) are NOT statements that a compound is safe.",
                                                    "properties": {
                                                        "compounds": { "type": "integer" },
                                                        "with_record": { "type": "integer" },
                                                        "no_record": { "type": "integer" },
                                                        "not_looked_up": { "type": "integer" },
                                                        "resolved_fraction": {
                                                            "type": "number",
                                                            "description": "(with_record + no_record) / compounds."
                                                        },
                                                        "classified": {
                                                            "type": "integer",
                                                            "description": "Compounds with at least one H-code."
                                                        }
                                                    }
                                                },
                                                "high_concern": {
                                                    "type": "object",
                                                    "description": "The fixed GHS highest-concern list (CMR category 1: H340, H350, H360 and variants; acute toxicity category 1-2: H300, H310, H330; explosives: H200-H205, H240, H241; pyrophorics: H250). A GHS-defined ordering, not a SynovAI judgement.",
                                                    "properties": {
                                                        "count": {
                                                            "type": "integer",
                                                            "description": "Highest-concern classifications summed over compounds. Ranks fewest-first; read it with `coverage`."
                                                        },
                                                        "compounds": { "type": "integer" },
                                                        "groups": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "group": { "type": "string" },
                                                                    "label": { "type": "string" },
                                                                    "h_codes": {
                                                                        "type": "array",
                                                                        "items": { "type": "string" }
                                                                    },
                                                                    "compounds": { "type": "integer" },
                                                                    "steps": {
                                                                        "type": "array",
                                                                        "items": { "type": "integer" }
                                                                    },
                                                                    "smiles": {
                                                                        "type": "array",
                                                                        "items": { "type": "string" }
                                                                    }
                                                                }
                                                            }
                                                        },
                                                        "ordering_note": { "type": "string" }
                                                    }
                                                },
                                                "h_codes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "code": { "type": "string" },
                                                            "reported_as": {
                                                                "type": "array",
                                                                "items": { "type": "string" },
                                                                "description": "Letter variants as PubChem wrote them (e.g. H360FD)."
                                                            },
                                                            "hazard_class": { "type": "string" },
                                                            "category": { "type": "string", "nullable": true },
                                                            "statement": { "type": "string", "nullable": true },
                                                            "high_concern": { "type": "boolean" },
                                                            "compounds": { "type": "integer" },
                                                            "steps": {
                                                                "type": "array",
                                                                "items": { "type": "integer" }
                                                            },
                                                            "smiles": { "type": "array", "items": { "type": "string" } }
                                                        }
                                                    }
                                                },
                                                "hazard_classes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "hazard_class": { "type": "string" },
                                                            "kind": {
                                                                "type": "string",
                                                                "enum": ["physical", "health", "environmental", "other"]
                                                            },
                                                            "h_codes": {
                                                                "type": "array",
                                                                "items": { "type": "string" }
                                                            },
                                                            "compounds": { "type": "integer" },
                                                            "steps": { "type": "array", "items": { "type": "integer" } }
                                                        }
                                                    }
                                                },
                                                "note": { "type": "string" }
                                            }
                                        }
                                    }
                                },
                                "description": "Per-route metrics: cost, green chemistry, scalability, a hazard_note pointer, and `ghs_summary` (sourced GHS) unless `ghs=0`."
                            },
                            "ghs": {
                                "type": "array",
                                "description": "Sourced GHS per material, reproduced from PubChem (never a SynovAI assessment). Absent when `ghs=0`. `not_looked_up` is not \"no hazards\".",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "smiles": { "type": "string" },
                                        "status": {
                                            "type": "string",
                                            "enum": ["found", "no_classification", "not_looked_up"]
                                        },
                                        "signal_word": {
                                            "type": "string",
                                            "enum": ["Danger", "Warning"],
                                            "nullable": true
                                        },
                                        "h_codes": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": { "type": "string" },
                                                    "statement": { "type": "string" }
                                                }
                                            }
                                        },
                                        "source": { "type": "string" },
                                        "verify_url": { "type": "string", "nullable": true }
                                    }
                                }
                            }
                        },
                        "required": ["job_id", "routes"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "ScoredResponse": {
                "type": "object",
                "description": "Routes ranked against a scoring profile.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "profile": {
                                "nullable": true,
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                },
                                "additionalProperties": true
                            },
                            "total_routes": {
                                "type": "integer"
                            },
                            "ranked": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "weakest_step": {
                                            "type": "object",
                                            "nullable": true,
                                            "description": "The route's weakest step: the lowest per-step model confidence and which step it is. Null when no step carries a confidence (unknown, never 0). Ties go to the earlier step.",
                                            "properties": {
                                                "confidence": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 10,
                                                    "description": "The model's 0-10 confidence for that step."
                                                },
                                                "step_number": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "description": "1-based, numbered from the starting materials (step 1) to the target, as in Lab Prep and the Route Report."
                                                }
                                            }
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            },
                            "excluded": {
                                "type": "array",
                                "description": "Routes filtered out, WITH reasons, so you can tell a chemist why they are not seeing five routes.",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "route_index": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "description": "1-based route number, matching the unfiltered listing. Filtering does not renumber."
                                        },
                                        "reasons": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "additionalProperties": true
                                }
                            }
                        },
                        "required": ["job_id", "total_routes", "ranked", "excluded"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "SourcingResponse": {
                "type": "object",
                "description": "Commercial availability.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "compounds": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": true
                                },
                                "description": "Vendor availability and jurisdiction per compound. Empty when the route has no sourceable leaves."
                            }
                        },
                        "required": ["job_id", "compounds"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "ReferencesResponse": {
                "type": "object",
                "description": "Literature precedent per route.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "routes": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": true
                                }
                            }
                        },
                        "required": ["job_id", "routes"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "ConvergenceResponse": {
                "type": "object",
                "description": "Shared intermediates around a focal molecule. Requires `?smiles=`; without it this endpoint returns 400.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "focal_smiles": {
                                "type": "string"
                            },
                            "total_routes": {
                                "type": "integer"
                            },
                            "routes_containing": {
                                "type": "integer"
                            },
                            "precursors": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/ConvergenceNode"
                                }
                            },
                            "products": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/ConvergenceNode"
                                }
                            },
                            "partners": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/ConvergencePartner"
                                }
                            }
                        },
                        "required": [
                            "job_id",
                            "focal_smiles",
                            "total_routes",
                            "routes_containing",
                            "precursors",
                            "products",
                            "partners"
                        ],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "LabPrepResponse": {
                "type": "object",
                "description": "Bench-ready preparation for one route.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "job_id": {
                                "type": "string"
                            },
                            "route_index": {
                                "type": "integer",
                                "minimum": 1,
                                "description": "1-based route number \u2014 the value passed as `?route=`."
                            },
                            "target_smiles": {
                                "type": "string"
                            },
                            "step_count": {
                                "type": "integer"
                            },
                            "procedure_markdown": {
                                "type": "string"
                            },
                            "reagent_csv": {
                                "type": "string"
                            },
                            "hazards_markdown": {
                                "type": "string",
                                "description": "Markdown: sourced GHS per material (as returned by PubChem, source named) and a supplier-SDS pointer. No SynovAI severity or hazard wording."
                            },
                            "green_summary_markdown": {
                                "type": "string"
                            },
                            "shopping_list": {
                                "type": "object",
                                "properties": {
                                    "reagents": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    },
                                    "solvents": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    },
                                    "catalysts": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                },
                                "additionalProperties": true
                            }
                        },
                        "required": ["job_id", "route_index", "step_count"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "PatentCheckResponse": {
                "type": "object",
                "description": "Patent overlap for the submitted structures. \ud83d\udd34 These keys are camelCase inside an otherwise snake_case API. That is a wart, not a typo on your side, and it is why this schema exists.",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["ok"]
                    },
                    "data": {
                        "type": "object",
                        "description": "",
                        "properties": {
                            "hits": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/PatentHit"
                                }
                            },
                            "checkedCount": {
                                "type": "integer"
                            },
                            "matchCount": {
                                "type": "integer"
                            }
                        },
                        "required": ["hits", "checkedCount", "matchCount"],
                        "additionalProperties": true
                    }
                },
                "required": ["status", "data"],
                "additionalProperties": true
            },
            "ClassRunError": {
                "type": "object",
                "required": ["status", "error", "code"],
                "description": "A refusal from `POST /execute` made with a class chatbot key. `x-http-status` gives the HTTP status for each `code` in the default (`http`) mode for class keys. With `SynovAI-Errors: legacy` every code answers HTTP 200 except `class_key_scope` (403) and `class_busy` / `engine_busy` (429 with `Retry-After`). Show `error` to a person; branch on `code`.",
                "x-http-status": {
                    "class_key_scope": 403,
                    "invalid_request": 400,
                    "invalid_smiles": 400,
                    "student_not_enrolled": 404,
                    "project_closed": 409,
                    "project_locked": 409,
                    "class_project_required": 400,
                    "run_type_not_allowed": 403,
                    "lengths_not_allowed": 403,
                    "run_limit_reached": 422,
                    "class_busy": 429,
                    "engine_busy": 429,
                    "dangerous_target": 403,
                    "compound_blocked": 403,
                    "models_unavailable": 503,
                    "submit_failed": 500,
                    "addon_inactive": 403
                },
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "error": {
                        "type": "string",
                        "description": "Human-readable explanation, safe to show to the student or teacher."
                    },
                    "code": {
                        "type": "string",
                        "enum": [
                            "class_key_scope",
                            "invalid_request",
                            "invalid_smiles",
                            "student_not_enrolled",
                            "project_closed",
                            "project_locked",
                            "class_project_required",
                            "run_type_not_allowed",
                            "lengths_not_allowed",
                            "run_limit_reached",
                            "class_busy",
                            "engine_busy",
                            "dangerous_target",
                            "compound_blocked",
                            "models_unavailable",
                            "submit_failed",
                            "addon_inactive"
                        ],
                        "description": "`class_key_scope`: the tool is not `predict_route` / `super_sample`, or `on_behalf_of` is missing. `invalid_request`: missing `smiles`, a `callback_url`, a grid control a class run does not take, bad or missing lengths, or `class_project` not a string. `invalid_smiles`: the target cannot be read or desalted. `student_not_enrolled`: no enrolled student in this class has that email. `project_closed`: the class project is not open (or none is open). `class_project_required`: several projects are open; pick one from `projects`. `project_locked`: the teacher approved the group's route, so the group project is locked until reopened. `run_type_not_allowed`: the class does not allow this run type. `lengths_not_allowed`: a length outside the class's allowed set (a single run takes exactly one). `run_limit_reached`: the student's or group's limit for this run type (`limit` says which). `class_busy`: the class has its maximum runs in progress. `engine_busy`: the retrosynthesis engine is at capacity. `dangerous_target` / `compound_blocked`: the target is refused by the safety check or a blacklist. `models_unavailable`: the pipeline is not available. `submit_failed`: our fault; nothing ran. `addon_inactive`: the add-on is switched off or outside its dates."
                    },
                    "limit": {
                        "type": "string",
                        "enum": ["student", "group"],
                        "description": "`run_limit_reached` only: whose limit was reached."
                    },
                    "projects": {
                        "type": "array",
                        "description": "`class_project_required` only: the open projects to choose from.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "string"
                                },
                                "title": {
                                    "type": "string"
                                },
                                "due_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "nullable": true
                                }
                            }
                        }
                    }
                },
                "example": {
                    "status": "error",
                    "error": "No student in this class has that email. The student must join the class in SynovAI with this email first.",
                    "code": "student_not_enrolled"
                }
            },
            "ClassKeyRefusal": {
                "type": "object",
                "required": ["status", "error", "code"],
                "description": "A class chatbot key used outside its scope, or no longer allowed to act. `code`: `class_key_scope` (route or tool not available to a class key, or `on_behalf_of` missing), `addon_inactive` (the class WhatSyn add-on is off or outside its dates), `key_inactive` (the teacher who created the key no longer manages the class), `class_key_required` (`GET /class/projects` with an ordinary key).",
                "properties": {
                    "status": {
                        "type": "string",
                        "enum": ["error"]
                    },
                    "error": {
                        "type": "string",
                        "description": "Human-readable explanation."
                    },
                    "code": {
                        "type": "string",
                        "enum": ["class_key_scope", "addon_inactive", "key_inactive", "class_key_required"]
                    }
                }
            }
        }
    }
}
