{
  "openapi": "3.1.0",
  "info": {
    "title": "NMPortal API",
    "version": "0.1.0",
    "description": "The HTTP contract between the NMPortal backend and its clients \u2014 the browser\nUI and the MCP (Model Context Protocol) server.\n\n**This document is the source of truth.** Where a handler and this contract\ndisagree, the contract is right and the handler is the bug.\n\n## What is authored and what is generated\n\nAuthored here: everything under `paths/` and `components/`.\n\nGenerated: `dist/openapi.json`, the bundle every consumer of the contract\nreads. Run `make generate`; CI fails if the committed output is stale.\n\n## What this contract deliberately does not describe\n\nThe tools. Which tools exist, and what each takes, is whatever toolkits are\nregistered and active in an environment, so it is read from that\nenvironment: `GET /api/jobs/tools` lists them for the caller, and\n`GET /api/jobs/tools/openapi.json` describes each one's parameters. All of\nthem are run with `POST /api/jobs`.\n\nRoutes that are deployed but not yet described are listed, with an owner, in\n`contracts/route-exceptions.yaml`.\n"
  },
  "servers": [
    {
      "url": "/",
      "description": "Same-origin. CloudFront routes /api/* to the HTTP API, so the browser never\nmakes a cross-origin request and `apiPath` is always \"/api\".\n"
    }
  ],
  "security": [
    {
      "cognitoJwt": []
    }
  ],
  "tags": [
    {
      "name": "jobs",
      "description": "Running a registered tool, and the job lifecycle: list, poll, stop and\nread results. Tool-agnostic.\n"
    },
    {
      "name": "workflows",
      "description": "The workflows registered with this portal: sets of pages, each kept in a\nrepository of its own and registered by version.\n"
    },
    {
      "name": "documents",
      "description": "The documents registered with this portal: pages written by hand, such as\nthe user guide and Methods, each registered by version.\n"
    },
    {
      "name": "lookup",
      "description": "Single records read in the request, by an identifier the caller already\nhas.\n"
    },
    {
      "name": "global-data",
      "description": "Admin-curated reference datasets, readable by any authenticated caller."
    },
    {
      "name": "holdings",
      "description": "What the portal holds, of every datatype, how the items are tied\ntogether, and the files of the ones a reader may be given.\n"
    },
    {
      "name": "user-data",
      "description": "The caller's own durable file and dataset registry (\"My Data\")."
    },
    {
      "name": "uploads",
      "description": "Scratch uploads \u2014 write-once inputs the bucket expires on its own."
    },
    {
      "name": "files",
      "description": "Links to files the portal made, which record each file as it is sent."
    },
    {
      "name": "compute",
      "description": "The API a registered compute host speaks. Authenticated by a host token\nissued at enrollment, not by a Cognito token \u2014 these are the only routes\nhere that identify a machine rather than a person.\n"
    },
    {
      "name": "account",
      "description": "The caller's own account settings. Scoped to the authenticated user;\nno operation here takes a user identifier.\n"
    },
    {
      "name": "workflow-sessions",
      "description": "A named pass through one workflow, owning that pass's saved state and the\njobs it produced. Caller-scoped; the server stores the state and never\nreads into it.\n"
    },
    {
      "name": "demos",
      "description": "Workflow sessions saved with a copy of each of their jobs, which anyone\nsigned in may walk through without a job being run. Saved from the\nmaker's own session, promoted by a system admin.\n"
    },
    {
      "name": "support",
      "description": "Reporting a problem back to the people who run the portal. One operation,\nwrite-only: a report is filed and never read back, because it lands in a\nprivate repository the reporter has no access to.\n"
    }
  ],
  "paths": {
    "/api/workflows": {
      "get": {
        "tags": [
          "workflows"
        ],
        "operationId": "listRegisteredWorkflows",
        "summary": "The registered workflows this caller is shown.",
        "description": "The active version of every registered workflow. A caller with the\n`developer` tag (`GET /api/me/tags`) is also given every other registered\nversion, as a draft. A demo played on a draft gives that version's\naddress itself (`getDemo`). A workflow a system admin has hidden\n(`listHiddenPages`) is left out, except for system admins and\ndevelopers.\n\n`address` is where the version's files are read from: its `config.json`\nis there, and names the module to load. A registered workflow's jobs run\nthe toolkit versions its config names (`POST /api/jobs`, `toolkit`).\n",
        "responses": {
          "200": {
            "description": "The workflows, by name, the active version of each first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredWorkflowList"
                },
                "examples": {
                  "none": {
                    "summary": "Nothing is registered.",
                    "value": {
                      "workflows": []
                    }
                  },
                  "registered": {
                    "summary": "One workflow, with a draft of its next version.",
                    "value": {
                      "workflows": [
                        {
                          "name": "greeter",
                          "version": "0.1.0",
                          "title": "Greet some sequences",
                          "state": "active",
                          "address": "/workflows/greeter/0.1.0/"
                        },
                        {
                          "name": "greeter",
                          "version": "0.2.0",
                          "title": "Greet some sequences",
                          "state": "draft",
                          "address": "/workflows/greeter/0.2.0/"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/docs": {
      "get": {
        "tags": [
          "documents"
        ],
        "operationId": "listRegisteredDocuments",
        "summary": "The registered documents this caller is shown.",
        "description": "The active version of every registered document. A system admin is also\ngiven every other registered version, as a draft. A document a system\nadmin has hidden (`listHiddenPages`) is left out, except for system\nadmins and developers.\n\n`address` is where the version's files are read from: the page is\n`index.md` there, and the images it shows sit beside it.\n",
        "responses": {
          "200": {
            "description": "The documents, by name, the active version of each first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredDocumentList"
                },
                "examples": {
                  "none": {
                    "summary": "Nothing is registered.",
                    "value": {
                      "documents": []
                    }
                  },
                  "registered": {
                    "summary": "The user guide, with a draft of its next version.",
                    "value": {
                      "documents": [
                        {
                          "name": "user-guide",
                          "version": "2026.10.0",
                          "title": "User guide",
                          "state": "active",
                          "address": "/docs/user-guide/2026.10.0/"
                        },
                        {
                          "name": "user-guide",
                          "version": "2026.10.1",
                          "title": "User guide",
                          "state": "draft",
                          "address": "/docs/user-guide/2026.10.1/"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/global_data": {
      "get": {
        "tags": [
          "global-data"
        ],
        "operationId": "listGlobalData",
        "summary": "List the curated global-data catalog.",
        "description": "Every entry carries a short-lived presigned download URL. S3 keys are never\nreturned \u2014 the catalog is addressed by handle.\n",
        "responses": {
          "200": {
            "description": "The catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GlobalDataListing"
                },
                "example": {
                  "version": 2,
                  "datasets": [
                    {
                      "id": "swissprot-2024-01",
                      "name": "uniprot_sprot.fasta.gz",
                      "folder": "sequences/uniprot",
                      "size_bytes": 91234567,
                      "description": "Swiss-Prot release 2024_01, reviewed entries only.",
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/swissprot"
                    },
                    {
                      "id": "pfam-a-37",
                      "name": "Pfam-A.full.gz",
                      "folder": "alignments/pfam",
                      "size_bytes": 4123456789,
                      "description": "Pfam-A full alignments, release 37.0.",
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/pfam"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/holdings": {
      "get": {
        "tags": [
          "holdings"
        ],
        "operationId": "listHoldings",
        "summary": "List what the portal holds.",
        "description": "Every item the portal holds, with the datatype it is and the items it is\ntied to. The same for every signed-in caller.\n\nA tool's parameter that takes held data names a datatype, and\n`listRegisteredTools` says under `held` which items may fill it. This is\nthe whole list, for a page that shows or reads an item itself.\n\n`related` is how the items are tied together, as each item's own\ndescription says: `derived_from`, that this was made from that, as the\nitem's release record lists. A reader takes the relations it knows;\nothers may be added.\n",
        "responses": {
          "200": {
            "description": "Every item the portal holds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HoldingListing"
                },
                "example": {
                  "holdings": [
                    {
                      "id": "gfp-pf01353",
                      "datatype": "sequence-corpus@1",
                      "title": "Green fluorescent protein (PF01353) finetuning corpus",
                      "description": "The dataset used to finetune the ProteoScribe decoder.",
                      "release": "5d0c8f0e",
                      "parts": {},
                      "file": "PF01353_bank.csv",
                      "size_bytes": 111200,
                      "records": 219,
                      "related": [],
                      "readable": true
                    },
                    {
                      "id": "gfp-pf01353-run1-base",
                      "datatype": "biom3-embeddings@1",
                      "title": "Green fluorescent protein (PF01353) embeddings",
                      "description": "",
                      "release": "91aa02c4",
                      "parts": {},
                      "file": "PF01353_embeddings_bundle.pt",
                      "size_bytes": 1500357,
                      "records": 219,
                      "related": [
                        {
                          "relation": "derived_from",
                          "id": "gfp-pf01353"
                        },
                        {
                          "relation": "derived_from",
                          "id": "biom3-run1-base"
                        }
                      ],
                      "readable": true
                    },
                    {
                      "id": "gfp-pft-ep199",
                      "datatype": "biom3-proteoscribe-weights@1",
                      "title": "Green fluorescent protein (PF01353) epoch 199",
                      "description": "",
                      "release": "",
                      "parts": {},
                      "file": "gfp_pft_ep199.bin",
                      "size_bytes": 344821855,
                      "records": null,
                      "related": [
                        {
                          "relation": "derived_from",
                          "id": "biom3-run1-base"
                        },
                        {
                          "relation": "derived_from",
                          "id": "gfp-pf01353"
                        }
                      ],
                      "readable": false
                    },
                    {
                      "id": "biom3-run1-base",
                      "datatype": "biom3-weights-bundle@1",
                      "title": "BioM3 run1_base",
                      "description": "The base set of BioM3 weights.",
                      "release": "2026.11.0",
                      "parts": {
                        "tag": "run1_base"
                      },
                      "file": null,
                      "size_bytes": null,
                      "records": null,
                      "related": [],
                      "readable": false
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/holdings/{holding_id}/files": {
      "get": {
        "tags": [
          "holdings"
        ],
        "operationId": "listHoldingFiles",
        "summary": "List the files of one held item.",
        "description": "For an item that is a single file, that file and then the other files\nits release lists, such as a table's schema beside it; for one that is a\nfolder, every file under the folder. Only an item listed as `readable`\ngives its files out.\n",
        "parameters": [
          {
            "name": "holding_id",
            "in": "path",
            "required": true,
            "description": "The id of one item the portal holds, as `listHoldings` gives it.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The item's files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HoldingFileListing"
                },
                "example": {
                  "id": "gfp-pf01353-sca",
                  "files": [
                    {
                      "path": "core/scarun_results.npz",
                      "size_bytes": 72601
                    },
                    {
                      "path": "preprocessing/msa_orig.fasta-aln",
                      "size_bytes": 61320
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/holdings/{holding_id}/files/{path}": {
      "get": {
        "tags": [
          "holdings"
        ],
        "operationId": "getHoldingFile",
        "summary": "Get a presigned download for one file of a held item.",
        "parameters": [
          {
            "name": "holding_id",
            "in": "path",
            "required": true,
            "description": "The id of one item the portal holds, as `listHoldings` gives it.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path of one file of the held item, as `listHoldingFiles` gives it. No\nempty segment, no `.`, no `..`, no backslash.\n\nDeployed as a greedy path parameter, which OpenAPI cannot express.\n",
            "x-nm-greedy": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inline",
            "in": "query",
            "required": false,
            "description": "`true` to have a small text file's content in the answer as well as its\nlink, for a caller that cannot fetch the link itself, such as an\nassistant's tool. Left out, only the link and the size.\n",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A short-lived presigned GET for the file, and the file's size. Fetch\n`url` directly and **without** an Authorization header. Storage\nanswers a `Range` header, so a reader may take part of a large file;\nthe size is given here because storage does not say it to a page.\nAsked for `inline`, a UTF-8 file of at most 32 KiB also comes as\n`content`, and any other with a `note` saying why not.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HoldingFileLink"
                },
                "example": {
                  "path": "core/scarun_results.npz",
                  "size_bytes": 72601,
                  "url": "https://example-global-data.s3.amazonaws.com/presigned/scarun-results"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/user-data": {
      "get": {
        "tags": [
          "user-data"
        ],
        "operationId": "listUserData",
        "summary": "List the caller's My Data items and current quota usage.",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The caller's items, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserDataListing"
                },
                "example": {
                  "items": [
                    {
                      "file_id": "8f14e45f-ceea-467a-9f6b-1c2d3e4f5a6b",
                      "display_name": "my_sequences.fasta",
                      "category": "sequences",
                      "description": "Kinase domain candidates, round 3.",
                      "uploaded_at": 1786100000.482,
                      "size_bytes": 51234,
                      "shared_with_teams": [],
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/mine"
                    },
                    {
                      "file_id": "c9f0f895-fb98-4b41-9b8d-7a6c5e4d3f2a",
                      "display_name": "esmfold run 12",
                      "category": "job-result",
                      "description": "Saved from job 41d2-8a7c (esmfold-predict)",
                      "uploaded_at": 1786013600.117,
                      "size_bytes": 8412300,
                      "shared_with_teams": [],
                      "kind": "dataset",
                      "source_job_id": "41d2-8a7c",
                      "source_tool_id": "esmfold-predict",
                      "output_subpath": "results/",
                      "object_count": 34,
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/dataset"
                    }
                  ],
                  "quota": {
                    "used_bytes": 8463534,
                    "max_bytes": 1073741824
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "user-data"
        ],
        "operationId": "createUserData",
        "summary": "Register a My Data item and get a presigned upload.",
        "description": "Two-step upload. This call reserves the record and returns a presigned POST;\nthe client then sends the bytes straight to S3, so they never transit the API.\n\nIf the upload then fails, `DELETE /api/user-data/{file_id}` cleans up the\norphaned record.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserDataRequest"
              },
              "example": {
                "display_name": "my_sequences.fasta",
                "size_bytes": 51234,
                "category": "sequences",
                "description": "Kinase domain candidates, round 3."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Record created. Upload the bytes to the returned URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateUserDataResponse"
                },
                "example": {
                  "file_id": "8f14e45f-ceea-467a-9f6b-1c2d3e4f5a6b",
                  "upload_url": "https://example-outputs.s3.amazonaws.com/",
                  "upload_fields": {
                    "key": "user-data/dev-user-id/8f14e45f/file",
                    "policy": "eyJleHBpcmF0aW9uIjoi...",
                    "x-amz-signature": "4f2a1c9e8b7d6a5f"
                  },
                  "upload_method": "POST",
                  "expires_in_seconds": 3600
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The operation would push My Data usage past the caller's quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaExceededError"
                }
              }
            }
          }
        }
      }
    },
    "/api/user-data/{file_id}": {
      "delete": {
        "tags": [
          "user-data"
        ],
        "operationId": "deleteUserData",
        "summary": "Delete a My Data item and every object beneath it.",
        "description": "Idempotent and best-effort. Deleting an unknown `file_id` succeeds \u2014 the\nendpoint reports what it was asked to remove, not what it found.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "description": "A My Data item id.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deletion accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteUserDataResponse"
                },
                "example": {
                  "deleted": "8f14e45f-ceea-467a-9f6b-1c2d3e4f5a6b"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/user-data/from-job/{job_id}": {
      "post": {
        "tags": [
          "user-data"
        ],
        "operationId": "saveJobToUserData",
        "summary": "Copy a finished job's results into My Data as a dataset.",
        "description": "Server-side copy within the outputs bucket: the browsable results tree, the\nstatus document, and the downloadable archive. Quota-counted.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveJobToUserDataRequest"
              },
              "example": {
                "name": "esmfold run 12"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Dataset created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SaveJobToUserDataResponse"
                },
                "example": {
                  "file_id": "c9f0f895-fb98-4b41-9b8d-7a6c5e4d3f2a",
                  "size_bytes": 8412300,
                  "object_count": 34
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The operation would push My Data usage past the caller's quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotaExceededError"
                }
              }
            }
          }
        }
      }
    },
    "/api/uploads": {
      "post": {
        "tags": [
          "uploads"
        ],
        "operationId": "createUpload",
        "summary": "Get a presigned upload for a one-shot job input.",
        "description": "Scratch, not storage. An upload is not quota-counted, not listed, and the\nbucket expires it on its own \u2014 it exists to be submitted as a job input once.\nDurable files belong in My Data instead.\n\nThe id is generated server-side, never accepted from the caller: it is what\nkeeps the object inside the caller's own prefix.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUploadRequest"
              },
              "example": {
                "size_bytes": 51234
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload the bytes to the returned URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateUploadResponse"
                },
                "example": {
                  "upload_id": "3c59dc04-8e88-4506-a3a0-1c2d3e4f5a6b",
                  "upload_url": "https://example-outputs.s3.amazonaws.com/",
                  "upload_fields": {
                    "key": "uploads/dev-user-id/3c59dc04/file",
                    "policy": "eyJleHBpcmF0aW9uIjoi...",
                    "x-amz-signature": "9e8b7d6a5f4c3b2a"
                  },
                  "upload_method": "POST",
                  "expires_in_seconds": 3600,
                  "max_bytes": 104857600
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is over 10 MiB, the most the API server reads on any route, or an input exceeds the ceiling for its argument.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/files/{token}": {
      "get": {
        "tags": [
          "files"
        ],
        "operationId": "openFileLink",
        "summary": "Open a link to a file the portal made.",
        "description": "Every link the portal hands out to read a file is one of these, wherever\nit appears: a job's `download_url`, a result file's `url`, a My Data\nitem's `download_url`, a held item's files, an assistant's attachments,\nand the links a machine is given for its job. The token names the file,\nwhom the link was made for and until when, signed by the portal, so it\nneeds no sign-in, as a storage link needs none.\n\nOpening it records the file as sent to whom the link was made for, at its\nsize then, and forwards to the file in storage, which answers as it would\nhave. A link opened twice is recorded twice.\n",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "The link's token, as the portal made it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "The file is recorded as sent; `Location` is where storage gives it.",
            "headers": {
              "Location": {
                "description": "A storage link to the file, lasting five minutes.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Not a link this portal made, or its file is no longer kept.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "The link has expired; ask the portal for the file again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobs",
        "summary": "List the caller's jobs.",
        "description": "Every job the caller has submitted under the active organization,\nwhatever tool ran it.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many jobs to return in one page.\n\nThis bounds server work, not just display: the handler sorts and slices\nbefore fetching, so `limit` decides how many objects are read per request.\nA client that omits it gets 10.\n\nOut-of-range values are **clamped, not rejected** \u2014 above 200 becomes 200,\nbelow 1 becomes 1, and an unparseable value falls back to 10. The handler\ndoes this deliberately so a stale frontend cannot break itself. No\n`minimum`/`maximum` is declared here because declaring them would make this\ncontract stricter than the API it describes.\n",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "How many jobs to skip, counting from the most recent. Defaults to 0;\nnegative and unparseable values clamp to 0.\n\nOffset paging is not stable across a mutating list: a job submitted between\ntwo requests shifts everything down, so a row can appear on both pages and\nanother be missed. Acceptable for a job table a human is reading; not\nsomething to build exactly-once processing on. Replacing this with a cursor\nis an open decision \u2014 see contracts/README.md.\n",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of jobs, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobListing"
                },
                "example": {
                  "total": 2,
                  "jobs": [
                    {
                      "job_id": "41d2-8a7c",
                      "job_name": "kinases-round-3",
                      "tool_id": "esmfold-predict",
                      "target_id": "spark-nm",
                      "status": "done",
                      "submitted_at": 1786013500.22,
                      "finished_at": 1786013740.91,
                      "submitted_by_email": "dev-user@localhost",
                      "result_size_bytes": 8412300,
                      "output_extension": "tar.gz"
                    },
                    {
                      "job_id": "7b3e-2f19",
                      "job_name": "swissprot-scan",
                      "tool_id": "blast-identify",
                      "target_id": "cloud-cpu",
                      "status": "running",
                      "step": "searching",
                      "submitted_at": 1786100200.05,
                      "finished_at": null,
                      "submitted_by_email": "dev-user@localhost"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "submitJob",
        "summary": "Run a registered tool.",
        "description": "Runs the active version of the named tool. `params` is checked against the\ntool's record: unknown parameters are refused, and a parameter left out,\nsent as null, or sent as \"\" takes the record's default. Each data\nparameter is a JobInput, limited to the sources the record allows.\n\nA submission that names a `toolkit` and its version runs that registered\nversion in place of the active one, whether or not it is active. It is\nrefused with 404 when that version is not registered or has no such\ntool, and with 409 when a datatype the version names has changed since\nit was registered.\n\nThe answer names the package version that will run. Poll `status_url`.\n\nThe job's record keeps where it was submitted from: the sign-in app the\ncaller's token was issued to, and the part of it named in\n`X-NM-Requested-From`.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "X-NM-Requested-From",
            "in": "header",
            "required": false,
            "description": "The part of a client that made the request, which the portal keeps with\nwhat the request does: a submitted job's record keeps it as\n`submitted_from.requested_from`, beside the sign-in app the token was\nissued to as `submitted_from.client_id`. The website names its page by its\naddress, such as `tools/blast/identify` or `workflows/biom3-sequences`; the\nportal's assistant names itself and its agent, as `assistant/default`.\n\nUp to 200 letters, digits and `.` `_` `/` `@` `+` `-`, starting with a\nletter or digit; anything else is refused with 400.\n",
            "schema": {
              "type": "string",
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._/@+-]{0,199}$",
              "example": "tools/blast/identify"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenericSubmitRequest"
              },
              "example": {
                "tool_id": "blast-identify",
                "params": {
                  "query": {
                    "source": "text",
                    "content": ">q\nMKVLAAGIVALLLAAGCSSS"
                  },
                  "database": "swissprot-blast",
                  "evalue": 0.001
                },
                "target_id": "spark-nm",
                "job_name": "kinase-identify"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted. Poll `status_url` until a terminal state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobAccepted"
                },
                "example": {
                  "job_id": "7b3e-2f19",
                  "status": "queued",
                  "status_url": "/api/jobs/7b3e-2f19",
                  "target_id": "spark-nm",
                  "tool": {
                    "id": "blast-identify",
                    "package": "blast",
                    "version": "2026.10.0"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A prior-job input names a job by a name several completed jobs share: the error lists them, and one is named by `job_id`. Or the toolkit version named was written against a datatype that has changed since: `changed_datatypes` lists them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is over 10 MiB, the most the API server reads on any route, or an input exceeds the ceiling for its argument.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The compute target refused the job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/tools": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listRegisteredTools",
        "summary": "The tools the registered toolkits define.",
        "description": "Every tool of every toolkit that is active in this environment, as the\ntoolkit itself defines it. The registry holds the toolkits; this contract\ndoes not name their tools, so a toolkit promoted today is listed today.\n\nEach tool's `params` is the schema `POST /api/jobs` checks a submission\nagainst. A parameter that data can fill states its datatype, and `held`\nsays what the portal holds of each datatype, which a caller names by\n`id`. `targets` are the machines this caller may run the tool on.\n\nA toolkit named with `toolkit` is listed at that registered version in\nplace of its active one, as `POST /api/jobs` would run it.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "toolkit",
            "in": "query",
            "required": false,
            "description": "A toolkit and the registered version of it to list, as `<name>@<version>`. Given once for each toolkit named.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[^@\\s]+@[^@\\s]+$"
              }
            },
            "style": "form",
            "explode": true,
            "example": [
              "blast@2026.10.1"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The tools, in the order of their ids.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredToolList"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "A toolkit version named was written against a datatype that has changed since; `changed_datatypes` lists them.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/tools/openapi.json": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "describeRegisteredTools",
        "summary": "The registered tools, as an OpenAPI document.",
        "description": "This contract describes `POST /api/jobs` without its tools, because the\nregistry holds them. This route answers with the part the contract cannot\nstate: an OpenAPI 3.1 document in which `POST /api/jobs` takes one request\nshape per tool of every active toolkit, chosen by `tool_id`. Each shape's\ndescription is the tool's `full_description`, and its `params` is the\nschema a submission is checked against.\n\nThe document stands on its own, and is written to be laid over this one:\nthe same path and operation, and schemas named `<Tool>Submission`, which\nthis contract does not use. `x-nm-tools` lists the tools with the schema\nof each. The API reference page lays it over, so what it says of the\ntools is the registry's, in the environment it is opened in.\n\nThe same for every caller: the machines a caller may use and what the\nportal holds are in `GET /api/jobs/tools`.\n",
        "responses": {
          "200": {
            "description": "The document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "An OpenAPI 3.1 document.",
                  "required": [
                    "openapi",
                    "info",
                    "paths",
                    "components",
                    "x-nm-tools"
                  ],
                  "additionalProperties": true,
                  "properties": {
                    "x-nm-tools": {
                      "type": "array",
                      "description": "Every tool, in the order of their ids.",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "toolkit",
                          "version",
                          "schema"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "toolkit": {
                            "type": "string"
                          },
                          "version": {
                            "type": "string"
                          },
                          "schema": {
                            "type": "string",
                            "description": "A pointer to the tool's request schema in this document."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "openapi": "3.1.0",
                  "info": {
                    "title": "nm-portal registered tools",
                    "version": "live"
                  },
                  "paths": {
                    "/api/jobs": {
                      "post": {
                        "operationId": "submitJob",
                        "summary": "Run a registered tool.",
                        "description": "In the real answer the request body is one of the schemas under `components`, chosen by `tool_id`. It is left out of this example, which a reference inside would break.",
                        "responses": {
                          "202": {
                            "description": "Accepted. Poll `status_url` until a terminal state."
                          }
                        }
                      }
                    }
                  },
                  "components": {
                    "schemas": {
                      "BlastIdentifySubmission": {
                        "type": "object",
                        "title": "BLAST - Identify sequences",
                        "description": "Identify protein sequences by their nearest natural relatives, searching a protein database with BLAST.\n\nReturns:\n- `results/result.tsv`, Hit table (output `hits`, blast/hit-table@3). One row per aligned segment.",
                        "required": [
                          "tool_id",
                          "params"
                        ],
                        "additionalProperties": false,
                        "properties": {
                          "tool_id": {
                            "type": "string",
                            "const": "blast-identify"
                          },
                          "params": {
                            "type": "object",
                            "required": [
                              "query"
                            ],
                            "properties": {
                              "query": {
                                "title": "Query sequences",
                                "description": "Protein sequences to identify, as FASTA.",
                                "type": "object"
                              },
                              "evalue": {
                                "type": "number",
                                "default": 0.001,
                                "title": "E-value threshold",
                                "description": "Maximum E-value for a reported hit. Lower is stricter."
                              }
                            }
                          },
                          "target_id": {
                            "type": "string"
                          },
                          "job_name": {
                            "type": "string"
                          }
                        },
                        "x-nm-toolkit": {
                          "name": "blast",
                          "version": "2026.10.2"
                        }
                      }
                    }
                  },
                  "x-nm-tools": [
                    {
                      "id": "blast-identify",
                      "label": "BLAST - Identify sequences",
                      "toolkit": "blast",
                      "version": "2026.10.2",
                      "schema": "#/components/schemas/BlastIdentifySubmission"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJob",
        "summary": "Poll one job's status.",
        "description": "Any job of the caller's, whatever tool ran it.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job's current status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatus"
                },
                "examples": {
                  "running": {
                    "summary": "Still working \u2014 the poll loop keeps going.",
                    "value": {
                      "job_id": "7b3e-2f19",
                      "job_name": "swissprot-scan",
                      "tool_id": "blast-identify",
                      "target_id": "cloud-cpu",
                      "status": "running",
                      "step": "searching",
                      "submitted_at": 1786100200.05,
                      "finished_at": null,
                      "submitted_by_email": "dev-user@localhost"
                    }
                  },
                  "done": {
                    "summary": "Finished \u2014 the download link is live.",
                    "value": {
                      "job_id": "41d2-8a7c",
                      "job_name": "kinases-round-3",
                      "tool_id": "esmfold-predict",
                      "target_id": "spark-nm",
                      "status": "done",
                      "submitted_at": 1786013500.22,
                      "finished_at": 1786013740.91,
                      "submitted_by_email": "dev-user@localhost",
                      "result_size_bytes": 8412300,
                      "output_extension": "tar.gz",
                      "download_filename": "kinases-round-3.tar.gz",
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/archive",
                      "results_prefix": "jobs/dev-user-id/41d2-8a7c/results/",
                      "extras": {}
                    }
                  },
                  "failed": {
                    "summary": "Failed \u2014 drives the error UI.",
                    "value": {
                      "job_id": "55aa-9c31",
                      "job_name": "bad-input-run",
                      "tool_id": "blast-identify",
                      "target_id": "cloud-cpu",
                      "status": "failed",
                      "submitted_at": 1786099000.11,
                      "finished_at": 1786099062.4,
                      "submitted_by_email": "dev-user@localhost",
                      "error": "Input is not valid FASTA: line 3 has no header."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/cancel": {
      "post": {
        "tags": [
          "jobs"
        ],
        "operationId": "cancelJob",
        "summary": "Ask for one of the caller's jobs to be stopped.",
        "description": "Records a cancellation request against a job that has not finished, and\nreturns the job's status document with `status` set to `cancelling`.\n\n**This requests a stop; it does not perform one, and the response does not\nmean the job has ended.** The portal has no way to stop a job itself: a\nqueued job is a message on a compute target's SQS queue that this API\nholds no receipt handle for, and a running job is a container on a host it\ncannot reach. What it can do is write the request into the job's status\ndocument \u2014 which the supervisor already reads and writes on every\ntransition \u2014 and let the supervisor act on it. The supervisor writes the\nterminal `cancelled`, exactly as it writes `done` and `failed`, because a\ncomponent that cannot observe the container must not be the one to declare\nit dead.\n\nSo poll `getJob` afterwards rather than treating the 200 as an\noutcome, and expect three possible endings: `cancelled` if the supervisor\nabandoned or killed it, `done` or `failed` if the job got there first. A\njob whose supervisor does not yet honour the request stays `cancelling`\nuntil it finishes on its own; that is visible rather than silent, which is\nthe reason the state is named for the request and not for the result.\n\nOwnership is structural, not checked: the job's storage key is built from\nthe caller's own subject, so another caller's `job_id` resolves to nothing\nand returns 404 \u2014 the same answer as an id that never existed, which is\nalso what stops this route from confirming that someone else's job exists.\n\nIdempotent. Cancelling a job already in `cancelling` succeeds and changes\nnothing.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request was recorded. The job is now `cancelling`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatus"
                },
                "example": {
                  "job_id": "7b3e-2f19",
                  "job_name": "swissprot-scan",
                  "tool_id": "blast-identify",
                  "target_id": "cloud-cpu",
                  "status": "cancelling",
                  "submitted_at": 1786100200.05,
                  "finished_at": null,
                  "submitted_by_email": "dev-user@localhost",
                  "cancel_requested_at": 1786100260.71
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The job has already finished. `done`, `failed` and `cancelled` are\nterminal, and a request to stop one is a mistake worth reporting\nrather than a no-op worth hiding \u2014 the caller is usually acting on a\nstale listing.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/results": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobResults",
        "summary": "List the files in a job's results tree.",
        "description": "Only the `results/` subtree: what the tool wrote. `listJobFiles` lists\nthe whole job folder.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job's result files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResultListing"
                },
                "example": {
                  "truncated": false,
                  "files": [
                    {
                      "path": "result.tsv",
                      "size_bytes": 41233
                    },
                    {
                      "path": "logs/blast.log",
                      "size_bytes": 8120
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/results/{path}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "getJobResultFile",
        "summary": "Get a presigned download for one result file.",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path of one file within the job's results tree.\n\nDeployed as a greedy `{path+}` parameter, which OpenAPI cannot express; the\nroute-conformance test normalizes the two spellings.\n",
            "x-nm-greedy": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A short-lived presigned GET for the file. Fetch `url` directly and\n**without** an Authorization header \u2014 the signature is in the URL, and\nan extra auth header makes S3 reject it.\n\nThe field is `url` here and `download_url` on the job status route.\nThe inconsistency is real and predates this contract; it is recorded\nrather than corrected because both readers\n(`site/js/workbench/api.js`, `site/js/tools/align/view.js`) and the\nhandler already agree on `url`, so changing it is a breaking change\nthat buys only tidiness.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "path": {
                      "type": "string",
                      "description": "Echoes the requested path, relative to results/."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "size_bytes": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                },
                "example": {
                  "path": "result.tsv",
                  "url": "https://example-outputs.s3.amazonaws.com/presigned/result-tsv",
                  "size_bytes": 41233
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/files": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobFiles",
        "summary": "List every file in a job's folder.",
        "description": "The superset of `listJobResults`, which sees only the `results/` subtree.\nA job's folder also holds `job_metadata.json`, the submitted `input.*` and\n`results.tar.gz`, none of which the results listing can reach.\n\nA separate route rather than a scope flag on `listJobResults`: that route\nis what the workbench's file browser reads, and a default it could be\ntalked out of is a default that eventually flips. Here the narrower view\nstays narrow because it is a different URL, not because a parameter\ndefaulted correctly.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Every file in the job folder, `results/` included.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFileListing"
                },
                "example": {
                  "job_id": "41d2-8a7c",
                  "truncated": false,
                  "files": [
                    {
                      "path": "input.fasta",
                      "size_bytes": 1204
                    },
                    {
                      "path": "job_metadata.json",
                      "size_bytes": 812
                    },
                    {
                      "path": "results/blast/hits.tsv",
                      "size_bytes": 41233
                    },
                    {
                      "path": "results.tar.gz",
                      "size_bytes": 8412300
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/files/{path}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "readJobFile",
        "summary": "Read one file from a job's folder.",
        "description": "Addressed from the job folder root, so it reaches `job_metadata.json` and\nthe submitted input as well as anything under `results/`.\n\nUnlike `getJobResultFile`, this returns small text **inline**. That is the\npoint of the route: an agent asking what a job produced should not have to\nmake a second, unauthenticated request to a presigned URL to find out. The\npresigned field remains for everything too large or not UTF-8, so the\nresponse shape is a superset rather than an alternative.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path of one file within the job folder, relative to the folder root rather\nthan to `results/`. `job_metadata.json`, `input.fasta` and\n`results/blast/hits.tsv` are all addressable; `ResultPath` can only reach\nthe third.\n\nThe traversal rules are identical to `ResultPath` \u2014 no empty segment, no\n`.`, no `..`, no backslash \u2014 and ownership is structural either way, since\nthe caller's subject builds the key. The only difference is that the\n`results/` prefix is not forced on.\n\nDeployed as a greedy `{path+}` parameter, which OpenAPI cannot express; the\nroute-conformance test normalizes the two spellings.\n",
            "x-nm-greedy": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file inline, or a presigned URL when it cannot be.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFileContent"
                },
                "examples": {
                  "inline": {
                    "summary": "Small UTF-8 text \u2014 returned directly.",
                    "value": {
                      "path": "job_metadata.json",
                      "size_bytes": 812,
                      "content_type": "application/json",
                      "content": "{\"tool_id\": \"blast-identify\"}"
                    }
                  },
                  "presigned": {
                    "summary": "Too large to inline \u2014 fetch the URL without auth.",
                    "value": {
                      "path": "results.tar.gz",
                      "size_bytes": 8412300,
                      "content_type": "application/gzip",
                      "download_url": "https://example-outputs.s3.amazonaws.com/presigned/archive",
                      "note": "File exceeds the 32768-byte inline cap; use download_url."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/log": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "readJobLog",
        "summary": "Read a job's log, from wherever that job's log lives.",
        "description": "A running job's output, and a finished one's, without the caller needing\nto know which kind of machine ran it.\n\nWhere the bytes are differs by target and the difference is not\nincidental. A daemon host holds the container's output and ships a rolling\ntail into the job's own folder; a Batch job's output is already in a\nretained log service, written by the log driver. This route resolves which\nfrom the job's own `dispatch.log_location` and reads it in place, rather\nthan making every target emulate one of them.\n\n`cursor` is opaque and belongs to the source that issued it. Send back\nwhat the previous response returned; a first read omits it. A source that\nrewrites its log in place \u2014 the daemon's tail \u2014 returns no cursor, and the\ncaller replaces what it is showing rather than appending.\n\nAn empty `lines` with `complete: false` means the caller has caught up and\nshould poll again. `complete: true` means the job is finished and the\nsource has no more to give.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque position from a previous response. Omit to read from the start.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of log lines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobLog"
                },
                "examples": {
                  "streaming": {
                    "summary": "More to come \u2014 poll again with the cursor.",
                    "value": {
                      "job_id": "d0fe30c7-7618-4de3-bf46-f02008b32c29",
                      "source": "cloudwatch",
                      "lines": [
                        "[nm_jobrun] image build: 683bc82",
                        "[nm_jobrun] Loaded MSA: shape=(2002, 102)"
                      ],
                      "cursor": "f/38\u00abtruncated\u00bb",
                      "complete": false
                    }
                  },
                  "finished": {
                    "summary": "Nothing further will be written.",
                    "value": {
                      "job_id": "d0fe30c7-7618-4de3-bf46-f02008b32c29",
                      "source": "cloudwatch",
                      "lines": [],
                      "cursor": "f/38\u00abtruncated\u00bb",
                      "complete": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The job has no readable log, and this says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "This job has not started producing output yet."
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{job_id}/generated-sequences": {
      "get": {
        "tags": [
          "jobs"
        ],
        "operationId": "listJobGeneratedSequences",
        "summary": "List the sequences a job generated, under their ids.",
        "description": "Each sequence one of the caller's jobs generated, under the id the\nportal gave it when the job finished, by output and name. A later job\ncan be sent these sequences by id (`GeneratedSequencesInput`). Empty for\na job that generated none, and for one not yet recorded.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job's generated sequences.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobGeneratedSequences"
                },
                "example": {
                  "job_id": "7dfd9d0f-3885-4de4-b5e8-f2c1c5b565ad",
                  "sequences": [
                    {
                      "id": "seq-eyft4fva9c",
                      "output": "sequences",
                      "name": "prompt_0_replica_0",
                      "residues": "MKVLAAGIVGLLLA"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "What the request needs is not running in this portal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/compute/enroll": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "enrollComputeHost",
        "summary": "Exchange an enrollment code for a host token.",
        "description": "Called once by a machine being registered. The code is the credential \u2014\nthis is the only route here that takes no bearer token \u2014 and it buys\nexactly one exchange: it is single-use, expires within a day, and is\nstored only as a hash.\n\nA refused code says nothing about why. \"Already redeemed\" and \"never\nexisted\" answer identically, because distinguishing them would confirm to\nwhoever holds a code that it was once real.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrollRequest"
              },
              "example": {
                "code": "NMC-7KQ4H-8XR2V-B19TC"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The host is now active. Store the token; it is shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrollResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The code is not usable. Deliberately does not say why."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/download": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostDownloadUrl",
        "summary": "A URL to read one file inside a job this host is running.",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobFileRequest"
              },
              "example": {
                "path": "input.csv",
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A presigned URL. Bytes move directly to and from S3.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DownloadResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The host, the job, or the path is not one this token reaches. One\nanswer for all three \u2014 a caller that guessed wrong should not learn\nwhich part of the guess was right.\n"
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/upload": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostUploadUrl",
        "summary": "A URL to write one file into a job this host is running.",
        "description": "The declared `size_bytes` is signed into the returned policy as a\n`content-length-range`, so S3 itself rejects a body outside it. Without\nthat, a URL for a small status file would be a URL for an arbitrarily\nlarge one.\n\nRefused for a job that has already finished: results someone may have read\nare not rewritten by a late or duplicated delivery.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobUploadRequest"
              },
              "example": {
                "path": "results/result.tsv",
                "size_bytes": 51234,
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Post the file to this URL with these fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token, or the job has finished."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/upload/start": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostUploadStart",
        "summary": "Begin writing one file in parts, into a job this host is running.",
        "description": "For a file larger than a single upload takes (5 GiB). Its parts are\nsent to the URLs `upload/parts` hands out, and `upload/complete` joins\nthem into the one file. The declared size is kept with the upload, and\nthe joined file is held to it.\n\nRefused for a job that has already finished, as a single upload is.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobUploadStartRequest"
              },
              "example": {
                "path": "results/uniref90.fasta.ssi",
                "size_bytes": 5948092567,
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The upload's id, and how the file is cut into parts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadStartResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token, or the job has finished."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/upload/parts": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostUploadParts",
        "summary": "A URL for each of some parts of an upload begun in parts.",
        "description": "Each part but the last is `part_bytes` long. A part is sent with a PUT\nof its bytes to its URL, and S3 answers with the part's ETag, which\n`upload/complete` is given.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobUploadPartsRequest"
              },
              "example": {
                "path": "results/uniref90.fasta.ssi",
                "upload_id": "2~example",
                "part_numbers": [
                  1,
                  2,
                  3
                ],
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One URL per part asked for.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadPartsResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token, or the job has finished."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/upload/complete": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostUploadComplete",
        "summary": "Join an upload's parts into the one file.",
        "description": "The joined file is held to the size declared when the upload began. A\nfile of another size is deleted, and the answer says so.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobUploadCompleteRequest"
              },
              "example": {
                "path": "results/uniref90.fasta.ssi",
                "upload_id": "2~example",
                "parts": [
                  {
                    "number": 1,
                    "etag": "\"79b281060d337b9b2b84ccf390adcf74\""
                  }
                ],
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file is written.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "size_bytes"
                  ],
                  "properties": {
                    "size_bytes": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token, or the job has finished."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/upload/abort": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostUploadAbort",
        "summary": "Discard an upload begun in parts, and every part it was sent.",
        "description": "An upload already discarded or completed is not an error.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobUploadAbortRequest"
              },
              "example": {
                "path": "results/uniref90.fasta.ssi",
                "upload_id": "2~example",
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Discarded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token, or the job has finished."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/list": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostListJobFiles",
        "summary": "The files under a prefix inside a job this host is running.",
        "description": "For reading a tree \u2014 a prior job's output consumed as this job's input.\nBounded by the job, which is why it is offered at all: a reference\ndatabase is not, and a host that needs one is not sent the job.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobListRequest"
              },
              "example": {
                "prefix": "results/",
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One entry per file, each with its own URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not reachable by this token."
          },
          "413": {
            "description": "Too many files under that prefix. This is a convenience for a job's\nown tree, not a general manifest service.\n"
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/stage": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostStageAsset",
        "summary": "URLs for one shared asset this job stages.",
        "description": "A job's own files are addressed by a path inside the job. Staged assets\nare not in the job at all \u2014 they are shared reference data, owned by no\nsingle job \u2014 so the host names the *asset*, by the handle its own spec\nalready uses, and the portal resolves that against the lease it issued.\nThe host chooses which name; it never chooses what the name points at,\nand cannot reach an asset this job was not dispatched with.\n\nReturns every object under the asset \u2014 path, size and a URL each. A\nsingle-object asset returns one file.\n\nThe size is what makes this serve a cache rather than a download: these\nassets are immutable within a version, so a host that already holds a\npath at that size skips it. On a host paying its own egress that is the\ndifference between a warm job and an expensive one.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Where to fetch each object in the asset.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StageResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a valid host token, not this host's job, or an asset name the job\ndoes not stage.\n"
          },
          "409": {
            "description": "No live lease for this job."
          }
        }
      }
    },
    "/api/compute/jobs/next": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "leaseNextJob",
        "summary": "Lease the next job queued for this host.",
        "description": "Long-polls for up to 20 seconds and returns one job, or `job: null` when\nthe queue is idle \u2014 which is a 200, not a 404: an empty queue is the\nnormal answer for a daemon polling in a loop.\n\nThe `lease_id` is opaque. The underlying queue receipt stays server-side,\nso a host can neither extend nor delete its own message directly; it\nreleases work by calling `complete`. If it never does \u2014 because it\ncrashed \u2014 the lease lapses on its own and the job is offered again.\n\nA toolkit's image holds no portal code, so its job is handed only to a\nhost whose worker says it has a runner for the toolkit's devkit version\n(`devkits` in the body). Queued for a host that has none, the job is\nfailed with a message saying so and is not offered again.\n\nWhen an administrator has asked for this host's worker to move to another\nversion, and the worker says it can move itself, the answer carries\n`update` and no job.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeaseRequest"
              },
              "example": {
                "devkits": [
                  0
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A job and its lease, or nothing to do.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaseResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not a valid host token."
          },
          "409": {
            "description": "This host has no work queue \u2014 it was registered before one could be\ncreated. Re-register the machine.\n"
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/claim": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "claimJob",
        "summary": "Hand a machine the one job it was started for.",
        "description": "A machine started for one job is not registered, has no queue, and holds\nno host token. What started it was given a token for that job alone, made\nwhen the job was sent: `job:<job_id>.<secret>`. The machine's worker\npresents it here and is handed the job, then runs it as a worker on any\nhost does, with the same token on the other routes.\n\nThat token reaches this one job. It is refused for any other job, the\nsame user's included, and for `jobs/next`. It stops working when the\nportal has closed the job out, and only its hash is ever stored.\n\nWhat is handed over was fixed when the job was sent. It is not read from\nthe request, and not from the job's folder, which the machine can write\nin. Asking again returns the same answer.\n\nAs on `jobs/next`, a toolkit's job is handed only to a worker that says\nit has a runner for the toolkit's devkit version; otherwise the job is\nfailed with a message saying so.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClaimRequest"
              },
              "example": {
                "owner": "4f3c2b1a-0d9e-4c8b-a7f6-5e4d3c2b1a09",
                "devkits": [
                  0
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not this job's token, or a host's token."
          },
          "409": {
            "description": "The job ended before its machine arrived, or this machine's worker\nhas no runner for it.\n"
          }
        }
      }
    },
    "/api/compute/registry-token": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "computeHostRegistryToken",
        "summary": "A short-lived docker credential for pulling tool images.",
        "description": "A registered host holds no cloud credential, so it cannot authenticate to\nthe image registry itself. This returns one that expires \u2014 the same trade\nthe job-data routes make with presigned URLs: the capability crosses the\nwire, never the key that minted it.\n\nThe credential is pull-only and reaches only the tool repositories. It is\nnot scoped to a single image: a host runs jobs for many tools over its\nlife, and every repository it can reach is one it is already entitled to\nrun.\n\nCall it before each pull rather than caching it. It is valid for hours,\nnot days, and asking again is cheaper than diagnosing a login that expired\nmid-queue.\n\nName the image and the answer may be `credentials: null` \u2014 some tool\nimages are public. That decision belongs here rather than on the host: a\nmachine that recognises registries by hostname is a machine that knows\nwhich backend it is talking to, and one that guesses wrong skips\nauthentication silently.\n",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistryTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A credential usable with `docker login` until it expires.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryTokenResponse"
                }
              }
            }
          },
          "403": {
            "description": "Not a valid host token."
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/status": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "reportJobStatus",
        "summary": "Report a job's progress.",
        "description": "How a job leaves `queued`. The machine holds no AWS credential and cannot\nwrite the job's record itself, so it says what changed and the portal\nwrites it.\n\nOnly the fields a supervisor owns are accepted \u2014 `status`, `step`,\n`error`, `started_at`, `finished_at`, `progress`. Anything else is\ndropped: the rest of the record belongs to the dispatcher, and two of\nthose fields are what decides whether this host may touch the job at all.\n\nA report that the job has reached its end (`done`, `failed` or\n`cancelled`) also takes the job off the machine's queue, as releasing\nits lease does. Nothing more can be written about a finished job, so it\nis never offered again.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobStatusRequest"
              },
              "example": {
                "owner": "210b85f0-e0b1-7086-879f-0f3e428c567e",
                "status_patch": {
                  "status": "running",
                  "step": "1/3"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Applied. Lists which fields were taken.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "The patch named no writable field."
          },
          "403": {
            "description": "Not a job this token reaches."
          },
          "409": {
            "description": "The job has already finished. Said rather than ignored, so a daemon\nretrying a stale delivery learns why instead of appearing to succeed\nagainst results someone has read.\n"
          },
          "502": {
            "description": "The job's end was recorded, but the job could not be taken off the\nmachine's queue. Releasing its lease tries again.\n"
          }
        }
      }
    },
    "/api/compute/jobs/{job_id}/complete": {
      "post": {
        "tags": [
          "compute"
        ],
        "operationId": "releaseJobLease",
        "summary": "Release a lease once the job is finished with.",
        "description": "Deletes the underlying queued message, which is what stops the job being\noffered again. Idempotent: releasing a lease that is already gone answers\n200 with `released: false`, so a daemon retrying is not told it failed.\nA job whose end was reported has been released already.\n",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job belonging to the caller. Another caller's id resolves as not found \u2014\nownership is structural, since the caller's subject is part of the storage\nkey rather than something the handler checks.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JobCompleteRequest"
              },
              "example": {
                "lease_id": "8Xr2vB19tCQ4h7Kq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Whether this call was the one that released it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobCompleteResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a valid host token."
          }
        }
      }
    },
    "/api/me/organizations": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listMyOrganizations",
        "summary": "The organizations the caller belongs to, and which one is active.",
        "description": "A user can belong to several organizations. Jobs are written beneath the\nactive one, so which organization is active is not a display preference \u2014\nit decides where the caller's data lands and who else can be granted\naccess to it.\n\n`active_org_id` is what is **in effect**, which is not always what the\ncaller last chose. An unset preference resolves to their first membership,\nand a stored organization they have since left is skipped over. Clients\nshould render `active_org_id`; `stored_org_id` is exposed only so a\nsettings page can say \"your saved choice is no longer available\" instead\nof silently showing something else as active.\n\nA caller who belongs to no organization gets an empty list and a null\n`active_org_id` rather than an error \u2014 this endpoint backs a settings page\nthat a not-yet-provisioned user still needs to be able to load.\n",
        "responses": {
          "200": {
            "description": "The caller's organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationList"
                },
                "example": {
                  "organizations": [
                    {
                      "org_id": "natural-machine",
                      "display_name": "Natural Machine",
                      "is_active": true
                    },
                    {
                      "org_id": "example-lab",
                      "display_name": "Example Lab",
                      "is_active": false
                    }
                  ],
                  "active_org_id": "natural-machine",
                  "stored_org_id": "natural-machine"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/tags": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listMyTags",
        "summary": "The tags the caller holds.",
        "description": "What the site reads to know what to show the caller. Showing or hiding\nis only display: the server refuses what a tag allows to anyone without\nit.\n",
        "responses": {
          "200": {
            "description": "The caller's tags.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MyTags"
                },
                "example": {
                  "tags": [
                    "developer"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/me/active-organization": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "setMyActiveOrganization",
        "summary": "Choose which organization the caller is acting under.",
        "description": "Sets the organization subsequent jobs are submitted under. Takes effect on\nthe caller's next request; work already submitted is unaffected and stays\nwhere it was written.\n\nThe stored value is a preference, never a grant. It is re-checked against\nlive memberships on every request, so it can only ever narrow to something\nthe caller is genuinely a member of \u2014 losing a membership silently stops\nthe preference applying rather than leaving stale access behind.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetActiveOrganizationRequest"
              },
              "example": {
                "org_id": "example-lab"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization now in effect.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveOrganization"
                },
                "example": {
                  "active_org_id": "example-lab"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The caller is not a member of that organization. Deliberately not a\n404: the organization may well exist, and a non-member should not\nlearn that from this endpoint.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotAMemberError"
                },
                "example": {
                  "error": "Not a member of organization 'other-org'.",
                  "organizations": [
                    "natural-machine"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/organizations": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListOrganizations",
        "summary": "Every organization, with its grants and member count.",
        "description": "System administrators only. `/api/me/organizations` answers \"mine\"; this\nanswers \"every\", which had no home outside the database.\n\n`member_count` is the field that earns its place. An org holding compute\ngrants and no members reads, from every other view, as a machine somebody\ncan reach \u2014 and the only way to tell was to read two tables by hand.\n",
        "responses": {
          "200": {
            "description": "All organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrganizationList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator. Deliberately the same shape as the\norg-admin refusal: whether the platform role exists is not a caller's\nbusiness.\n"
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "adminCreateOrganization",
        "summary": "Create an organization.",
        "description": "System administrators only. Conditional on the slug being free, so two\nadmins creating the same org cannot silently replace one another's grants.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminCreateOrganization"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrganization"
                }
              }
            }
          },
          "400": {
            "description": "Invalid slug, or an organization by that name exists."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/organizations/{org_id}/members": {
      "parameters": [
        {
          "name": "org_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListOrgMembers",
        "summary": "Everyone in one organization.",
        "description": "System administrators only. Membership had no read surface outside the\ndatabase, so \"who is in this org, and which of them are admins\" was a\nDynamoDB query.\n",
        "responses": {
          "200": {
            "description": "The organization's members.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrgMemberList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "adminAddOrgMember",
        "summary": "Add somebody to an organization.",
        "description": "System administrators only. Creates the Cognito account when the address\nis new \u2014 Cognito emails a temporary password \u2014 and then writes the\nmembership row. That order matters: if account creation fails no row is\nwritten, whereas the reverse leaves a member who cannot sign in.\n\nAn address that already has an account is added without a second\ninvitation, which is the ordinary path for putting someone in a second\norganization.\n\nRefuses an existing membership rather than overwriting it, so re-adding\nsomebody cannot quietly reset an admin back to member.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminAddOrgMember"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new member.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrgMemberEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Unknown organization, malformed email or role, or already a member."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "502": {
            "description": "The account could not be created. No membership row was written, so\nthe organization is unchanged and the request can be retried.\n"
          }
        }
      }
    },
    "/api/admin/organizations/{org_id}/members/{email}": {
      "parameters": [
        {
          "name": "org_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "email",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "email"
          }
        }
      ],
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetOrgMemberRole",
        "summary": "Change what somebody may do inside an organization.",
        "description": "System administrators only. Conditional on the membership existing, so a\nmistyped address is an error rather than a new membership with a role and\nno invitation behind it.\n\nThis is the only writer of the field. `scripts/identity/invite_user.py`\nhardcodes `member`, so before this route every org admin had to be made by\nediting DynamoDB directly \u2014 and prod ran with none at all, which made\nregistering a machine answer 403 for everybody.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSetOrgMemberRole"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated member.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminOrgMemberEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Not a member of this organization, or an invalid role."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/tags": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListTags",
        "summary": "Every tag a person may be given, and what it lets them do.",
        "description": "System administrators only.",
        "responses": {
          "200": {
            "description": "The tags.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TagList"
                },
                "example": {
                  "tags": [
                    {
                      "name": "system-admin",
                      "description": "Administers the platform."
                    },
                    {
                      "name": "developer",
                      "description": "Saves and imports demos, and is shown draft versions of workflows."
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/users": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminUsers",
        "summary": "Every user by id, with the addresses they signed in with.",
        "description": "System administrators only. What the Log page reads the event log's user\nids by: events name a user by id, never by address.\n",
        "responses": {
          "200": {
            "description": "The users.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserList"
                },
                "example": {
                  "users": [
                    {
                      "user_id": "61eb2510-30a1-70d4-0bd5-3f3b9a2d6c11",
                      "emails": [
                        "researcher@example.org"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/users/{email}/tags": {
      "parameters": [
        {
          "name": "email",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "format": "email"
          }
        }
      ],
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetUserTags",
        "summary": "Make somebody hold exactly the tags given.",
        "description": "System administrators only. Tags belong to the person, not to one of\ntheir organizations, and none excludes another.\n\nRefused with 400 for a name that is not a tag, and with 409 for\nsomebody who has not signed in yet, and for a system admin taking their\nown `system-admin` tag away: another system admin does that, so the\nportal is never left with nobody to give it back.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSetUserTags"
              },
              "example": {
                "tags": [
                  "developer"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tags they now hold.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserTags"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/compute-hosts": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListComputeHosts",
        "summary": "Every registered machine and the organizations it serves.",
        "description": "System administrators only. A machine's `org_ids` are the organizations\nit serves, which are the organizations whose members may use it: there\nis no other list of who may use a machine.\n",
        "responses": {
          "200": {
            "description": "All registered hosts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminComputeHostList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/compute-hosts/{host_id}/orgs": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetComputeHostOrgs",
        "summary": "Replace the set of organizations a machine serves.",
        "description": "Two callers, different reach. A system administrator may name any\norganization \u2014 that is how a machine we provision is shared with an org\nthey are not a member of. An organization administrator may name only\norgs they administer, and only for a machine one of those owns, which\nlets someone who brought a machine share it across their own\norganizations without handing it to a stranger's, and keeps a group that\nis lent a machine from changing who else has it.\n\nThe set always holds the organization that owns the machine.\n\nReplaces rather than adds. The caller sends the set they want, so the\nresult does not depend on what was there and two admins editing at once\ncannot interleave into a set neither asked for.\n\nAn empty set is refused. A machine serving nobody still polls and still\nleases, but every data call it makes is refused \u2014 from the daemon that\nreads as an outage. Revoking is how a machine is taken out of service.\n",
        "parameters": [
          {
            "name": "host_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "org_ids"
                ],
                "properties": {
                  "org_ids": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "org_ids": [
                  "nm",
                  "nm-exec"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The machine's new organization set.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "host_id",
                    "org_ids"
                  ],
                  "properties": {
                    "host_id": {
                      "type": "string"
                    },
                    "org_ids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No organizations named, or the machine's owner left out."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "An organization was named that the caller does not administer, or\nthe machine is not one of the caller's organizations' own.\n"
          },
          "404": {
            "description": "No such machine \u2014 also returned when the caller administers no\norganization this machine serves, since whether a host exists\nelsewhere is not theirs to learn.\n"
          }
        }
      }
    },
    "/api/admin/compute-hosts/{host_id}/owner": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetComputeHostOwner",
        "summary": "Say which organization a machine belongs to.",
        "description": "System administrators only. A machine has one owner among the\norganizations it serves. Its owner's administrators alone revoke it,\nshare it and move its worker; an organization it is shared with sees it\nand uses it, and no more.\n\nA machine registered from the admin page belongs to the organization\nthat registered it. This is for the rest: one registered before machines\nhad owners, one we provision, and one that changes hands. Until an owner\nis on record no organization's administrator can revoke the machine or\nmove its worker.\n",
        "parameters": [
          {
            "name": "host_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "org_id"
                ],
                "properties": {
                  "org_id": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "org_id": "nm"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The machine's owner.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "host_id",
                    "owner_org_id"
                  ],
                  "properties": {
                    "host_id": {
                      "type": "string"
                    },
                    "owner_org_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The organization named is not one the machine serves."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "No such machine."
          }
        }
      }
    },
    "/api/admin/compute-hosts/{host_id}/labels": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetComputeHostLabels",
        "summary": "Set what a machine is, its labels and taints.",
        "description": "System administrators only. A machine's labels say what it is, and a job\nmay ask for any of them; its taints keep jobs off it unless a job\ntolerates them or names the machine. Both are replaced at once. Takes\neffect at the next submission, with no deploy.\n",
        "parameters": [
          {
            "name": "host_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MachineLabelsAndTaints"
              },
              "example": {
                "labels": {
                  "lifetime": "persistent",
                  "accelerator": "cuda",
                  "arch": "arm64"
                },
                "taints": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What the machine now is.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "host_id",
                    "labels",
                    "taints"
                  ],
                  "properties": {
                    "host_id": {
                      "type": "string"
                    },
                    "labels": {
                      "$ref": "#/components/schemas/MachineLabels"
                    },
                    "taints": {
                      "$ref": "#/components/schemas/MachineTaints"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A label or taint is not written as one is."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "No such machine."
          }
        }
      }
    },
    "/api/admin/organizations/{org_id}/default-machines": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetOrganizationDefaultMachines",
        "summary": "Set where an organization's jobs go when they name no machine.",
        "description": "System administrators only. A job that names no machine goes to the\nfirst of these, in this order, that suits it: one that can run its tool,\ncarries the labels it asks for and has no taint it does not tolerate. A\njob none suits is refused, saying why of each. Each must be a machine\nthe organization may use. Takes effect at the next submission.\n",
        "parameters": [
          {
            "name": "org_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "machines"
                ],
                "additionalProperties": false,
                "properties": {
                  "machines": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "machines": [
                  "cloud-cpu",
                  "spark-nm-2"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The organization's default machines, in order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "org_id",
                    "default_machines"
                  ],
                  "properties": {
                    "org_id": {
                      "type": "string"
                    },
                    "default_machines": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A machine named twice, or one the organization may not use."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "No such organization."
          }
        }
      }
    },
    "/api/me/compute-hosts": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listComputeHosts",
        "summary": "The machines that serve the caller's organization.",
        "description": "Administrators only. Never returns a secret: an enrollment code and a host\ntoken are stored hashed and shown once, so there is nothing here to leak.\n\nA machine is listed for every organization it serves. `owned` says\nwhether it is the caller's organization's own, which is what lets its\nadministrators revoke it and move its worker.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's registered machines.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComputeHostList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not an administrator of the active organization."
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "registerComputeHost",
        "summary": "Register a machine and get a one-time enrollment code.",
        "description": "Administrators only: the code this returns lets a machine obtain a\ncredential that reads and writes the organization's job data for jobs\ndispatched to it.\n\nThe code is shown **once**. Only its hash is stored, so it cannot be\nretrieved again \u2014 if it is lost, register the machine afresh. That is what\nlets the table be read without reading a credential out of it.\n\nThe machine is `pending` until it redeems the code, and is dispatched\nnothing until it is `active`.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterComputeHostRequest"
              },
              "example": {
                "display_name": "Lab workstation",
                "classes": [
                  "gpu-daemon"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered. Hand the code to whoever runs the machine.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterComputeHostResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not an administrator of the active organization."
          }
        }
      }
    },
    "/api/me/compute-hosts/{host_id}": {
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "revokeComputeHost",
        "summary": "Revoke a registered machine.",
        "description": "Administrators of the organization that owns the machine only. Its token\nstops working at once; no credential TTL has to expire first.\n\nThe record is kept rather than deleted \u2014 it is the history of a machine\nthat once had access, and removing it would erase that. A revoked host can\nnever be reactivated; register again, which issues a fresh code.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "host_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "byoc-1f4c2a9b8d3e5607"
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevokedComputeHost"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not an administrator of the active organization, or the machine\nbelongs to another organization, or has no owner on record.\n"
          },
          "404": {
            "description": "No such host in this organization. Deliberately not distinguished from\na host that exists elsewhere \u2014 whose ids exist is not this\norganization's to learn.\n"
          }
        }
      }
    },
    "/api/me/compute-hosts/{host_id}/worker-update": {
      "parameters": [
        {
          "name": "host_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "example": "byoc-1f4c2a9b8d3e5607"
        }
      ],
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "requestWorkerUpdate",
        "summary": "Ask a machine's worker to move to another version.",
        "description": "Administrators of the organization that owns the machine only. The\nworker is told when it next asks for work, and moves once it is running\nno job: it starts the new version in its own\nplace, with the settings it was started with, and puts itself back if the\nnew one does not stay up. The machine is not registered again.\n\nThe worker is told a version and nothing else. It knows where its own\nimage is published, so this cannot send a machine to any other image.\n\nOnly a version this portal offers as a move (`worker_release.updates` of\nthe listing), and only of a worker that says it can move itself\n(`worker.remote_update`). Any other worker is moved with the update\ncommand, run on the machine. A move asked while another is waiting\nreplaces it.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerUpdateRequest"
              },
              "example": {
                "version": "2026.10.5"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Asked. The listing says where the move stands.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerUpdateAnswer"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not an administrator of the active organization, or the machine\nbelongs to another organization.\n"
          },
          "404": {
            "description": "No such host in this organization."
          },
          "409": {
            "description": "The machine is not active, its worker cannot move itself, or its\nworker is already that version.\n"
          }
        }
      },
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "withdrawWorkerUpdate",
        "summary": "Withdraw a move asked of a machine's worker.",
        "description": "Administrators of the organization that owns the machine only. A move\nthe worker has not been told of is withdrawn, as is one that stalled or\nfailed. A move the worker has been\nhanded and may still be making is not: taking it off the record would not\nstop the machine.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Withdrawn.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerUpdateAnswer"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not an administrator of the active organization."
          },
          "404": {
            "description": "No such host in this organization, or no move is asked of it."
          },
          "409": {
            "description": "The worker has been told and is moving."
          }
        }
      }
    },
    "/api/admin/worker-releases": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListWorkerReleases",
        "summary": "The host worker versions this portal offers its machines.",
        "description": "System administrators only. The list is kept by hand: a version is\noffered because someone chose to offer it. The newest is the one every\nmachine's worker is held against.\n",
        "responses": {
          "200": {
            "description": "The versions offered, the newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminWorkerReleaseList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      },
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "adminAddWorkerRelease",
        "summary": "Offer a host worker version.",
        "description": "System administrators only. The worker's image is looked up first: a\nversion no machine can fetch would leave every machine behind for good.\nNothing is added when the image's registry cannot be asked.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerUpdateRequest"
              },
              "example": {
                "version": "2026.10.5"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Offered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminWorkerReleaseAdded"
                }
              }
            }
          },
          "400": {
            "description": "Not a version, or its image is not published."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "409": {
            "description": "That version is already offered."
          },
          "502": {
            "description": "The image's registry could not be asked. Nothing was added."
          }
        }
      }
    },
    "/api/admin/worker-releases/{version}": {
      "delete": {
        "tags": [
          "account"
        ],
        "operationId": "adminRemoveWorkerRelease",
        "summary": "Stop offering a host worker version.",
        "description": "System administrators only. A move to it that no worker has been handed\nis withdrawn with it. A machine already on that version stays on it.\n",
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "2026.10.5"
          }
        ],
        "responses": {
          "200": {
            "description": "No longer offered.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerUpdateRequest"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "No such worker release."
          }
        }
      }
    },
    "/api/me/hidden-pages": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "listHiddenPages",
        "summary": "The pages a system admin has hidden from the sidebar and the \"Learn more\" menu.",
        "description": "The same for every caller. A hidden page is hidden from everyone but\nsystem administrators and holders of the `developer` tag: the site\nleaves out its link and does not open its address. A `workflow` or a `document` is named by its name, a\n`tool-page` by its address on the site, and a `menu-item` by the name\nthe site gives one of its own entries in the \"Learn more\" menu.\n\nThe server holds back what it serves of a hidden workflow from anyone\nelse: `listRegisteredWorkflows` leaves it out,\n`createWorkflowSession` refuses it, and its demos do not open. A hidden\ndocument is left out of `listRegisteredDocuments`. The tools a hidden\ntool page runs are not held back.\n",
        "responses": {
          "200": {
            "description": "Every hidden page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HiddenPageList"
                },
                "example": {
                  "pages": [
                    {
                      "kind": "menu-item",
                      "name": "api-reference"
                    },
                    {
                      "kind": "tool-page",
                      "name": "#/tools/sbm/train"
                    },
                    {
                      "kind": "workflow",
                      "name": "thermostability"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/hidden-pages": {
      "put": {
        "tags": [
          "account"
        ],
        "operationId": "adminSetHiddenPage",
        "summary": "Hide one page from the sidebar or the \"Learn more\" menu, or show it again.",
        "description": "System administrators only. It takes effect at once, for every\norganization in this environment.\n\nRefused with 400 for a kind that is not one, a tool page named by\nsomething that is not an address and a menu entry by something that is\nnot a name, and with 404 for hiding a workflow or a document that is not\nregistered. Showing a page that is not hidden changes nothing.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSetHiddenPage"
              },
              "example": {
                "kind": "tool-page",
                "name": "#/tools/sbm/train",
                "hidden": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every hidden page, now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HiddenPageList"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/admin/versions": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListVersions",
        "summary": "Every registered version of the parts this portal runs.",
        "description": "System administrators only. Each toolkit, workflow, document and chat\nagent, and the devkit handler: which version is active, who promoted it\nand when, and every registered version with the source it was registered\nfrom. Each item the portal holds, by release. Then every datatype, draft\nor final.\n\nOnly this environment's own registries are read. The site is not listed:\nthe environment serves the promoted site release's record at\n`/site-release.json`.\n",
        "responses": {
          "200": {
            "description": "The registries, each list of versions newest registration first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminVersions"
                },
                "examples": {
                  "registered": {
                    "summary": "One toolkit with a newer version not yet promoted.",
                    "value": {
                      "toolkits": [
                        {
                          "name": "mysca",
                          "active": "2026.10.5",
                          "promoted_at": 1792000000,
                          "promoted_by": "admin@example.com",
                          "versions": [
                            {
                              "version": "2026.10.6",
                              "registered_at": 1792100000,
                              "registered_by": "admin@example.com",
                              "source_repo": "https://github.com/natural-machine/nm-toolkit-mysca",
                              "source_commit": "a16d06b0c3e2f1d4b5a6978877665544332211ff",
                              "devkit": 0,
                              "image": "toolkits/mysca@sha256:4c32be15885e02230e6cf9694afe35b95daef48430a86c082b37d7fa58db97c8"
                            },
                            {
                              "version": "2026.10.5",
                              "registered_at": 1791900000,
                              "registered_by": "admin@example.com",
                              "source_repo": "",
                              "source_commit": "",
                              "devkit": 0,
                              "image": "mysca@sha256:ef16f33eec71f35c637b85df9946a6a1216398b09ec5e008559aa69e04f3fc6e"
                            }
                          ]
                        }
                      ],
                      "workflows": [
                        {
                          "name": "about-my-protein",
                          "active": "2026.10.1",
                          "promoted_at": 1791950000,
                          "promoted_by": "admin@example.com",
                          "versions": [
                            {
                              "version": "2026.10.1",
                              "registered_at": 1791940000,
                              "registered_by": "admin@example.com",
                              "source_repo": "https://github.com/natural-machine/nm-portal-workflows",
                              "source_commit": "3dfb42f0a1b2c3d4e5f60718293a4b5c6d7e8f90",
                              "release": "ghcr.io/natural-machine/nm-portal-workflows/about-my-protein@sha256:ef16f33eec71f35c637b85df9946a6a1216398b09ec5e008559aa69e04f3fc6e"
                            }
                          ]
                        }
                      ],
                      "documents": [],
                      "agents": [
                        {
                          "name": "default",
                          "active": "2026.10.0",
                          "promoted_at": 1792300000,
                          "promoted_by": "admin@example.com",
                          "versions": [
                            {
                              "version": "2026.10.0",
                              "registered_at": 1792290000,
                              "registered_by": "admin@example.com",
                              "source_repo": "https://github.com/natural-machine/nm-portal-agents",
                              "source_commit": "6ba7d14a1b2c3d4e5f60718293a4b5c6d7e8f901",
                              "release": "ghcr.io/natural-machine/nm-portal-agents/default@sha256:2a11709f369d1da3f9bb57d89e5709ad04c7d8e00de2f8f7d372a56565098beb",
                              "model": "claude-sonnet-4-6"
                            },
                            {
                              "version": "0",
                              "registered_at": 1791298640,
                              "registered_by": "db/migrations/0012",
                              "source_repo": "",
                              "source_commit": "",
                              "release": "",
                              "model": "claude-sonnet-4-6"
                            }
                          ]
                        }
                      ],
                      "devkit_handler": {
                        "active": null,
                        "promoted_at": null,
                        "promoted_by": "",
                        "versions": []
                      },
                      "datatypes": [
                        {
                          "ref": "fasta@1",
                          "owner": "",
                          "state": "final",
                          "registered_at": 1791000000,
                          "registered_by": "admin@example.com",
                          "finalized_at": 1791100000
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/versions/{kind}/{name}/promote": {
      "post": {
        "tags": [
          "account"
        ],
        "operationId": "adminPromoteVersion",
        "summary": "Make a registered version of a toolkit, workflow, document, held item or agent the active one.",
        "description": "System administrators only. The version must be registered and not\nalready active. Promoting an earlier version again is the rollback. The\npromotion is recorded under the administrator's email.\n",
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "toolkits",
                "workflows",
                "documents",
                "holdings",
                "agents"
              ]
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromoteRequest"
              },
              "example": {
                "version": "2026.10.6"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Promoted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Promotion"
                },
                "example": {
                  "kind": "toolkits",
                  "name": "mysca",
                  "version": "2026.10.6",
                  "previous": "2026.10.5",
                  "promoted_by": "admin@example.com"
                }
              }
            }
          },
          "400": {
            "description": "No version was named."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "404": {
            "description": "Not a kind promoted here, or the version is not registered."
          },
          "409": {
            "description": "The version is already active, or the registry refused it: a tool it holds belongs to another toolkit, another promotion landed first, or its stored record no longer matches its checksum."
          }
        }
      }
    },
    "/api/admin/stacks": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminListStacks",
        "summary": "The stacks this environment is deployed as, and what each was last deployed from.",
        "description": "System administrators only. Every CloudFormation stack of this\nenvironment, read from AWS: its status, when it was last deployed, and\nthe repository and commit that deploy was made from, with whether that\ncheckout had changes not committed. A stack last deployed before it\nsaid so has each of the three empty. Stacks are deployed separately, so\nthey need not all be on one commit.\n\nA portal not deployed as stacks, such as a local one, has none.\n",
        "responses": {
          "200": {
            "description": "The stacks, by name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminStacks"
                },
                "examples": {
                  "deployed": {
                    "summary": "One stack deployed since it said, one before.",
                    "value": {
                      "stacks": [
                        {
                          "name": "Dev-NMPortalServer",
                          "status": "UPDATE_COMPLETE",
                          "deployed_at": 1792185000,
                          "repository": "https://github.com/natural-machine/nm-portal",
                          "commit": "6d1a95b0c3e2f1d4b5a6978877665544332211ff",
                          "tree": "clean"
                        },
                        {
                          "name": "Dev-NMPortalMcpHost",
                          "status": "UPDATE_COMPLETE",
                          "deployed_at": 1788000000,
                          "repository": "",
                          "commit": "",
                          "tree": ""
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          },
          "502": {
            "description": "The environment's stacks could not be read from AWS."
          }
        }
      }
    },
    "/api/admin/usage": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminUsage",
        "summary": "Each organization's use of the portal over a period.",
        "description": "System administrators only. For each organization, and for each person\nin it: sign-ins and the sign-in apps they were made through, the days\nthe person's token reached the portal and when it last did, jobs, and\nthe portal assistant's calls to its model with their tokens and cost;\nfiles sent out of the portal's storage, to people or agents acting for\nthem and to machines running jobs (`GET /api/files/{token}`); and\nuploads.\n\nSign-ins and active days are a person's, not an organization's, so they\nare given under each organization the person belongs to. Someone who has\nleft an organization is listed under it, with no `role`, when they ran a\njob or used the assistant there in the period. A day is a UTC date, and\na person's activity is noted at most every five minutes.\n\nJobs are counted from each job's own record. A job submitted before its\nrecord said where it came from is counted as \"not recorded\" there, as\nare sign-ins copied from the sign-in log, which did not record the app.\n\nOnly this environment is read.\n",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "The start of the period, in seconds since 1970. Absent for no start.",
            "schema": {
              "type": "number",
              "example": 1792000000
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "description": "The end of the period, not included, in seconds since 1970. Absent for no end.",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The period, and each organization's use of the portal in it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUsage"
                },
                "examples": {
                  "one-org": {
                    "summary": "One organization with one member.",
                    "value": {
                      "since": 1792000000,
                      "until": null,
                      "apps_error": null,
                      "machines": {
                        "spark-nm": "spark-nm"
                      },
                      "organizations": [
                        {
                          "org_id": "nm",
                          "display_name": "Natural Machine",
                          "members": 1,
                          "sign_ins": 2,
                          "active_people": 1,
                          "unreadable_job_records": 0,
                          "sent": {
                            "files": 2,
                            "bytes": 52428800,
                            "bytes_by_kind": {
                              "job files": 52428800
                            },
                            "bytes_by_origin": {
                              "website: tools/blast/identify": 50331648,
                              "MCP connector": 2097152
                            }
                          },
                          "sent_to_machines": {
                            "files": 1,
                            "bytes": 6442450944,
                            "bytes_by_kind": {
                              "held data": 6442450944
                            },
                            "bytes_by_machine": {
                              "spark-nm-2": 6442450944
                            }
                          },
                          "uploads": {
                            "files": 1,
                            "bytes": 51234
                          },
                          "jobs": {
                            "count": 1,
                            "run_seconds": 42.5,
                            "by_status": {
                              "done": 1
                            },
                            "by_tool": {
                              "blast-identify": 1
                            },
                            "by_machine": {
                              "spark-nm": 1
                            },
                            "by_origin": {
                              "website: tools/blast/identify": 1
                            }
                          },
                          "assistant": {
                            "conversations": 1,
                            "turns": 2,
                            "model_calls": 3,
                            "input_tokens": 1200,
                            "output_tokens": 300,
                            "cache_creation_input_tokens": 5000,
                            "cache_read_input_tokens": 10000,
                            "dollars": 0.0465,
                            "by_agent": {
                              "default": {
                                "model_calls": 3,
                                "dollars": 0.0465
                              }
                            }
                          },
                          "people": [
                            {
                              "email": "someone@example.com",
                              "user_id": "0b8c5a1e-0000-4000-8000-000000000000",
                              "role": "admin",
                              "sign_ins": 2,
                              "sign_ins_by_app": {
                                "website": 1,
                                "not recorded": 1
                              },
                              "last_sign_in_at": 1792100000,
                              "active_days": 2,
                              "last_active_at": 1792190000,
                              "jobs": {
                                "count": 1,
                                "run_seconds": 42.5,
                                "by_status": {
                                  "done": 1
                                },
                                "by_tool": {
                                  "blast-identify": 1
                                },
                                "by_machine": {
                                  "spark-nm": 1
                                },
                                "by_origin": {
                                  "website: tools/blast/identify": 1
                                }
                              },
                              "assistant": {
                                "conversations": 1,
                                "turns": 2,
                                "model_calls": 3,
                                "input_tokens": 1200,
                                "output_tokens": 300,
                                "cache_creation_input_tokens": 5000,
                                "cache_read_input_tokens": 10000,
                                "dollars": 0.0465,
                                "by_agent": {
                                  "default": {
                                    "model_calls": 3,
                                    "dollars": 0.0465
                                  }
                                }
                              },
                              "sent": {
                                "files": 2,
                                "bytes": 52428800
                              },
                              "uploads": {
                                "files": 1,
                                "bytes": 51234
                              }
                            }
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Not a system administrator."
          }
        }
      }
    },
    "/api/admin/events": {
      "get": {
        "tags": [
          "account"
        ],
        "operationId": "adminEvents",
        "summary": "The events the portal recorded, newest first, a page at a time.",
        "description": "System administrators only. Each event is something that happened in\nthe portal as it happened: a job's status changing, a request answered\nwith 400 or above and its reason, a sign-in, a file sent, a new\nconversation, an assistant turn that failed, an error in a user's\nbrowser (`POST /api/client-events`).\n\nThe portal hands the query to the event-log layer as given, and answers\nwith the layer's answer (nm-portal-event-log), so which filters there\nare, the level each event is kept at, and how long it is kept are the\nlayer's. Those of the layer's first release are described below; a\nlater release may take more, and its answer may hold more. A user is\nnamed by the portal's own id, never by an email.\n\nBesides the parameters listed, `details.<key>=<value>` keeps the events\nwhose details hold that value under that key, for example\n`details.job_id=0f3c2a91-77d2-4c1e-9a55-2b1d6e4f8a03`.\n\nOnly this environment is read.\n",
        "parameters": [
          {
            "name": "level",
            "in": "query",
            "required": false,
            "description": "Keep events at any of these levels.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "error",
                  "warning",
                  "info"
                ]
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "Keep events of any of these kinds, such as `job.status`.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "description": "Keep events concerning any of these users, by the portal's own id.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "org_id",
            "in": "query",
            "required": false,
            "description": "Keep events in any of these organizations.",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "The start of the period, in seconds since 1970, included.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "description": "The end of the period, in seconds since 1970, not included.",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many events a page holds, 1 to 500; 100 when absent.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "An earlier answer's `next`, for the page after it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The layer's answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventPage"
                },
                "example": {
                  "events": [
                    {
                      "event_id": "3b6e1f0a-7c2d-4e55-9a10-2f4c8d9e1b23",
                      "time": 1794954158.0,
                      "kind": "job.status",
                      "level": "error",
                      "user_id": "210b85f0-e0b1-7086-879f-0f3e428c567e",
                      "org_id": "nm",
                      "details": {
                        "job_id": "713ea87d-33f3-4d89-a385-febf46ce60ed",
                        "status": "failed",
                        "previous": "running",
                        "tool_id": "hello-greet",
                        "error": "error: out of memory",
                        "message": "job 713ea87d-33f3-4d89-a385-febf46ce60ed is failed"
                      }
                    }
                  ],
                  "next": null,
                  "kinds": [
                    "job.status",
                    "request",
                    "sign_in"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The portal keeps no event log here: none of its database was given,\nno version of the layer is promoted, or its database is behind what\nthe promoted version needs.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/workflow-sessions": {
      "get": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "listWorkflowSessions",
        "summary": "The caller's workflow sessions, most recently updated first.",
        "description": "Backs the picker on a workflow's first step, which is why the rows carry\nno `state`: twenty sessions' worth of saved state would make the opening\nscreen of every workflow the heaviest response in the app. Read one\nsession to get its state.\n\nDefaults to `active` sessions in the caller's active organization.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "workflow_id",
            "in": "query",
            "required": false,
            "description": "Only sessions of this workflow.",
            "schema": {
              "$ref": "#/components/schemas/WorkflowId"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Defaults to `active`. Pass `archived` for the rest.",
            "schema": {
              "$ref": "#/components/schemas/SessionStatus"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many sessions to return. Clamped rather than rejected, as the job\nlisting does: above 100 becomes 100, below 1 becomes 1, unparseable\nfalls back to 50.\n",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "How many to skip. Negative and unparseable values clamp to 0.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Ask for `jobs` on each row: every session's job index in one response.\n\nFor the reverse mapping \u2014 which session a job belongs to \u2014 over a job\nlist that is already on screen. Without it the caller would read each\nsession in turn to find out, which is a request per session to answer\none question about all of them.\n\nOmitted by default because the picker this listing backs needs the\ncount and not the index.\n",
            "schema": {
              "type": "string",
              "enum": [
                "jobs"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of sessions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionList"
                },
                "example": {
                  "total": 2,
                  "sessions": [
                    {
                      "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                      "workflow_id": "biom3-sequences",
                      "name": "kinase_round_3",
                      "org_id": "natural-machine",
                      "status": "active",
                      "resume_step": "generate",
                      "created_at": 1786013500.22,
                      "updated_at": 1786100430.87,
                      "version": 47,
                      "job_count": 9
                    },
                    {
                      "session_id": "8c2e5d61-04af-4b93-8e77-1a0d9f3b6c25",
                      "workflow_id": "biom3-sequences",
                      "name": "biom3-sequences_20260901-104233",
                      "org_id": "natural-machine",
                      "status": "active",
                      "resume_step": "inputs",
                      "created_at": 1785900000.1,
                      "updated_at": 1785900412.55,
                      "version": 3,
                      "job_count": 1
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "createWorkflowSession",
        "summary": "Start a named session on a workflow.",
        "description": "The server mints `session_id`, the same way a dispatcher mints `job_id`:\nidentity is not something a caller supplies. `workflow_id` is the caller's\nto state \u2014 it names a frontend manifest, and the backend has no registry\nof those \u2014 which is why it is an enum here rather than free text.\n\n`org_id` is stamped from the caller's active organization, because that is\nwhere this session's jobs will be written.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSessionRequest"
              },
              "example": {
                "workflow_id": "biom3-sequences",
                "name": "kinase_round_3",
                "resume_step": "inputs"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionDetail"
                },
                "example": {
                  "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                  "workflow_id": "biom3-sequences",
                  "name": "kinase_round_3",
                  "org_id": "natural-machine",
                  "status": "active",
                  "resume_step": "inputs",
                  "created_at": 1786013500.22,
                  "updated_at": 1786013500.22,
                  "version": 1,
                  "job_count": 0,
                  "state": {},
                  "jobs": []
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The caller acts in no organization, or the workflow is one a system\nadmin has hidden (`listHiddenPages`) and the caller is neither a\nsystem admin nor a developer.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The caller already has a session with this name on this workflow.\nNames are unique per caller per workflow \u2014 two people may both have a\n`round_3`, and so may one person on two different workflows.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is over 10 MiB, the most the API server reads on any route, or an input exceeds the ceiling for its argument.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/workflow-sessions/{session_id}": {
      "get": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "getWorkflowSession",
        "summary": "One session, with its saved state and job index.",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionDetail"
                },
                "example": {
                  "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                  "workflow_id": "biom3-sequences",
                  "name": "kinase_round_3",
                  "org_id": "natural-machine",
                  "status": "active",
                  "resume_step": "generate",
                  "created_at": 1786013500.22,
                  "updated_at": 1786100430.87,
                  "version": 47,
                  "job_count": 2,
                  "state": {
                    "pfamId": "PF00069",
                    "buildJobId": "41d2-8a7c",
                    "finetuneJobId": "7b3e-2f19",
                    "prompts": [
                      "a thermostable kinase domain"
                    ]
                  },
                  "jobs": [
                    {
                      "job_id": "7b3e-2f19",
                      "tool_id": "biom3-finetune-generalized",
                      "role": "finetune",
                      "step": "finetune",
                      "submitted_at": 1786014000.1
                    },
                    {
                      "job_id": "41d2-8a7c",
                      "tool_id": "bioparsers-build-swissprot-fields",
                      "role": "dataset-build",
                      "step": "inputs",
                      "submitted_at": 1786013600.44
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "updateWorkflowSession",
        "summary": "Rename a session, or archive and restore it.",
        "description": "Separate from the state route on purpose. This is a deliberate write by a\nperson; the state route is a debounced write by a timer. Keeping them apart\nmeans autosave can never race a rename.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchSessionRequest"
              },
              "example": {
                "name": "kinase_round_3_final"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionSummary"
                },
                "example": {
                  "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                  "workflow_id": "biom3-sequences",
                  "name": "kinase_round_3_final",
                  "org_id": "natural-machine",
                  "status": "active",
                  "resume_step": "generate",
                  "created_at": 1786013500.22,
                  "updated_at": 1786100600.31,
                  "version": 47,
                  "job_count": 9
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Another of the caller's sessions on this workflow has that name.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "deleteWorkflowSession",
        "summary": "Delete a session. Its jobs are not deleted.",
        "description": "Removes the session and its job index \u2014 never the jobs. A job is hours of\ncompute living under the outputs bucket's own lifecycle; a session is a\nlabel over a set of them, and deleting the label must not delete the work.\n\nIdempotent: deleting an unknown id succeeds.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted, or was already gone."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/workflow-sessions/{session_id}/state": {
      "put": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "writeWorkflowSessionState",
        "summary": "Save a session's workflow state.",
        "description": "The autosave route. Called on a short debounce while someone works, and\nonce more on a best-effort flush as the page unloads.\n\n`base_version` is the version the client last read. A mismatch is a 409\ncarrying the stored version, not an overwrite: two tabs open on the same\nworkflow is ordinary, and a last-writer-wins rule would silently discard\none of them. Nothing here merges \u2014 the loser stands down and says so.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteSessionStateRequest"
              },
              "example": {
                "base_version": 46,
                "resume_step": "generate",
                "state": {
                  "pfamId": "PF00069",
                  "buildJobId": "41d2-8a7c",
                  "finetuneJobId": "7b3e-2f19"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteSessionStateResponse"
                },
                "example": {
                  "version": 47,
                  "updated_at": 1786100430.87
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`base_version` is not the stored version \u2014 something else has written\nthis session since this client read it.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionConflict"
                },
                "example": {
                  "error": "Session was modified elsewhere (stored version 48)",
                  "version": 48,
                  "updated_at": 1786100500.02
                }
              }
            }
          },
          "413": {
            "description": "The request body is over 10 MiB, the most the API server reads on any route, or an input exceeds the ceiling for its argument.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/workflow-sessions/{session_id}/jobs": {
      "post": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "recordWorkflowSessionJob",
        "summary": "Record a job against a session.",
        "description": "Called right after a submission returns its 202. The client is what knows\nthis fact: a job document says which tool ran and under whose name, but\nnot which step of which session asked for it.\n\nIdempotent on `job_id` \u2014 a retried append does not double the row.\n\nDeliberately not written by the dispatchers. Tagging the job document at\nsubmit would make the association durable against a browser that dies in\nthe window between the 202 and this call, at the price of a field on every\ntool's submit schema and a line in all ten dispatchers. That trade is\nrecorded in `docs/.claude_docs/workflow-sessions-plan.md` and deliberately\nnot taken yet.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionJobRef"
              },
              "example": {
                "job_id": "7b3e-2f19",
                "tool_id": "biom3-finetune-generalized",
                "role": "finetune",
                "step": "finetune"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The session's job index, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionDetail"
                },
                "example": {
                  "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                  "workflow_id": "biom3-sequences",
                  "name": "kinase_round_3",
                  "org_id": "natural-machine",
                  "status": "active",
                  "resume_step": "finetune",
                  "created_at": 1786013500.22,
                  "updated_at": 1786014000.1,
                  "version": 12,
                  "job_count": 1,
                  "state": {
                    "pfamId": "PF00069"
                  },
                  "jobs": [
                    {
                      "job_id": "7b3e-2f19",
                      "tool_id": "biom3-finetune-generalized",
                      "role": "finetune",
                      "step": "finetune",
                      "submitted_at": 1786014000.1
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "workflow-sessions"
        ],
        "operationId": "listWorkflowSessionJobs",
        "summary": "A session's jobs, resolved against their status documents.",
        "description": "The session's job index joined to each job's `job_metadata.json`, returned\nas ordinary `JobSummary` rows so a session's job list and My Jobs render\nthrough the same components.\n\nA job whose status document is gone \u2014 cleaned up, or submitted under a\ndifferent organization \u2014 is counted in `total` and omitted from `jobs`.\nOne missing job does not fail the read.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          },
          {
            "name": "session_id",
            "in": "path",
            "required": true,
            "description": "A workflow session belonging to the caller. Another caller's id resolves as\nnot found rather than forbidden \u2014 the route does not confirm which ids\nexist.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The session's jobs, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionJobListing"
                },
                "example": {
                  "total": 2,
                  "jobs": [
                    {
                      "job_id": "7b3e-2f19",
                      "job_name": "kinase_round_3",
                      "tool_id": "biom3-finetune-generalized",
                      "target_id": "spark-nm",
                      "status": "running",
                      "step": "training",
                      "submitted_at": 1786014000.1,
                      "finished_at": null,
                      "submitted_by_email": "dev-user@localhost"
                    },
                    {
                      "job_id": "41d2-8a7c",
                      "job_name": "kinase_round_3-dataset",
                      "tool_id": "bioparsers-build-swissprot-fields",
                      "target_id": "cloud-cpu",
                      "status": "done",
                      "submitted_at": 1786013600.44,
                      "finished_at": 1786013740.91,
                      "submitted_by_email": "dev-user@localhost",
                      "result_size_bytes": 8412300
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "listDemos",
        "summary": "The demos the caller may open.",
        "description": "Every promoted demo, and the caller's own of any other status. A system\nadmin is given every demo. A demo of a workflow a system admin has hidden\n(`listHiddenPages`) is given to system admins and developers only, and\nopens for no one else.\n",
        "parameters": [
          {
            "name": "workflow_id",
            "in": "query",
            "required": false,
            "description": "Only demos of this workflow, of any of its versions.",
            "schema": {
              "$ref": "#/components/schemas/WorkflowId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The demos, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoList"
                },
                "examples": {
                  "none": {
                    "summary": "No demo is saved.",
                    "value": {
                      "demos": []
                    }
                  },
                  "one": {
                    "summary": "One promoted demo.",
                    "value": {
                      "demos": [
                        {
                          "demo_id": "0c5d7e2a-91f4-4b6e-8a3d-5f1e2b9c7a40",
                          "workflow_id": "biom3-sequences",
                          "workflow_version": "2026.10.5",
                          "title": "Designing a lysozyme",
                          "description": "Generate, fold and compare, from one prompt.",
                          "status": "promoted",
                          "made_at": 1792336761.94,
                          "changed_at": 1792340000.12,
                          "job_count": 12,
                          "file_count": 140,
                          "size_bytes": 18234011,
                          "yours": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "saveDemo",
        "summary": "Save one of the caller's sessions as a draft demo.",
        "description": "Takes the `developer` tag (403 without it). Answered once the demo's\nrecord is made, as `copying`; its jobs are copied after. Read the demo\nuntil it is a `draft`, or `failed`.\n\nEach job of the session's job index is copied: its record, its `inputs/`\nand its `results/`. The record is cleaned: who submitted the job and who\nasked to cancel it are left out, as is its results archive, and every key\nit holds names the demo's copy.\n\nRefused with 409 while a job of the session is still running, or when a\njob has no record (`running`, `missing`), and when the session states no\nversion of its workflow.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveDemoRequest"
              },
              "example": {
                "session_id": "3f9a1c04-7b52-4e18-9d6a-2c8b5e1f0a73",
                "title": "Designing a lysozyme",
                "toolkits": {
                  "biom3": "2026.10.4"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The demo, being copied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Demo"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/imports": {
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "importDemo",
        "summary": "Take in an export as a new draft of the caller's.",
        "description": "Takes the `developer` tag (403 without it). The export as `exportDemo`\ngave it, without the files' links. Checked first: the version of its workflow must be registered in this portal\n(409), and its files must be only those a demo keeps, each once, among\nthem the tool listing and every job's record (400). Answered with where\nto send each file; the demo is `copying` until `imported` is told they\nare all sent.\n",
        "parameters": [
          {
            "name": "X-NM-Org-Id",
            "in": "header",
            "required": false,
            "description": "The organization the caller is acting under. Data is kept per\norganization, so a request has to know which one \u2014 and because a user can\nswitch organizations at any time, and may have two tabs open in two of them,\nthis is a property of the *request* rather than of the session or the token.\n\nThe caller must belong to it; naming an organization they do not belong to\nis refused with 403. When omitted, the server uses the organization saved\nvia `PUT /api/me/active-organization` if the caller still belongs to it,\nelse their first membership. Every route that acts under an organization\nresolves it this way.\n",
            "schema": {
              "type": "string",
              "example": "natural-machine"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemoExport"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new demo, and where to send its files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoImportStarted"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "getDemo",
        "summary": "One demo, with its session's state and job index.",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The demo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "demos"
        ],
        "operationId": "deleteDemo",
        "summary": "Delete a demo and its copies.",
        "description": "By its maker or a system admin. A promoted demo is retired first (409).\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/export": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "exportDemo",
        "summary": "A demo as another portal imports it, with a link to each file.",
        "description": "Its record, and every file it keeps, each with a presigned GET. 409\nuntil the copy has ended.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoExport"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/imported": {
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "finishDemoImport",
        "summary": "Say every file of an import is sent.",
        "description": "By whoever imported it. Every file is checked for, at the size stated;\nwhile some are not there, 409 says which (`missing`, `wrong_size`), and\nthey may be sent again. Then each job's record is made to name the new\ndemo's copy, and the demo is a draft.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The demo, a draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Demo"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/promote": {
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "promoteDemo",
        "summary": "Let anyone signed in open a demo.",
        "description": "A system admin's. A draft or a retired demo is promoted; any other is\nrefused with 409.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The demo, promoted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Demo"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/retire": {
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "retireDemo",
        "summary": "Stop showing a promoted demo.",
        "description": "A system admin's. It is then opened as a draft is, and may be promoted\nagain.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The demo, retired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Demo"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/copies": {
      "post": {
        "tags": [
          "demos"
        ],
        "operationId": "copyDemo",
        "summary": "Copy a demo to another version of its workflow.",
        "description": "Takes the `developer` tag. A new draft of the caller's, with the demo's\njobs, choices and notes, played by `workflow_version`, which this portal\nmust have registered. Answered once its record is made: it is `copying`\nuntil its files are, then a `draft`, or `failed` saying why.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "workflow_version"
                ],
                "properties": {
                  "workflow_version": {
                    "type": "string",
                    "description": "The version of the demo's workflow the copy is played by."
                  }
                }
              },
              "example": {
                "workflow_version": "2026.11.2"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The copy, being copied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Demo"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/guide": {
      "put": {
        "tags": [
          "demos"
        ],
        "operationId": "setDemoGuide",
        "summary": "Write a demo's notes.",
        "description": "Replaces the notes with those given. Its maker, with the `developer`\ntag, writes them while it is a draft, and a system admin at any time\nonce it is copied; any other is refused with 403, and a maker's on a\ndemo that is not a draft with 409.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemoGuide"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The demo, with its notes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDetail"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but not permitted \u2014 no org membership, or the compute target\nor tool is not granted to this caller.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/tools": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "getDemoTools",
        "summary": "The tool listing the demo's maker was given when saving it.",
        "description": "As `GET /api/jobs/tools` answered its maker, with the toolkit versions\nthe save named: what the workflow's pages read of each tool during the\ndemo, machines included. 409 until the copy has ended.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The listing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisteredToolList"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "listDemoJobs",
        "summary": "The demo's jobs, as a session's job list gives them.",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Its jobs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionJobListing"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "getDemoJob",
        "summary": "One of the demo's jobs, as `getJob` gives a job.",
        "description": "Its cleaned record. It has no results archive, so no `download_url`.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStatus"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}/results": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "listDemoJobResults",
        "summary": "The files of one of the demo's jobs' results tree.",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "As `listJobResults` answers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResultListing"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}/results/{path}": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "getDemoJobResultFile",
        "summary": "A presigned download for one result file of one of the demo's jobs.",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path of one file within the job's results tree.\n\nDeployed as a greedy `{path+}` parameter, which OpenAPI cannot express; the\nroute-conformance test normalizes the two spellings.\n",
            "x-nm-greedy": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "As `getJobResultFile` answers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "size_bytes": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}/files": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "listDemoJobFiles",
        "summary": "Every file the demo keeps of one of its jobs.",
        "description": "Its record, `inputs/` and `results/`, and the sequences it generated\n(`listDemoJobGeneratedSequences`).\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "As `listJobFiles` answers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFileListing"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}/files/{path}": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "readDemoJobFile",
        "summary": "Read one file the demo keeps of one of its jobs.",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "description": "Path of one file within the job folder, relative to the folder root rather\nthan to `results/`. `job_metadata.json`, `input.fasta` and\n`results/blast/hits.tsv` are all addressable; `ResultPath` can only reach\nthe third.\n\nThe traversal rules are identical to `ResultPath` \u2014 no empty segment, no\n`.`, no `..`, no backslash \u2014 and ownership is structural either way, since\nthe caller's subject builds the key. The only difference is that the\n`results/` prefix is not forced on.\n\nDeployed as a greedy `{path+}` parameter, which OpenAPI cannot express; the\nroute-conformance test normalizes the two spellings.\n",
            "x-nm-greedy": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "As `readJobFile` answers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobFileContent"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demos/{demo_id}/jobs/{job_id}/generated-sequences": {
      "get": {
        "tags": [
          "demos"
        ],
        "operationId": "listDemoJobGeneratedSequences",
        "summary": "The sequences one of the demo's jobs generated, under their ids.",
        "description": "As `listJobGeneratedSequences` listed them when the demo was saved.\n",
        "parameters": [
          {
            "name": "demo_id",
            "in": "path",
            "required": true,
            "description": "A demo the caller may open: a promoted one, or a draft of theirs. Any\nother reads as not found.\n",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          },
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "A job of the demo's job index.",
            "schema": {
              "type": "string",
              "pattern": "^[^/\\\\]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "As `listJobGeneratedSequences` answers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobGeneratedSequences"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such resource for this caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The resource exists but is not in a state that permits this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/feedback": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "submitFeedback",
        "summary": "File a problem report, question, or suggestion.",
        "description": "Opens an issue on the portal's own repository on the reporter's behalf.\nThe reporter needs no GitHub account and never sees the repository \u2014\nwhich is what lets the reports stay private alongside the code rather\nthan being collected in a public tracker.\n\nAuthentication is the only gate. Organization membership deliberately is\nnot: a user who has signed in but has not been provisioned into an\norganization cannot use the portal at all, and that is exactly the\ncondition they most need to be able to report.\n\nThe filed issue carries the reporter's account and organization, taken\nfrom the verified token. A client cannot set, spoof, or suppress them,\nand there is no parameter here that names another user.\n\nReports are one-way. There is no route to read one back, because the\nrepository is private and a reporter has no standing to read anyone\nelse's report \u2014 `report_id` is a reference to quote, not a resource.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackReport"
              },
              "example": {
                "kind": "bug",
                "title": "BioM3 generation stays queued forever on spark-nm",
                "body": "I submitted a generation job at about 10:15 and it has been\nqueued since. My Jobs shows no error.\n",
                "context": {
                  "route": "#/tools/biom3/generate-from-prompt",
                  "job_id": "0f3c2a91-77d2-4c1e-9a55-2b1d6e4f8a03"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Filed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackReceipt"
                },
                "example": {
                  "report_id": 412
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Reporting is not configured in this environment, or the issue\ntracker refused the request. Distinguished from a 400 on purpose:\nnothing about the report was wrong and resubmitting the same text\nlater is the right response.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/client-events": {
      "post": {
        "tags": [
          "support"
        ],
        "operationId": "reportClientEvent",
        "summary": "Report what went wrong in the browser, for the event log.",
        "description": "The site reports an error it caught in its own files, or a request that\nnever reached the portal, and the portal records it as a `client` event\nfor its system administrators (`GET /api/admin/events`). An error the\nportal answered is already recorded, so it is not reported here.\n\nThe report is kept as sent, in the event's details, with the sign-in app\nand page the token and the request name. The user and organization are\nthe verified token's, never the report's. A report carries what went\nwrong and where, never what the page holds.\n\nA user may send at most 30 reports in ten minutes to one server process.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClientReport"
              },
              "example": {
                "type": "error",
                "message": "TypeError: Cannot read properties of undefined (reading 'rows')",
                "page": "#/workflows/biom3-sequences@2026.11.0",
                "source": "/js/workflows/summary.js",
                "line": 214,
                "column": 18,
                "browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Firefox/133.0",
                "site_version": "2026.11.2"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Taken, to be recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The report is over 16 KiB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "The user sent too many reports lately.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/lookup/uniprot/{accession}": {
      "parameters": [
        {
          "name": "accession",
          "in": "path",
          "required": true,
          "description": "A UniProtKB accession, Swiss-Prot or TrEMBL, optionally with an isoform\nsuffix (P12345-2). Case-insensitive. Anything that is not accession-shaped\nis rejected here rather than forwarded upstream.\n",
          "schema": {
            "type": "string",
            "pattern": "^(?:[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9](?:[A-Z][A-Z0-9]{2}[0-9]){1,2})(?:-[0-9]+)?$"
          },
          "example": "P12345"
        }
      ],
      "get": {
        "tags": [
          "lookup"
        ],
        "operationId": "getUniProtEntry",
        "summary": "One UniProtKB entry, in the dataset field vocabulary.",
        "description": "Answered in the request rather than as a job. The tools that parse\nUniProt run a container over a staged database; the parsed Swiss-Prot mirror is a\n661 MB gzipped JSONL with no accession index and TrEMBL is not provisioned\nat all, so a single lookup over the mirror would take minutes to answer a\nquestion a person is waiting on.\n\nRead from UniProt directly, which is what makes TrEMBL accessions and\nrecently revised entries resolve. The trade is that values are current\nUniProt rather than the pinned release a dataset was built from \u2014 right\nfor composing a prompt about a protein, wrong for reproducing a training\ncorpus, which is what the parse tools remain for.\n",
        "responses": {
          "200": {
            "description": "The entry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniProtEntry"
                },
                "example": {
                  "accession": "P12345",
                  "entry_name": "AATM_RABIT",
                  "reviewed": true,
                  "sequence": "MALLHSARVLSGVASAFHPGLAAAASARASSWWAHVEMGPPDPILGVTEAYKRDTNSKK",
                  "fields": {
                    "protein_name": "Aspartate aminotransferase, mitochondrial",
                    "lineage": [
                      "Eukaryota",
                      "Metazoa",
                      "Chordata"
                    ],
                    "function": [
                      "Catalyzes the irreversible transamination of the L-tryptophan metabolite L-kynurenine to form kynurenic acid."
                    ],
                    "catalytic_activity": [
                      "L-aspartate + 2-oxoglutarate = oxaloacetate + L-glutamate"
                    ],
                    "subcellular_location": [
                      "Mitochondrion matrix",
                      "Cell membrane"
                    ],
                    "family_names": [
                      "Aminotran_1_2"
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed, or an argument was invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, expired, or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No such entry. Also the answer for an accession that was deleted, or\nmerged into another entry.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "UniProt answered, but not with an entry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "UniProt could not be reached in time. Distinct from a 502: the lookup\nis worth retrying.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "cognitoJwt": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "A Cognito ID token (browser) or access token (MCP clients). The caller's\n`sub` claim scopes every request \u2014 no endpoint takes a user identifier as\na parameter, so one caller can never address another's data.\n"
      }
    },
    "schemas": {
      "ActiveOrganization": {
        "type": "object",
        "required": [
          "active_org_id"
        ],
        "properties": {
          "active_org_id": {
            "type": "string",
            "description": "The organization now in effect for subsequent requests.",
            "example": "example-lab"
          }
        }
      },
      "AdminAddOrgMember": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ],
            "default": "member"
          }
        }
      },
      "AdminComputeHostList": {
        "type": "object",
        "required": [
          "hosts"
        ],
        "properties": {
          "hosts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "host_id",
                "display_name",
                "status",
                "org_ids"
              ],
              "properties": {
                "host_id": {
                  "type": "string"
                },
                "display_name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "classes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "kind": {
                  "$ref": "#/components/schemas/MachineKind"
                },
                "labels": {
                  "$ref": "#/components/schemas/MachineLabels"
                },
                "taints": {
                  "$ref": "#/components/schemas/MachineTaints"
                },
                "org_ids": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Organizations this machine serves."
                },
                "owner_org_id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The organization the machine belongs to, one of those it serves. `null` until one is on record."
                },
                "has_queue": {
                  "type": "boolean"
                },
                "worker": {
                  "$ref": "#/components/schemas/HostWorker"
                },
                "last_seen_at": {
                  "$ref": "#/components/schemas/HostLastSeenAt"
                },
                "worker_standing": {
                  "$ref": "#/components/schemas/HostWorkerStanding"
                },
                "worker_update": {
                  "$ref": "#/components/schemas/HostWorkerUpdate"
                }
              }
            }
          },
          "worker_release": {
            "$ref": "#/components/schemas/WorkerRelease"
          }
        }
      },
      "AdminCreateOrganization": {
        "type": "object",
        "required": [
          "org_id"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "pattern": "^[a-z0-9-]{2,32}$",
            "example": "acme-research"
          },
          "display_name": {
            "type": "string",
            "description": "Defaults to `org_id`."
          }
        }
      },
      "AdminOrgMember": {
        "type": "object",
        "required": [
          "email",
          "role",
          "signed_in",
          "tags"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ],
            "description": "The person's role in this organization. Admins can manage its compute hosts. Independent of system-admin status."
          },
          "signed_in": {
            "type": "boolean",
            "description": "Whether the person has ever signed in. False means invited but never signed in."
          },
          "tags": {
            "$ref": "#/components/schemas/TagNames"
          }
        }
      },
      "AdminOrgMemberEnvelope": {
        "type": "object",
        "required": [
          "member"
        ],
        "properties": {
          "member": {
            "$ref": "#/components/schemas/AdminOrgMember"
          }
        }
      },
      "AdminOrgMemberList": {
        "type": "object",
        "required": [
          "members"
        ],
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminOrgMember"
            }
          }
        }
      },
      "AdminOrganization": {
        "type": "object",
        "required": [
          "org_id",
          "display_name",
          "machines",
          "default_compute_targets",
          "member_count"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "example": "nm-exec"
          },
          "display_name": {
            "type": "string"
          },
          "machines": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The active machines that serve this organization, which are the machines its members may use. A machine is given an organization with `PUT /api/admin/compute-hosts/{host_id}/orgs`.",
            "example": [
              "cloud-cpu",
              "spark-nm-2"
            ]
          },
          "default_compute_targets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The same as `machines`, under the name websites released before an organization's machines were read off the machines give it."
          },
          "default_machines": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Where a job of this organization's goes when it names no machine: the first of these, in this order, that suits the job. A job none suits is refused.",
            "example": [
              "cloud-cpu",
              "spark-nm-2"
            ]
          },
          "member_count": {
            "type": "integer",
            "description": "Number of members."
          }
        }
      },
      "AdminOrganizationList": {
        "type": "object",
        "required": [
          "organizations"
        ],
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AdminOrganization"
            }
          }
        }
      },
      "AdminSetHiddenPage": {
        "type": "object",
        "required": [
          "kind",
          "name",
          "hidden"
        ],
        "additionalProperties": false,
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/HiddenPageKind"
          },
          "name": {
            "type": "string",
            "description": "As `HiddenPage.name`."
          },
          "hidden": {
            "type": "boolean",
            "description": "True hides the page; false shows it again."
          }
        }
      },
      "AdminSetOrgMemberRole": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ]
          }
        }
      },
      "AdminSetUserTags": {
        "type": "object",
        "required": [
          "tags"
        ],
        "additionalProperties": false,
        "properties": {
          "tags": {
            "type": "array",
            "description": "Every tag the person is to hold; any other they hold is taken away.",
            "items": {
              "type": "string"
            },
            "uniqueItems": true
          }
        }
      },
      "AdminStacks": {
        "type": "object",
        "required": [
          "stacks"
        ],
        "properties": {
          "stacks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeployedStack"
            }
          }
        }
      },
      "AdminUsage": {
        "type": "object",
        "required": [
          "since",
          "until",
          "apps_error",
          "machines",
          "organizations"
        ],
        "properties": {
          "since": {
            "type": [
              "number",
              "null"
            ]
          },
          "until": {
            "type": [
              "number",
              "null"
            ]
          },
          "apps_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the sign-in apps could not be read, when they could not. Each app is then named by its client id."
          },
          "machines": {
            "type": "object",
            "description": "The name of each machine a counted job ran on, by its id.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrganizationUsage"
            }
          }
        }
      },
      "AdminUserList": {
        "type": "object",
        "required": [
          "users"
        ],
        "properties": {
          "users": {
            "type": "array",
            "description": "Every user the portal has seen sign in, by user id. A user invited but never signed in has no user id yet, so is not listed.",
            "items": {
              "type": "object",
              "required": [
                "user_id",
                "emails"
              ],
              "properties": {
                "user_id": {
                  "type": "string",
                  "description": "The portal's own id for the user, as events name them."
                },
                "emails": {
                  "type": "array",
                  "description": "The addresses the user signed in with, as first seen. More than one where the user has more than one sign-in identity; none is preferred.",
                  "items": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        }
      },
      "AdminUserTags": {
        "type": "object",
        "required": [
          "email",
          "tags"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "tags": {
            "$ref": "#/components/schemas/TagNames"
          }
        }
      },
      "AdminVersions": {
        "type": "object",
        "required": [
          "toolkits",
          "workflows",
          "documents",
          "holdings",
          "agents",
          "devkit_handler",
          "datatypes"
        ],
        "properties": {
          "toolkits": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RegisteredPart"
                },
                {
                  "type": "object",
                  "required": [
                    "at_source"
                  ],
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ToolkitVersion"
                      }
                    },
                    "at_source": {
                      "$ref": "#/components/schemas/ToolkitSource"
                    }
                  }
                }
              ]
            }
          },
          "workflows": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RegisteredPart"
                },
                {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReleasedVersion"
                      }
                    }
                  }
                }
              ]
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RegisteredPart"
                },
                {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReleasedVersion"
                      }
                    }
                  }
                }
              ]
            }
          },
          "holdings": {
            "type": "array",
            "description": "Each item the portal was told it holds, by id; a version is a release.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RegisteredPart"
                },
                {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/HeldVersion"
                      }
                    }
                  }
                }
              ]
            }
          },
          "agents": {
            "type": "array",
            "description": "Each chat agent, by name.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/RegisteredPart"
                },
                {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgentVersion"
                      }
                    }
                  }
                }
              ]
            }
          },
          "devkit_handler": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Promoted"
              },
              {
                "type": "object",
                "required": [
                  "versions"
                ],
                "properties": {
                  "versions": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/HandlerVersion"
                    }
                  }
                }
              }
            ]
          },
          "datatypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegisteredDatatypeVersion"
            }
          }
        }
      },
      "AdminWorkerReleaseAdded": {
        "type": "object",
        "required": [
          "release"
        ],
        "properties": {
          "release": {
            "$ref": "#/components/schemas/OfferedWorkerRelease"
          }
        }
      },
      "AdminWorkerReleaseList": {
        "type": "object",
        "required": [
          "image",
          "releases"
        ],
        "properties": {
          "image": {
            "type": "string",
            "description": "Where the worker's image is published, without a tag.",
            "example": "ghcr.io/natural-machine/nm-portal-host-worker"
          },
          "releases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfferedWorkerRelease"
            }
          }
        }
      },
      "AgentVersion": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ReleasedVersion"
          },
          {
            "type": "object",
            "required": [
              "model"
            ],
            "properties": {
              "model": {
                "type": "string",
                "description": "The Claude model the version answers with."
              }
            }
          }
        ]
      },
      "AssistantUsage": {
        "type": "object",
        "description": "The portal assistant's calls to its model in the period, and what they cost.",
        "required": [
          "conversations",
          "turns",
          "model_calls",
          "input_tokens",
          "output_tokens",
          "cache_creation_input_tokens",
          "cache_read_input_tokens",
          "dollars",
          "by_agent"
        ],
        "properties": {
          "conversations": {
            "type": "integer"
          },
          "turns": {
            "type": "integer"
          },
          "model_calls": {
            "type": "integer"
          },
          "input_tokens": {
            "type": "integer"
          },
          "output_tokens": {
            "type": "integer"
          },
          "cache_creation_input_tokens": {
            "type": "integer"
          },
          "cache_read_input_tokens": {
            "type": "integer"
          },
          "dollars": {
            "type": "number"
          },
          "by_agent": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "required": [
                "model_calls",
                "dollars"
              ],
              "properties": {
                "model_calls": {
                  "type": "integer"
                },
                "dollars": {
                  "type": "number"
                }
              }
            }
          }
        }
      },
      "ClaimRequest": {
        "description": "Whose job it is, and what this machine's worker can run, as it says when it\nasks a queue for the next job.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/LeaseRequest"
          },
          {
            "type": "object",
            "required": [
              "owner"
            ],
            "properties": {
              "owner": {
                "$ref": "#/components/schemas/JobOwner"
              }
            }
          }
        ]
      },
      "ClaimResponse": {
        "type": "object",
        "required": [
          "job",
          "lease_id"
        ],
        "properties": {
          "job": {
            "type": "object",
            "additionalProperties": true,
            "description": "The dispatch envelope, the same one every daemon-backed host receives, as it was fixed when the job was sent."
          },
          "lease_id": {
            "type": "string",
            "description": "Opaque. Pass it to POST /api/compute/jobs/{job_id}/complete when done, as a host does with a lease from a queue."
          }
        }
      },
      "ClientReport": {
        "type": "object",
        "description": "What went wrong in the browser. Any further fields are kept with it.\n",
        "additionalProperties": true,
        "properties": {
          "type": {
            "type": "string",
            "description": "What was caught, such as `error`, `unhandledrejection` or `request-not-sent`."
          },
          "message": {
            "type": "string"
          },
          "page": {
            "type": "string",
            "description": "The page's address within the site."
          },
          "source": {
            "type": "string",
            "description": "The site file the error was raised in."
          },
          "line": {
            "type": "integer"
          },
          "column": {
            "type": "integer"
          },
          "browser": {
            "type": "string"
          },
          "site_version": {
            "type": "string"
          }
        }
      },
      "ComputeHost": {
        "type": "object",
        "required": [
          "host_id",
          "display_name",
          "status",
          "classes"
        ],
        "properties": {
          "host_id": {
            "type": "string",
            "example": "byoc-1f4c2a9b8d3e5607"
          },
          "display_name": {
            "type": "string",
            "example": "Lab workstation"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "revoked"
            ],
            "description": "`pending` until the machine redeems its enrollment code, then `active`. `revoked` is permanent."
          },
          "classes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What the portal read of a machine before machines had labels. Written at registration and read by nothing now; `labels` says what the machine is.",
            "example": [
              "cpu-daemon",
              "gpu-daemon"
            ]
          },
          "kind": {
            "$ref": "#/components/schemas/MachineKind"
          },
          "labels": {
            "$ref": "#/components/schemas/MachineLabels"
          },
          "taints": {
            "$ref": "#/components/schemas/MachineTaints"
          },
          "created_at": {
            "type": "integer"
          },
          "enrolled_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Epoch seconds when the machine redeemed its enrollment code; `null` until then."
          },
          "owner_org_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The organization the machine belongs to. `null` on a machine registered before machines had owners, until a system administrator says whose it is.",
            "example": "nm"
          },
          "owned": {
            "type": "boolean",
            "description": "Whether the machine is the caller's organization's own. Only then may its administrators revoke it, share it or move its worker."
          },
          "worker": {
            "$ref": "#/components/schemas/HostWorker"
          },
          "last_seen_at": {
            "$ref": "#/components/schemas/HostLastSeenAt"
          },
          "worker_standing": {
            "$ref": "#/components/schemas/HostWorkerStanding"
          },
          "worker_update": {
            "$ref": "#/components/schemas/HostWorkerUpdate"
          }
        }
      },
      "ComputeHostList": {
        "type": "object",
        "required": [
          "hosts"
        ],
        "properties": {
          "hosts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComputeHost"
            }
          },
          "worker_release": {
            "$ref": "#/components/schemas/WorkerRelease"
          }
        }
      },
      "Counts": {
        "type": "object",
        "additionalProperties": {
          "type": "integer"
        }
      },
      "CreateSessionRequest": {
        "type": "object",
        "required": [
          "workflow_id",
          "name"
        ],
        "properties": {
          "workflow_id": {
            "$ref": "#/components/schemas/WorkflowId"
          },
          "name": {
            "type": "string",
            "description": "Sanitized by the server. Returns 400 if nothing usable remains, or 409 if the caller already has a session with this name on this workflow."
          },
          "state": {
            "$ref": "#/components/schemas/SessionState"
          },
          "resume_step": {
            "type": "string"
          },
          "workflow_version": {
            "type": "string",
            "description": "The version of the workflow making the session, as its config states it."
          }
        },
        "description": "`state` is optional and becomes the new session's initial saved state."
      },
      "CreateUploadRequest": {
        "type": "object",
        "required": [
          "size_bytes"
        ],
        "additionalProperties": false,
        "properties": {
          "size_bytes": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "CreateUploadResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PresignedUpload"
          },
          {
            "type": "object",
            "required": [
              "upload_id",
              "max_bytes"
            ],
            "properties": {
              "upload_id": {
                "type": "string"
              },
              "max_bytes": {
                "type": "integer"
              }
            }
          }
        ]
      },
      "CreateUserDataRequest": {
        "type": "object",
        "required": [
          "display_name",
          "size_bytes"
        ],
        "additionalProperties": false,
        "properties": {
          "display_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "File size in bytes. Counts against the quota and is enforced by S3 on upload."
          },
          "category": {
            "type": "string",
            "maxLength": 50,
            "default": "other"
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          }
        }
      },
      "CreateUserDataResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PresignedUpload"
          },
          {
            "type": "object",
            "required": [
              "file_id"
            ],
            "properties": {
              "file_id": {
                "type": "string"
              }
            }
          }
        ]
      },
      "DeleteUserDataResponse": {
        "type": "object",
        "required": [
          "deleted"
        ],
        "properties": {
          "deleted": {
            "type": "string",
            "description": "The `file_id` that was removed."
          }
        }
      },
      "Demo": {
        "type": "object",
        "description": "One demo, without its session's state. A draft, a failed or retired demo and one being copied are seen only by their maker and system admins.",
        "required": [
          "demo_id",
          "workflow_id",
          "workflow_version",
          "title",
          "description",
          "status",
          "made_at",
          "changed_at",
          "job_count",
          "file_count",
          "size_bytes",
          "yours"
        ],
        "properties": {
          "demo_id": {
            "type": "string",
            "pattern": "^[^/\\\\]+$"
          },
          "workflow_id": {
            "$ref": "#/components/schemas/WorkflowId"
          },
          "workflow_version": {
            "type": "string",
            "description": "The version of the workflow the session was made with, whose pages play the demo, active or not (`GET /api/workflows` lists every version)."
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 4000
          },
          "status": {
            "$ref": "#/components/schemas/DemoStatus"
          },
          "failure": {
            "type": "string",
            "description": "Why the copy failed, on a `failed` demo."
          },
          "made_at": {
            "type": "number",
            "description": "Epoch seconds."
          },
          "changed_at": {
            "type": "number",
            "description": "Epoch seconds, of the last change of `status`."
          },
          "job_count": {
            "type": "integer",
            "minimum": 0
          },
          "file_count": {
            "type": "integer",
            "minimum": 0,
            "description": "The files copied, once the copy has ended."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0,
            "description": "Their size, once the copy has ended."
          },
          "yours": {
            "type": "boolean",
            "description": "Whether the caller made it."
          },
          "made_by_email": {
            "type": "string",
            "description": "Who made it, given to a system admin only."
          }
        }
      },
      "DemoDetail": {
        "description": "One demo in full: the session's state and job index as they were saved. Each job of the index is read under the demo's own address (`/api/demos/{demo_id}/jobs/{job_id}`), not under `/api/jobs`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Demo"
          },
          {
            "type": "object",
            "required": [
              "state",
              "jobs",
              "guide"
            ],
            "properties": {
              "state": {
                "$ref": "#/components/schemas/SessionState"
              },
              "jobs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionJobRef"
                }
              },
              "resume_step": {
                "type": "string"
              },
              "guide": {
                "$ref": "#/components/schemas/DemoGuide"
              },
              "workflow_address": {
                "type": "string",
                "description": "Where the workflow version's files are read from, which the workflows listing gives a draft version's only to developers. Absent for a workflow a local portal serves from a folder, which its listing gives."
              }
            }
          }
        ]
      },
      "DemoExport": {
        "type": "object",
        "description": "A demo as another portal imports it. Sent back to `POST /api/demos/imports` with the files' `url`s left out.",
        "required": [
          "format",
          "demo_id",
          "demo",
          "files"
        ],
        "properties": {
          "format": {
            "type": "integer",
            "const": 1
          },
          "demo_id": {
            "type": "string",
            "description": "The exported demo's id, which its jobs' records name."
          },
          "demo": {
            "type": "object",
            "required": [
              "workflow_id",
              "workflow_version",
              "title",
              "state",
              "jobs"
            ],
            "properties": {
              "workflow_id": {
                "$ref": "#/components/schemas/WorkflowId"
              },
              "workflow_version": {
                "type": "string"
              },
              "title": {
                "type": "string",
                "maxLength": 200
              },
              "description": {
                "type": "string",
                "maxLength": 4000
              },
              "state": {
                "$ref": "#/components/schemas/SessionState"
              },
              "jobs": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionJobRef"
                }
              },
              "resume_step": {
                "type": "string"
              },
              "guide": {
                "$ref": "#/components/schemas/DemoGuide"
              }
            }
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DemoExportedFile"
            }
          }
        }
      },
      "DemoExportedFile": {
        "type": "object",
        "required": [
          "path",
          "size_bytes"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "Within the demo's folder: `tools.json`, or `jobs/<job_id>/` and the job's `job_metadata.json` or a file under its `inputs/` or `results/`."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 5368709120
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "A presigned GET, on an export. Fetch it without an Authorization header."
          }
        }
      },
      "DemoGuide": {
        "type": "object",
        "description": "What a walk-through of the demo says over the workflow's screens, written once it is saved: by its maker while it is a draft, by a system admin at any time. Kept as given; the server checks its shape only.",
        "required": [
          "notes"
        ],
        "additionalProperties": false,
        "properties": {
          "notes": {
            "type": "array",
            "maxItems": 1000,
            "description": "In the order each screen shows them.",
            "items": {
              "$ref": "#/components/schemas/DemoNote"
            }
          }
        }
      },
      "DemoImportStarted": {
        "type": "object",
        "required": [
          "demo",
          "uploads",
          "upload_method",
          "expires_in_seconds"
        ],
        "properties": {
          "demo": {
            "$ref": "#/components/schemas/Demo"
          },
          "uploads": {
            "type": "array",
            "description": "Where to send each file: a multipart POST to `upload_url` with `upload_fields` and the file last, as for a scratch upload. S3 refuses a file of another size than the one stated.",
            "items": {
              "type": "object",
              "required": [
                "path",
                "upload_url",
                "upload_fields"
              ],
              "properties": {
                "path": {
                  "type": "string"
                },
                "upload_url": {
                  "type": "string",
                  "format": "uri"
                },
                "upload_fields": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "upload_method": {
            "type": "string",
            "const": "POST"
          },
          "expires_in_seconds": {
            "type": "integer"
          }
        }
      },
      "DemoList": {
        "type": "object",
        "required": [
          "demos"
        ],
        "properties": {
          "demos": {
            "type": "array",
            "description": "Oldest first.",
            "items": {
              "$ref": "#/components/schemas/Demo"
            }
          }
        }
      },
      "DemoNote": {
        "type": "object",
        "required": [
          "step",
          "screen",
          "text"
        ],
        "additionalProperties": false,
        "properties": {
          "step": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The id of the step it is shown on, as the workflow's manifest names it."
          },
          "screen": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Which of the step's screens, as the frame names it."
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "text": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000,
            "description": "Plain text; a blank line starts a paragraph."
          },
          "target": {
            "type": "string",
            "maxLength": 1000,
            "description": "A selector for what on the screen it points at, which the server does not read. A demo plays one workflow version, so the screen it is looked for on is always the same."
          },
          "side": {
            "type": "string",
            "enum": [
              "right",
              "bottom",
              "left",
              "top"
            ],
            "description": "Which side of its target it is drawn on first."
          },
          "next": {
            "type": "boolean",
            "description": "Whether its target is what to press next, which stays lit once the notes are closed. At most one note of a screen is, and it has a target."
          }
        }
      },
      "DemoStatus": {
        "type": "string",
        "description": "`copying` while its jobs are copied, after the save is answered; then a `draft`, or `failed` with the reason in `failure`. A system admin makes a draft `promoted`, when anyone signed in may open it, and a promoted demo `retired`. A copy cut off by the server restarting stays `copying`; its maker deletes the demo and saves again. An import is `copying` until its files are all sent (`POST /api/demos/{demo_id}/imported`).",
        "enum": [
          "copying",
          "failed",
          "draft",
          "promoted",
          "retired"
        ]
      },
      "DeployedStack": {
        "type": "object",
        "description": "One of the environment's CloudFormation stacks.",
        "required": [
          "name",
          "status",
          "deployed_at",
          "repository",
          "commit",
          "tree"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "CloudFormation's status for the stack, such as `UPDATE_COMPLETE`."
          },
          "deployed_at": {
            "type": "integer",
            "description": "When it was last deployed, or created if never since, in seconds since the epoch."
          },
          "repository": {
            "type": "string",
            "description": "The repository its last deploy was made from; empty when that deploy did not say."
          },
          "commit": {
            "type": "string",
            "description": "The commit its last deploy was made from; empty when that deploy did not say."
          },
          "tree": {
            "type": "string",
            "enum": [
              "clean",
              "uncommitted changes",
              ""
            ],
            "description": "Whether the checkout that deploy was made from had changes not committed; empty when that deploy did not say."
          }
        }
      },
      "DownloadResponse": {
        "type": "object",
        "required": [
          "url",
          "expires_in_seconds"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "expires_in_seconds": {
            "type": "integer"
          }
        }
      },
      "EnrollRequest": {
        "type": "object",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The enrollment code as issued. Case, spaces and dashes are ignored.",
            "example": "NMC-7KQ4H-8XR2V-B19TC"
          }
        }
      },
      "EnrollResponse": {
        "type": "object",
        "required": [
          "host_id",
          "token"
        ],
        "properties": {
          "host_id": {
            "type": "string",
            "example": "byoc-1f4c2a9b8d3e5607"
          },
          "token": {
            "type": "string",
            "description": "The host's long-lived credential. Returned once and not retrievable later; losing it means registering the machine again."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message. Its wording may change; do not match on it."
          },
          "code": {
            "$ref": "#/components/schemas/ErrorCode",
            "description": "Not yet sent by any handler; until it is, branch on the HTTP status."
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "description": "Extra context whose shape depends on `code`."
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "description": "A stable, machine-readable failure identifier. Branch on this rather than on `error`, whose wording may change. Closed enum.",
        "enum": [
          "invalid_request",
          "unknown_tool",
          "unknown_argument",
          "invalid_argument",
          "missing_argument",
          "input_too_large",
          "input_not_found",
          "source_not_allowed",
          "unauthorized",
          "forbidden",
          "not_found",
          "quota_exceeded",
          "job_not_finished",
          "target_not_allowed",
          "not_provisioned",
          "dispatch_failed",
          "internal"
        ]
      },
      "Event": {
        "type": "object",
        "description": "Something that happened in the portal, as the layer kept it.",
        "additionalProperties": true,
        "properties": {
          "event_id": {
            "type": "string"
          },
          "time": {
            "type": "number",
            "description": "When it happened, in seconds since 1970."
          },
          "kind": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "description": "What the layer judged it, by its own rules."
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The portal's own id for the user it concerns."
          },
          "org_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "details": {
            "type": "object",
            "description": "Whatever the place that recorded it said; no key is promised.",
            "additionalProperties": true
          }
        }
      },
      "EventPage": {
        "type": "object",
        "description": "The event-log layer's answer. Its first release answers with these\nfields; a later one may add more.\n",
        "additionalProperties": true,
        "properties": {
          "events": {
            "type": "array",
            "description": "Newest first.",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "next": {
            "type": [
              "string",
              "null"
            ],
            "description": "To give as `before` for the page after this one; null on the last."
          },
          "kinds": {
            "type": "array",
            "description": "Every kind of event the log holds.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "FeedbackContext": {
        "type": "object",
        "additionalProperties": false,
        "description": "Where the reporter was when they filed, for reproducing the problem. All fields are client-supplied and unverified.",
        "properties": {
          "route": {
            "type": "string",
            "maxLength": 200,
            "description": "The page the reporter was on, as a route hash.",
            "example": "#/tools/biom3/generate-from-prompt"
          },
          "job_id": {
            "type": "string",
            "maxLength": 200,
            "description": "The job the report is about, if one was on screen."
          },
          "conversation_id": {
            "type": "string",
            "maxLength": 200,
            "description": "The assistant conversation open at the time, if any."
          },
          "user_agent": {
            "type": "string",
            "maxLength": 500,
            "description": "Browser and platform string."
          }
        }
      },
      "FeedbackReceipt": {
        "type": "object",
        "required": [
          "report_id"
        ],
        "additionalProperties": false,
        "properties": {
          "report_id": {
            "type": "integer",
            "description": "The report's number, for the reporter to quote when following up.",
            "example": 412
          }
        }
      },
      "FeedbackReport": {
        "type": "object",
        "required": [
          "kind",
          "title",
          "body"
        ],
        "additionalProperties": false,
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "bug",
              "idea",
              "question"
            ],
            "description": "The type of report. Sets the label it is triaged under.",
            "example": "bug"
          },
          "title": {
            "type": "string",
            "minLength": 3,
            "maxLength": 140,
            "description": "One-line summary.",
            "example": "BioM3 generation stays queued forever on spark-nm"
          },
          "body": {
            "type": "string",
            "minLength": 10,
            "maxLength": 8000,
            "description": "What happened, in the reporter's words. Rendered as Markdown.",
            "example": "I submitted a generation job at about 10:15 and it has been queued\nsince. My Jobs shows no error.\n"
          },
          "context": {
            "$ref": "#/components/schemas/FeedbackContext"
          }
        }
      },
      "GenericSubmitRequest": {
        "type": "object",
        "description": "A request to run a registered tool (POST /api/jobs).",
        "required": [
          "tool_id"
        ],
        "additionalProperties": false,
        "properties": {
          "tool_id": {
            "type": "string",
            "minLength": 1,
            "description": "A tool in the tool registry."
          },
          "params": {
            "type": "object",
            "description": "The tool's parameters, as its record's `params` schema describes them, with each data parameter given as a JobInput (components/schemas/input.yaml). Defaults to none set."
          },
          "target_id": {
            "type": "string",
            "description": "Where to run it. The machine is held to what the tool needs and to `placement`, but not to its taints. When none is named, the first of the organization's default machines that suits, and refused when none does."
          },
          "placement": {
            "$ref": "#/components/schemas/Placement"
          },
          "job_name": {
            "type": "string",
            "description": "A name to find the job by. Defaults to the tool id and the time."
          },
          "toolkit": {
            "$ref": "#/components/schemas/NamedToolkitVersion"
          }
        }
      },
      "GlobalDataListing": {
        "type": "object",
        "required": [
          "version",
          "datasets"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "description": "Version of the dataset entry shape. Bumped when it changes in a way a client must handle."
          },
          "datasets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GlobalDataset"
            }
          }
        }
      },
      "GlobalDataset": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable dataset handle."
          },
          "name": {
            "type": "string"
          },
          "folder": {
            "type": [
              "string",
              "null"
            ],
            "description": "Display grouping, with \"/\" separating nested levels."
          },
          "size_bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "download_url": {
            "type": "string",
            "format": "uri",
            "description": "Short-lived presigned GET."
          }
        }
      },
      "HandlerVersion": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ReleasedVersion"
          },
          {
            "type": "object",
            "required": [
              "devkits"
            ],
            "properties": {
              "devkits": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "The devkit versions it handles."
              }
            }
          }
        ]
      },
      "HeldVersion": {
        "type": "object",
        "description": "One registered version of a held item, by its release.",
        "required": [
          "version",
          "registered_at",
          "registered_by",
          "datatype",
          "title",
          "storage",
          "registry",
          "record"
        ],
        "properties": {
          "version": {
            "type": "string",
            "description": "The item's release."
          },
          "registered_at": {
            "type": "integer",
            "description": "Seconds since the epoch."
          },
          "registered_by": {
            "type": "string"
          },
          "datatype": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "storage": {
            "type": [
              "object",
              "null"
            ],
            "description": "For an item in the portal's storage, where its files are, as its description says: `store` (`env` or `shared`), `prefix`, and `file` for an item that is one file. Null for an item in a container registry.",
            "required": [
              "store",
              "prefix"
            ],
            "properties": {
              "store": {
                "type": "string",
                "enum": [
                  "env",
                  "shared"
                ]
              },
              "prefix": {
                "type": "string"
              },
              "file": {
                "type": "string"
              }
            }
          },
          "registry": {
            "type": [
              "object",
              "null"
            ],
            "description": "For an item published in a container registry, its `ref`, and the `subdir` a tool is handed. Null for an item in storage.",
            "required": [
              "ref"
            ],
            "properties": {
              "ref": {
                "type": "string"
              },
              "subdir": {
                "type": "string"
              }
            }
          },
          "record": {
            "type": [
              "object",
              "null"
            ],
            "description": "The record of how the item was made, among its files, and the checksum it was checked against when the version was registered; null when none was registered.",
            "required": [
              "file",
              "sha256"
            ],
            "properties": {
              "file": {
                "type": "string"
              },
              "sha256": {
                "type": "string"
              }
            }
          }
        }
      },
      "HiddenPage": {
        "type": "object",
        "required": [
          "kind",
          "name"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/HiddenPageKind"
          },
          "name": {
            "type": "string",
            "description": "A workflow's or a document's name, a tool page's address on the site,\nsuch as `#/tools/sbm/train`, or the name the site gives a menu entry,\nsuch as `api-reference`.\n"
          }
        }
      },
      "HiddenPageKind": {
        "type": "string",
        "enum": [
          "workflow",
          "tool-page",
          "document",
          "menu-item"
        ],
        "description": "`workflow`, a registered workflow; `tool-page`, one of the site's tool\npages; `document`, a registered document; or `menu-item`, one of the\nsite's own entries in the \"Learn more\" menu.\n"
      },
      "HiddenPageList": {
        "type": "object",
        "required": [
          "pages"
        ],
        "properties": {
          "pages": {
            "type": "array",
            "description": "In order of kind, then name.",
            "items": {
              "$ref": "#/components/schemas/HiddenPage"
            }
          }
        }
      },
      "Holding": {
        "type": "object",
        "required": [
          "id",
          "datatype",
          "title",
          "description",
          "release",
          "parts",
          "file",
          "size_bytes",
          "records",
          "related",
          "readable"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "What a caller names the item by."
          },
          "datatype": {
            "type": "string",
            "description": "The datatype it is, as a reference such as `blast-database@1`."
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "What its own record says of it. Empty when that gives only a title."
          },
          "release": {
            "type": "string",
            "description": "Which release of it this is. For a registered file, the file's checksum where its record states one. Empty when none is recorded."
          },
          "parts": {
            "type": "object",
            "description": "The values its datatype asks an item to state, by part name, as its description states them: a BLAST database's `stem`, a BioM3 weights bundle's `tag`. Empty when the datatype asks for none.",
            "additionalProperties": {
              "type": [
                "string",
                "number"
              ]
            }
          },
          "file": {
            "type": [
              "string",
              "null"
            ],
            "description": "The one file it is, by name, for an item that is a single file: the path `getHoldingFile` takes. Null for an item that is a folder."
          },
          "size_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "Its size, where its description states one, which registering it checks against its release."
          },
          "records": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "description": "How many records it holds, where its description states so."
          },
          "related": {
            "type": "array",
            "description": "The held items it is tied to, as its description says.",
            "items": {
              "type": "object",
              "required": [
                "relation",
                "id"
              ],
              "properties": {
                "relation": {
                  "type": "string",
                  "description": "How it is tied to the other item: `derived_from`, that it was made from it, as its release record lists."
                },
                "id": {
                  "type": "string",
                  "description": "The other item's id."
                }
              }
            }
          },
          "readable": {
            "type": "boolean",
            "description": "Whether `listHoldingFiles` and `getHoldingFile` give its files out."
          }
        }
      },
      "HoldingFileLink": {
        "type": "object",
        "required": [
          "path",
          "size_bytes",
          "url"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "content": {
            "type": "string",
            "description": "The file's text, when asked for `inline` and small enough."
          },
          "note": {
            "type": "string",
            "description": "Why a file asked for `inline` has no `content`."
          }
        }
      },
      "HoldingFileListing": {
        "type": "object",
        "required": [
          "id",
          "files"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "path",
                "size_bytes"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "description": "Relative to the item's own folder."
                },
                "size_bytes": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the item has more files than one listing gives."
          },
          "limit": {
            "type": "integer",
            "description": "How many files one listing gives. Present with `truncated`."
          }
        }
      },
      "HoldingListing": {
        "type": "object",
        "required": [
          "holdings"
        ],
        "properties": {
          "holdings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Holding"
            }
          }
        }
      },
      "HostLastSeenAt": {
        "type": [
          "integer",
          "null"
        ],
        "description": "Epoch seconds when the worker was last heard asking for work, to within a few minutes. `null` when it has not been heard from."
      },
      "HostWorker": {
        "type": [
          "object",
          "null"
        ],
        "description": "What the machine's worker last said it is. A worker older than version reporting names its runners and no `version`. `null` from a worker that says nothing, which runs no toolkit's tools.",
        "required": [
          "runners"
        ],
        "properties": {
          "version": {
            "type": "string",
            "example": "2026.10.0"
          },
          "install": {
            "type": "string",
            "description": "How the worker is installed: `container` for the published image, `checkout` when run from a copy of its repository.",
            "example": "container"
          },
          "commit": {
            "type": "string",
            "description": "The commit a published image was built from."
          },
          "runners": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "description": "The version of the runner the worker has for each devkit version, keyed by devkit version. Empty when it can run no toolkit's tools.",
            "example": {
              "0": "0.1.2"
            }
          },
          "no_runner_because": {
            "type": "string",
            "description": "Why the worker has no runner, when one is installed and cannot be used."
          },
          "remote_update": {
            "type": "boolean",
            "description": "Present and `true` when the worker moves itself to another version on being asked. Absent from one that is moved with the update command."
          }
        }
      },
      "HostWorkerStanding": {
        "type": "string",
        "enum": [
          "current",
          "behind",
          "unseen",
          "unknown"
        ],
        "description": "Where the worker stands against the version set for this environment. `unseen` when it has not asked for work; `unknown` when no version has been set or the worker states one that cannot be compared."
      },
      "HostWorkerUpdate": {
        "type": [
          "object",
          "null"
        ],
        "description": "The move an administrator has asked of the machine's worker. `null` when none is asked, and again once the worker asks for work as that version.",
        "required": [
          "version",
          "state",
          "requested_by",
          "requested_at"
        ],
        "properties": {
          "version": {
            "type": "string",
            "example": "2026.10.5"
          },
          "state": {
            "type": "string",
            "enum": [
              "waiting",
              "handed",
              "stalled",
              "failed"
            ],
            "description": "`waiting` until the worker next asks for work; `handed` once it has been told; `stalled` when it was told and has not come back as that version within fifteen minutes; `failed` when it said it could not."
          },
          "requested_by": {
            "type": "string",
            "description": "Who asked."
          },
          "requested_at": {
            "type": "integer",
            "description": "Epoch seconds."
          },
          "handed_at": {
            "type": "integer",
            "description": "Epoch seconds when the worker was told."
          },
          "error": {
            "type": "string",
            "description": "Why the worker could not make the move, as it said."
          }
        }
      },
      "JobAccepted": {
        "type": "object",
        "description": "The 202 response to a job submission. Poll `status_url` for progress.",
        "required": [
          "job_id",
          "status",
          "status_url",
          "target_id"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/JobState"
          },
          "status_url": {
            "type": "string",
            "description": "Path to poll, relative to the API root."
          },
          "target_id": {
            "type": "string",
            "description": "The compute target the job was dispatched to."
          },
          "tool": {
            "$ref": "#/components/schemas/ToolVersion"
          }
        }
      },
      "JobCompleteRequest": {
        "type": "object",
        "required": [
          "lease_id"
        ],
        "properties": {
          "lease_id": {
            "type": "string"
          }
        }
      },
      "JobCompleteResponse": {
        "type": "object",
        "required": [
          "released"
        ],
        "properties": {
          "released": {
            "type": "boolean",
            "description": "False when the lease was already released. Not an error."
          }
        }
      },
      "JobFile": {
        "type": "object",
        "required": [
          "path",
          "size_bytes"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "Relative to the job folder root, so result files start with `results/`."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "JobFileContent": {
        "type": "object",
        "required": [
          "path",
          "size_bytes"
        ],
        "description": "Exactly one of `content` or `download_url` is present. Small UTF-8 text is returned inline as `content`; larger or non-UTF-8 files return `download_url`, with `note` giving the reason.",
        "properties": {
          "path": {
            "type": "string",
            "description": "Echoes the requested path, relative to the job folder root."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "content_type": {
            "type": "string",
            "description": "The stored `Content-Type`, if one was recorded."
          },
          "content": {
            "type": "string",
            "description": "The file decoded as UTF-8. Present only for small text files."
          },
          "download_url": {
            "type": "string",
            "format": "uri",
            "description": "Short-lived presigned GET. Fetch it without an `Authorization` header: the signature is in the URL, and S3 rejects a request that also carries one."
          },
          "note": {
            "type": "string",
            "description": "Why the content was not inlined. Present whenever it was not."
          }
        }
      },
      "JobFileListing": {
        "type": "object",
        "required": [
          "job_id",
          "files"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFile"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the job holds more files than one page can list."
          }
        }
      },
      "JobFileRequest": {
        "type": "object",
        "required": [
          "path",
          "owner"
        ],
        "properties": {
          "path": {
            "$ref": "#/components/schemas/JobRelativePath"
          },
          "owner": {
            "$ref": "#/components/schemas/JobOwner"
          }
        }
      },
      "JobGeneratedSequences": {
        "type": "object",
        "required": [
          "job_id",
          "sequences"
        ],
        "additionalProperties": false,
        "properties": {
          "job_id": {
            "type": "string"
          },
          "sequences": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "output",
                "name",
                "residues"
              ],
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "description": "The id the portal gave the sequence."
                },
                "output": {
                  "type": "string",
                  "description": "The job's output it came from."
                },
                "name": {
                  "type": "string",
                  "description": "Its name in that output."
                },
                "residues": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "JobListRequest": {
        "type": "object",
        "required": [
          "prefix",
          "owner"
        ],
        "properties": {
          "prefix": {
            "type": "string",
            "description": "A job-relative prefix, under the same rules as a job-relative path.",
            "example": "results/"
          },
          "owner": {
            "$ref": "#/components/schemas/JobOwner"
          }
        }
      },
      "JobListing": {
        "type": "object",
        "required": [
          "jobs"
        ],
        "properties": {
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Total jobs available, for paging. May exceed the number returned."
          }
        }
      },
      "JobLog": {
        "type": "object",
        "description": "One page of a job's log. Clients may display `source` but should not branch on it.",
        "required": [
          "job_id",
          "lines",
          "complete"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Where this page was read from, e.g. `cloudwatch` for a job on a provisioned target or `s3` for a daemon host's rolling tail."
          },
          "lines": {
            "type": "array",
            "description": "Log lines, oldest first, without trailing newlines. Empty when the caller has caught up with a running job.",
            "items": {
              "type": "string"
            }
          },
          "cursor": {
            "type": "string",
            "description": "Opaque position to send back on the next read. Absent when the source rewrites its log in place; each read then returns the current tail, which replaces what was shown."
          },
          "complete": {
            "type": "boolean",
            "description": "The job is finished and this source has nothing further. Stop polling on this, not on an empty `lines` array, which only means the caller is up to date."
          }
        }
      },
      "JobOwner": {
        "type": "string",
        "description": "The `user_sub` of the job's submitter, from the dispatch envelope. Selects which job record to read; access is then decided from that record."
      },
      "JobRelativePath": {
        "type": "string",
        "description": "A path relative to the job's folder. Absolute paths and paths that use `..` to leave the job are refused.",
        "example": "results/result.tsv"
      },
      "JobState": {
        "type": "string",
        "description": "`queued`: waiting to start, which on a provisioned target includes allocating a machine and can take minutes (see `dispatch.lifecycle`). `cancelling`: a stop was requested via POST /api/tools/jobs/{job_id}/cancel; it is not terminal, and the job may still end `done`. `done`, `failed` and `cancelled` are terminal.",
        "enum": [
          "queued",
          "running",
          "cancelling",
          "cancelled",
          "done",
          "failed"
        ],
        "x-nm-terminal": [
          "done",
          "failed",
          "cancelled"
        ]
      },
      "JobStatus": {
        "description": "One job's full status. May carry fields beyond those listed; only the listed ones are stable.",
        "allOf": [
          {
            "$ref": "#/components/schemas/JobSummary"
          },
          {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable error message. Present when `status` is `failed`."
              },
              "download_url": {
                "type": "string",
                "format": "uri",
                "description": "Short-lived presigned GET for the results archive. Finished jobs only."
              },
              "download_filename": {
                "type": "string",
                "description": "Suggested filename for the archive."
              },
              "results_prefix": {
                "type": "string",
                "description": "Browsable results tree, relative to the outputs bucket."
              },
              "dispatch": {
                "type": "object",
                "additionalProperties": true,
                "description": "How the job was handed to its compute target. Only the fields listed here are stable; ignore any others.",
                "properties": {
                  "lifecycle": {
                    "type": "string",
                    "enum": [
                      "provisioning",
                      "running",
                      "succeeded",
                      "failed",
                      "preempted",
                      "lost"
                    ],
                    "description": "Finer-grained state for a job on a provisioned target; absent on daemon-backed targets. `provisioning` means a machine is being allocated while `status` stays `queued`. `preempted` (capacity reclaimed) and `lost` (the provider no longer recognizes the job) both show as `failed` in `status`, but the job itself was not at fault."
                  },
                  "provider": {
                    "type": "string",
                    "description": "The provisioner running the job, e.g. `aws-batch`. Present on provisioned targets only."
                  },
                  "exit_code": {
                    "type": "integer",
                    "description": "The container's exit status, where the target reports one."
                  }
                }
              },
              "extras": {
                "type": "object",
                "additionalProperties": true,
                "description": "Tool-specific fields. A job chained from a prior job records that job's id here as `prior_job_id`."
              }
            }
          }
        ]
      },
      "JobStatusRequest": {
        "type": "object",
        "required": [
          "owner",
          "status_patch"
        ],
        "properties": {
          "owner": {
            "$ref": "#/components/schemas/JobOwner"
          },
          "status_patch": {
            "type": "object",
            "additionalProperties": true,
            "description": "Fields to merge into the job's record. Only `status`, `step`, `error`, `started_at`, `finished_at` and `progress` are applied; other fields are ignored."
          }
        }
      },
      "JobStatusResponse": {
        "type": "object",
        "required": [
          "job_id",
          "applied"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "applied": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The fields that were written."
          }
        }
      },
      "JobSummary": {
        "type": "object",
        "description": "One row of a job listing.",
        "required": [
          "job_id",
          "status"
        ],
        "properties": {
          "job_id": {
            "type": "string"
          },
          "job_name": {
            "type": "string"
          },
          "tool_id": {
            "type": "string"
          },
          "target_id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/JobState"
          },
          "step": {
            "type": "string",
            "description": "Free-text progress label, such as a pipeline stage name. Absent when the job's target does not report one."
          },
          "submitted_at": {
            "type": "number",
            "description": "Epoch seconds, fractional."
          },
          "finished_at": {
            "type": [
              "number",
              "null"
            ],
            "description": "Epoch seconds. Null until the job reaches a terminal state."
          },
          "submitted_by_email": {
            "type": "string"
          },
          "result_size_bytes": {
            "type": "integer",
            "description": "Size of the downloadable results archive. Present on finished jobs only."
          },
          "output_extension": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        }
      },
      "JobUploadAbortRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobFileRequest"
          },
          {
            "type": "object",
            "required": [
              "upload_id"
            ],
            "properties": {
              "upload_id": {
                "$ref": "#/components/schemas/UploadId"
              }
            }
          }
        ]
      },
      "JobUploadCompleteRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobFileRequest"
          },
          {
            "type": "object",
            "required": [
              "upload_id",
              "parts"
            ],
            "properties": {
              "upload_id": {
                "$ref": "#/components/schemas/UploadId"
              },
              "parts": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "object",
                  "required": [
                    "number",
                    "etag"
                  ],
                  "properties": {
                    "number": {
                      "type": "integer"
                    },
                    "etag": {
                      "type": "string",
                      "description": "The ETag S3 answered the part's PUT with."
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "JobUploadPartsRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobFileRequest"
          },
          {
            "type": "object",
            "required": [
              "upload_id",
              "part_numbers"
            ],
            "properties": {
              "upload_id": {
                "$ref": "#/components/schemas/UploadId"
              },
              "part_numbers": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 10000
                }
              }
            }
          }
        ]
      },
      "JobUploadRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobFileRequest"
          },
          {
            "type": "object",
            "required": [
              "size_bytes"
            ],
            "properties": {
              "size_bytes": {
                "type": "integer",
                "minimum": 0,
                "description": "Exact size in bytes of the file to upload. Signed into the returned policy, so S3 rejects a body of a different size.",
                "example": 51234
              }
            }
          }
        ]
      },
      "JobUploadStartRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobFileRequest"
          },
          {
            "type": "object",
            "required": [
              "size_bytes"
            ],
            "properties": {
              "size_bytes": {
                "type": "integer",
                "minimum": 1,
                "description": "Exact size in bytes of the whole file. The joined file is held to it.",
                "example": 5948092567
              }
            }
          }
        ]
      },
      "JobUsage": {
        "type": "object",
        "description": "Jobs submitted in the period.",
        "required": [
          "count",
          "run_seconds",
          "by_status",
          "by_tool",
          "by_machine",
          "by_origin"
        ],
        "properties": {
          "count": {
            "type": "integer"
          },
          "run_seconds": {
            "type": "number",
            "description": "Time from start to finish, summed over the jobs whose records give both."
          },
          "by_status": {
            "$ref": "#/components/schemas/Counts"
          },
          "by_tool": {
            "$ref": "#/components/schemas/Counts"
          },
          "by_machine": {
            "$ref": "#/components/schemas/Counts"
          },
          "by_origin": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Counts"
              }
            ],
            "description": "By where each job was submitted from: the sign-in app, and the part of it that asked when it said (\"website: tools/blast/identify\", \"website: assistant/default\", \"MCP connector\")."
          }
        }
      },
      "LeaseRequest": {
        "type": "object",
        "description": "What this host's worker can run besides a plain container. A worker that\nsends no body predates toolkits and is handed none.\n",
        "properties": {
          "devkits": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0
            },
            "description": "The devkit versions this host has a runner for."
          },
          "worker": {
            "type": "object",
            "additionalProperties": true,
            "description": "What the worker is: its `version`, how it is installed, and `remote_update: true` when it moves itself to another version on being asked."
          },
          "update_failed": {
            "type": "object",
            "description": "Said once, by a worker that was handed a move and could not make it.",
            "properties": {
              "version": {
                "type": "string"
              },
              "because": {
                "type": "string"
              }
            }
          }
        }
      },
      "LeaseResponse": {
        "type": "object",
        "required": [
          "job"
        ],
        "properties": {
          "job": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true,
            "description": "The dispatch envelope, the same one every daemon-backed host receives. Null when nothing is queued."
          },
          "lease_id": {
            "type": "string",
            "description": "Opaque. Present only when `job` is not `null`. Pass it to POST /api/compute/jobs/{job_id}/complete when done."
          },
          "update": {
            "type": "object",
            "required": [
              "version"
            ],
            "description": "Present when an administrator has asked this worker to move to another version. `job` is then `null`. The worker is told once.",
            "properties": {
              "version": {
                "type": "string",
                "description": "The version of the worker to move to. Never an image: the worker knows where its own is published.",
                "example": "2026.10.5"
              }
            }
          }
        }
      },
      "ListResponse": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "path",
                "size_bytes",
                "url"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "description": "Relative to the requested prefix."
                },
                "size_bytes": {
                  "type": "integer"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          }
        }
      },
      "MachineKind": {
        "type": "string",
        "enum": [
          "registered",
          "ephemeral"
        ],
        "description": "`registered`: a machine whose worker asks the portal for work. `ephemeral`: a machine started for one job, such as one AWS Batch starts, with no worker of its own until then."
      },
      "MachineLabels": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "description": "Facts about the machine, `key: value`, written as Kubernetes writes labels. Any key may be used. The portal itself reads `accelerator: cuda`, which a tool needing a GPU requires, and writes `lifetime` (`persistent` or `ephemeral`) and, where it knows it, `arch` (`arm64` or `amd64`). A job may ask for any of them (`placement.select`).",
        "example": {
          "lifetime": "persistent",
          "accelerator": "cuda",
          "arch": "arm64"
        }
      },
      "MachineLabelsAndTaints": {
        "type": "object",
        "description": "A machine's labels and taints, both set at once.",
        "required": [
          "labels",
          "taints"
        ],
        "additionalProperties": false,
        "properties": {
          "labels": {
            "$ref": "#/components/schemas/MachineLabels"
          },
          "taints": {
            "$ref": "#/components/schemas/MachineTaints"
          }
        }
      },
      "MachineTaints": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "What keeps a job off the machine unless the job tolerates it (`placement.tolerate`) or names the machine. `preemptible` is a machine whose capacity can be taken back in the middle of a job.",
        "example": [
          "preemptible"
        ]
      },
      "MyTags": {
        "type": "object",
        "required": [
          "tags"
        ],
        "properties": {
          "tags": {
            "$ref": "#/components/schemas/TagNames"
          }
        }
      },
      "NamedToolkitVersion": {
        "type": "object",
        "description": "A registered version of a toolkit, named to run in place of the active one. It need not be active. A caller that names none runs the active version.",
        "required": [
          "name",
          "version"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1
          },
          "version": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "NotAMemberError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "required": [
              "organizations"
            ],
            "properties": {
              "organizations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Ids of the organizations the caller is a member of.",
                "example": [
                  "natural-machine"
                ]
              }
            }
          }
        ]
      },
      "OfferedWorkerRelease": {
        "type": "object",
        "required": [
          "version",
          "set_at",
          "set_by",
          "remote_update"
        ],
        "properties": {
          "version": {
            "type": "string",
            "example": "2026.10.5"
          },
          "set_at": {
            "type": "integer",
            "description": "Epoch seconds when it was offered."
          },
          "set_by": {
            "type": "string",
            "description": "Who offered it."
          },
          "remote_update": {
            "type": "boolean",
            "description": "Whether a worker of this version moves itself on being asked, and so whether it is offered as a move."
          }
        }
      },
      "Organization": {
        "type": "object",
        "required": [
          "org_id",
          "display_name",
          "is_active"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "description": "Stable slug: 2 to 32 lowercase letters, digits or hyphens.",
            "example": "natural-machine"
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable name. Equals `org_id` when the organization has no name set.",
            "example": "Natural Machine"
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the caller is currently acting under this organization. Exactly one entry is true when the list is non-empty."
          },
          "role": {
            "type": "string",
            "enum": [
              "member",
              "admin"
            ],
            "description": "The caller's role in this organization."
          }
        }
      },
      "OrganizationList": {
        "type": "object",
        "required": [
          "organizations",
          "active_org_id"
        ],
        "properties": {
          "organizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Organization"
            },
            "description": "Every organization the caller belongs to. Empty for a user who has not been provisioned yet."
          },
          "active_org_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The organization in effect, and the one to display: the stored choice if the caller is still a member, otherwise their first membership. Null only when `organizations` is empty.",
            "example": "natural-machine"
          },
          "stored_org_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The caller's saved choice, not checked against current memberships. Null when unset; may name an organization the caller has since left."
          },
          "is_admin_of_active": {
            "type": "boolean",
            "description": "Whether the caller is an admin of the active organization."
          }
        }
      },
      "OrganizationUsage": {
        "type": "object",
        "required": [
          "org_id",
          "display_name",
          "members",
          "sign_ins",
          "active_people",
          "jobs",
          "assistant",
          "sent",
          "sent_to_machines",
          "uploads",
          "unreadable_job_records",
          "people"
        ],
        "properties": {
          "org_id": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "members": {
            "type": "integer",
            "description": "Its members now."
          },
          "sign_ins": {
            "type": "integer",
            "description": "Its members' sign-ins in the period."
          },
          "active_people": {
            "type": "integer",
            "description": "Its members active on a day of the period."
          },
          "jobs": {
            "$ref": "#/components/schemas/JobUsage"
          },
          "assistant": {
            "$ref": "#/components/schemas/AssistantUsage"
          },
          "sent": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sent"
              }
            ],
            "description": "Files sent out of the portal's storage to its people, or to agents acting for them, in the period, with their bytes by what they are (`bytes_by_kind`) and by the sign-in app and part of it the link was made for (`bytes_by_origin`)."
          },
          "sent_to_machines": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sent"
              }
            ],
            "description": "Files sent out of the portal's storage to machines running its jobs in the period, with their bytes by what they are (`bytes_by_kind`) and by machine id (`bytes_by_machine`)."
          },
          "uploads": {
            "$ref": "#/components/schemas/Uploads"
          },
          "unreadable_job_records": {
            "type": "integer",
            "description": "Job records of the organization that could not be read, and so are not counted."
          },
          "people": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonUsage"
            }
          }
        }
      },
      "PatchSessionRequest": {
        "type": "object",
        "minProperties": 1,
        "description": "Rename, archive, or restore. Omitted fields are left unchanged.",
        "properties": {
          "name": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/SessionStatus"
          }
        }
      },
      "PersonUsage": {
        "type": "object",
        "required": [
          "email",
          "user_id",
          "role",
          "sign_ins",
          "sign_ins_by_app",
          "last_sign_in_at",
          "active_days",
          "last_active_at",
          "jobs",
          "assistant",
          "sent",
          "uploads"
        ],
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Null for a member who has never signed in."
          },
          "role": {
            "type": [
              "string",
              "null"
            ],
            "description": "Their role in the organization; null for someone no longer in it."
          },
          "sign_ins": {
            "type": "integer",
            "description": "Their sign-ins in the period."
          },
          "sign_ins_by_app": {
            "type": "object",
            "description": "Their sign-ins in the period by the sign-in app they were made through.",
            "additionalProperties": {
              "type": "integer"
            }
          },
          "last_sign_in_at": {
            "type": [
              "number",
              "null"
            ],
            "description": "Their last sign-in kept, in or out of the period."
          },
          "active_days": {
            "type": "integer",
            "description": "The days of the period their token reached the portal."
          },
          "last_active_at": {
            "type": [
              "number",
              "null"
            ],
            "description": "The last request of theirs noted, in or out of the period."
          },
          "jobs": {
            "$ref": "#/components/schemas/JobUsage"
          },
          "assistant": {
            "$ref": "#/components/schemas/AssistantUsage"
          },
          "sent": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Sent"
              }
            ],
            "description": "Files sent to them, or to agents acting for them, in the period."
          },
          "uploads": {
            "$ref": "#/components/schemas/Uploads"
          }
        }
      },
      "Placement": {
        "type": "object",
        "description": "What the job asks of the machine it runs on, beyond what its tool needs, as Kubernetes' node selectors and tolerations say it.",
        "additionalProperties": false,
        "properties": {
          "select": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Labels the machine must carry, each with the value given.",
            "example": {
              "accelerator": "cuda"
            }
          },
          "tolerate": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Taints the job accepts on its machine.",
            "example": [
              "preemptible"
            ]
          }
        }
      },
      "PresignedUpload": {
        "type": "object",
        "description": "A presigned S3 POST. Send a multipart form to `upload_url` with every field in `upload_fields` alongside the file part. S3 enforces the declared size.",
        "required": [
          "upload_url",
          "upload_fields",
          "upload_method",
          "expires_in_seconds"
        ],
        "properties": {
          "upload_url": {
            "type": "string",
            "format": "uri"
          },
          "upload_fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Form fields S3 requires. Send them verbatim."
          },
          "upload_method": {
            "type": "string",
            "const": "POST"
          },
          "expires_in_seconds": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "PromoteRequest": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string"
          }
        }
      },
      "Promoted": {
        "type": "object",
        "required": [
          "active",
          "promoted_at",
          "promoted_by"
        ],
        "properties": {
          "active": {
            "type": [
              "string",
              "null"
            ],
            "description": "The active version, or null when none is."
          },
          "promoted_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "When the active version was made active, in seconds since the epoch."
          },
          "promoted_by": {
            "type": "string",
            "description": "Who made it active; empty when none is."
          }
        }
      },
      "Promotion": {
        "type": "object",
        "description": "What a promotion made active, and what was active before.",
        "required": [
          "kind",
          "name",
          "version",
          "previous",
          "promoted_by"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "toolkits",
              "workflows",
              "documents",
              "holdings",
              "agents"
            ]
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string",
            "description": "The version now active."
          },
          "previous": {
            "type": [
              "string",
              "null"
            ],
            "description": "The version active before, or null when none was."
          },
          "promoted_by": {
            "type": "string"
          }
        }
      },
      "Quota": {
        "type": "object",
        "required": [
          "used_bytes",
          "max_bytes"
        ],
        "properties": {
          "used_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "max_bytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "QuotaExceededError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "required": [
              "quota"
            ],
            "properties": {
              "quota": {
                "$ref": "#/components/schemas/Quota"
              }
            }
          }
        ]
      },
      "RegisterComputeHostRequest": {
        "type": "object",
        "required": [
          "display_name"
        ],
        "properties": {
          "display_name": {
            "type": "string",
            "description": "Name shown for the machine in the portal. Truncated to 120 characters.",
            "example": "Lab workstation"
          },
          "gpu": {
            "type": "boolean",
            "description": "Whether the machine has an NVIDIA GPU, which labels it `accelerator=cuda`. Every registered machine is labelled `lifetime=persistent`; a system administrator adds the rest.",
            "example": true
          },
          "classes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "How a page written before labels says the same: `gpu-daemon` among them is a GPU. Read only where `gpu` is not given.",
            "example": [
              "gpu-daemon"
            ]
          }
        }
      },
      "RegisterComputeHostResponse": {
        "type": "object",
        "required": [
          "host_id",
          "enrollment_code"
        ],
        "properties": {
          "host_id": {
            "type": "string"
          },
          "enrollment_code": {
            "type": "string",
            "description": "Single-use code that expires after 24 hours. Returned only once; if it is lost, register the machine again.",
            "example": "NMC-7KQ4H-8XR2V-B19TC"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "RegisteredDatatypeVersion": {
        "type": "object",
        "required": [
          "ref",
          "owner",
          "state",
          "registered_at",
          "registered_by",
          "finalized_at"
        ],
        "properties": {
          "ref": {
            "type": "string",
            "description": "`<name>@<version>` for one of the portal's own, and `<toolkit>/<name>@<version>` for a toolkit's."
          },
          "owner": {
            "type": "string",
            "description": "The toolkit it belongs to; empty for the portal's own."
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "final"
            ]
          },
          "registered_at": {
            "type": "integer"
          },
          "registered_by": {
            "type": "string"
          },
          "finalized_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "When it was made final; null for a draft."
          }
        }
      },
      "RegisteredDocument": {
        "type": "object",
        "description": "One registered version of a document.",
        "required": [
          "name",
          "version",
          "title",
          "state",
          "address"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The document's name, and its address in the site, `#/docs/<name>`."
          },
          "version": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "What a reader calls it."
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "draft"
            ],
            "description": "`active` is the version everybody is shown. `draft` is a registered version that is not, listed for system admins only."
          },
          "address": {
            "type": "string",
            "description": "Where the version's files are read from, as a path of the site ending in `/`. The page is `index.md` there."
          }
        }
      },
      "RegisteredDocumentList": {
        "type": "object",
        "required": [
          "documents"
        ],
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegisteredDocument"
            }
          }
        }
      },
      "RegisteredPart": {
        "description": "One registered toolkit, workflow, document, held item or agent, by name.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Promoted"
          },
          {
            "type": "object",
            "required": [
              "name",
              "versions"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "versions": {
                "type": "array",
                "description": "Every registered version, newest registration first."
              }
            }
          }
        ]
      },
      "RegisteredTool": {
        "type": "object",
        "description": "One tool, as its toolkit defines it, with what only the portal knows added: what it holds that can fill each data parameter, and where this caller may run the tool.",
        "required": [
          "id",
          "toolkit",
          "version",
          "params",
          "outputs",
          "targets"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "What a submission names as `tool_id`.",
            "example": "blast-identify"
          },
          "toolkit": {
            "type": "string",
            "example": "blast"
          },
          "version": {
            "type": "string",
            "description": "The toolkit version that is active, which a submission runs.",
            "example": "2026.10.1"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the tool does, in its toolkit's words."
          },
          "full_description": {
            "type": "string",
            "description": "`description`, followed by what the tool returns: one line for each output, put together from that output's own description and, where its datatype is a table, its columns. An output's file is named by its path within the job folder, as the job's files are listed and read. What an agent or the API reference shows a reader choosing a tool."
          },
          "params": {
            "type": "object",
            "description": "The JSON Schema of a submission's `params`. A property that data can fill carries `x-nm-datatype`, the datatype it takes; `held` in the listing says what the portal holds of that datatype. A file whose records the tool limits carries `x-nm-max-records`, the most it takes, and `x-nm-max-record-length`, the longest it takes (for sequences, in residues); a submission over either is refused with a 413.",
            "additionalProperties": true
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "datatype": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "What the output is, which is how a later job is handed it."
                },
                "optional": {
                  "type": "boolean"
                },
                "primary": {
                  "type": "boolean"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Where it lands in the job's results, when the toolkit's description alone says so."
                }
              }
            }
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The machines this caller may run the tool on: those that can run its toolkit and meet its needs, a tainted one among them, since a caller may name it. The organization's default machines come first, in its order, then the rest by id."
          },
          "default_target": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where it runs when a submission names no machine and asks nothing of one: the first of the organization's default machines that suits it. `null` when none does, and such a submission is refused."
          }
        }
      },
      "RegisteredToolList": {
        "type": "object",
        "required": [
          "tools",
          "held",
          "machines",
          "default_machines"
        ],
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegisteredTool"
            }
          },
          "machines": {
            "type": "object",
            "description": "Each machine that some tool's `targets` names, keyed by its id, with the name to show for it and what it is: from these and `default_machines` a page that asks more of a machine (a `Placement`) finds the one the portal would choose.",
            "additionalProperties": {
              "type": "object",
              "required": [
                "name"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "kind": {
                  "$ref": "#/components/schemas/MachineKind"
                },
                "labels": {
                  "$ref": "#/components/schemas/MachineLabels"
                },
                "taints": {
                  "$ref": "#/components/schemas/MachineTaints"
                }
              }
            },
            "example": {
              "cloud-cpu": {
                "name": "cloud-cpu",
                "kind": "registered",
                "labels": {
                  "lifetime": "persistent",
                  "arch": "arm64"
                },
                "taints": []
              }
            }
          },
          "default_machines": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The caller's organization's default machines that they may use, in its order: a job that names no machine goes to the first that suits.",
            "example": [
              "cloud-cpu",
              "spark-nm-2"
            ]
          },
          "held": {
            "type": "object",
            "description": "What the portal holds of each datatype the tools' parameters ask for, keyed by datatype. A parameter states its datatype as `x-nm-datatype`; a caller fills it by sending the `id` of one of these.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "id",
                  "title",
                  "release",
                  "parts"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "release": {
                    "type": "string"
                  },
                  "parts": {
                    "type": "object",
                    "description": "The values its datatype asks an item to state, by part name: a BLAST database's `stem`, a BioM3 weights bundle's `tag`.",
                    "additionalProperties": {
                      "type": [
                        "string",
                        "number"
                      ]
                    }
                  },
                  "description": {
                    "type": "string",
                    "description": "What the portal's catalog says of it, for choosing between holdings of one datatype. Empty when it gives only a title."
                  }
                }
              }
            },
            "example": {
              "blast-database@1": [
                {
                  "id": "swissprot-tax-blast",
                  "title": "Swiss-Prot (UniProtKB, reviewed)",
                  "release": "2026_01",
                  "parts": {
                    "stem": "swissprot"
                  },
                  "description": "The reviewed section of UniProtKB, one record per entry. Built with taxonomy, so a hit's species resolves."
                }
              ]
            }
          }
        }
      },
      "RegisteredVersion": {
        "type": "object",
        "required": [
          "version",
          "registered_at",
          "registered_by",
          "source_repo",
          "source_commit"
        ],
        "properties": {
          "version": {
            "type": "string"
          },
          "registered_at": {
            "type": "integer",
            "description": "Seconds since the epoch."
          },
          "registered_by": {
            "type": "string"
          },
          "source_repo": {
            "type": "string",
            "description": "The repository the version was registered from, as recorded at registration; empty when none was."
          },
          "source_commit": {
            "type": "string",
            "description": "The commit in that repository; empty when none was recorded."
          }
        }
      },
      "RegisteredWorkflow": {
        "type": "object",
        "description": "One registered version of a workflow.",
        "required": [
          "name",
          "version",
          "title",
          "state",
          "address"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The workflow's name: its address in the site, and the `workflow_id` its sessions carry."
          },
          "version": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "What a reader calls it."
          },
          "state": {
            "type": "string",
            "enum": [
              "active",
              "draft"
            ],
            "description": "`active` is the version everybody is shown. `draft` is a registered version that is not, listed for system admins only."
          },
          "address": {
            "type": "string",
            "description": "Where the version's files are read from, as a path of the site ending in `/`."
          }
        }
      },
      "RegisteredWorkflowList": {
        "type": "object",
        "required": [
          "workflows"
        ],
        "properties": {
          "workflows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegisteredWorkflow"
            }
          }
        }
      },
      "RegistryTokenRequest": {
        "type": "object",
        "properties": {
          "image": {
            "type": "string",
            "description": "The image about to be pulled. If it needs no credential, the response is `credentials: null`. When omitted, credentials are always returned.",
            "example": "123456789012.dkr.ecr.us-east-2.amazonaws.com/sbm:latest"
          }
        }
      },
      "RegistryTokenResponse": {
        "type": "object",
        "required": [
          "registry",
          "username",
          "password",
          "expires_at"
        ],
        "properties": {
          "registry": {
            "type": "string",
            "description": "Registry endpoint to authenticate against.",
            "example": "https://123456789012.dkr.ecr.us-east-2.amazonaws.com"
          },
          "username": {
            "type": "string",
            "description": "The registry's fixed principal name; it does not identify this host.",
            "example": "AWS"
          },
          "password": {
            "type": "string",
            "description": "Secret. Pass it on stdin to `docker login --password-stdin`, never as a command-line argument."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When this credential stops working."
          },
          "credentials": {
            "type": "null",
            "description": "Present and `null` when the named image needs no credential. The other fields are then absent."
          }
        }
      },
      "ReleasedVersion": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RegisteredVersion"
          },
          {
            "type": "object",
            "required": [
              "release"
            ],
            "properties": {
              "release": {
                "type": "string",
                "description": "The release the version was registered from, by its fingerprint; empty for one registered from a folder."
              }
            }
          }
        ]
      },
      "ResultFile": {
        "type": "object",
        "required": [
          "path",
          "size_bytes"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "Relative to the job's `results/` folder."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ResultListing": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResultFile"
            }
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the job produced more files than one page can list."
          }
        }
      },
      "RevokedComputeHost": {
        "type": "object",
        "required": [
          "host_id",
          "status"
        ],
        "properties": {
          "host_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "revoked"
            ]
          }
        }
      },
      "SaveDemoRequest": {
        "type": "object",
        "required": [
          "session_id",
          "title"
        ],
        "additionalProperties": false,
        "properties": {
          "session_id": {
            "type": "string",
            "description": "One of the caller's sessions, in the organization the request acts under, every job of which has finished."
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 4000
          },
          "toolkits": {
            "type": "object",
            "description": "The version named for some toolkits, as the workflow's config names them: the demo keeps the tool listing its maker is given with these (`GET /api/jobs/tools?toolkit=<name>@<version>`).",
            "additionalProperties": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      },
      "SaveJobToUserDataRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Display name. Defaults to the job's own name."
          }
        }
      },
      "SaveJobToUserDataResponse": {
        "type": "object",
        "required": [
          "file_id",
          "size_bytes",
          "object_count"
        ],
        "properties": {
          "file_id": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "object_count": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "Sent": {
        "type": "object",
        "required": [
          "files",
          "bytes"
        ],
        "description": "Each file is counted once each time it is sent, at its size then; one whose transfer was cut short counts in full.",
        "properties": {
          "files": {
            "type": "integer"
          },
          "bytes": {
            "type": "integer"
          },
          "bytes_by_kind": {
            "$ref": "#/components/schemas/Counts"
          },
          "bytes_by_origin": {
            "$ref": "#/components/schemas/Counts"
          },
          "bytes_by_machine": {
            "$ref": "#/components/schemas/Counts"
          }
        }
      },
      "SessionConflict": {
        "description": "The 409 body from PUT /api/workflow-sessions/{session_id}/state when `base_version` is stale. Carries the stored `version` and `updated_at`.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer"
              },
              "updated_at": {
                "type": "number"
              }
            }
          }
        ]
      },
      "SessionDetail": {
        "description": "One session in full: the summary, its state, and its job index.",
        "allOf": [
          {
            "$ref": "#/components/schemas/SessionSummary"
          },
          {
            "type": "object",
            "required": [
              "state",
              "jobs"
            ],
            "properties": {
              "state": {
                "$ref": "#/components/schemas/SessionState"
              }
            }
          }
        ]
      },
      "SessionJobListing": {
        "type": "object",
        "description": "A session's jobs, resolved to `JobSummary` rows.",
        "required": [
          "jobs"
        ],
        "properties": {
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of jobs in the session's index. Can exceed the length of `jobs`, because jobs whose status documents are missing are omitted."
          }
        }
      },
      "SessionJobRef": {
        "type": "object",
        "description": "One job recorded against a session. The client records it with POST /api/workflow-sessions/{session_id}/jobs after the submission returns.",
        "required": [
          "job_id",
          "tool_id",
          "role"
        ],
        "properties": {
          "job_id": {
            "type": "string",
            "pattern": "^[^/\\\\]+$"
          },
          "tool_id": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/SessionRole"
          },
          "step": {
            "type": "string",
            "description": "The workflow step id the job was submitted from."
          },
          "submitted_at": {
            "type": "number",
            "description": "Epoch seconds, set by the server when the job is recorded."
          }
        }
      },
      "SessionList": {
        "type": "object",
        "required": [
          "sessions"
        ],
        "properties": {
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionSummary"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of sessions matching the filters, before `limit` and `offset`."
          }
        }
      },
      "SessionRole": {
        "type": "string",
        "description": "What a job is for within its workflow, e.g. `dataset-build`, `finetune`, `generate`, `fold`, `blast`, `align`, `project`. Open-ended, and distinct from `tool_id`: several jobs may use the same tool for different purposes.",
        "pattern": "^[a-z0-9-]{1,40}$"
      },
      "SessionState": {
        "type": "object",
        "additionalProperties": true,
        "description": "The workflow's saved state, stored verbatim and not interpreted by the server. Keep it to job ids and the small facts needed to resume; results stay in their jobs."
      },
      "SessionStatus": {
        "type": "string",
        "description": "`archived` hides a session from the default listing without deleting it or its job index.",
        "enum": [
          "active",
          "archived"
        ]
      },
      "SessionSummary": {
        "type": "object",
        "description": "One row of a session listing. Does not include `state`.",
        "required": [
          "session_id",
          "workflow_id",
          "name",
          "status",
          "created_at",
          "updated_at",
          "version"
        ],
        "properties": {
          "session_id": {
            "type": "string",
            "description": "UUID (version 4) assigned by the server."
          },
          "workflow_id": {
            "$ref": "#/components/schemas/WorkflowId"
          },
          "name": {
            "type": "string",
            "description": "Display name, unique (case-insensitively) among the caller's sessions on the same workflow. Sanitized on write: characters other than letters, digits, '.', '_' and '-' become underscores, and the result is capped at 100 characters."
          },
          "org_id": {
            "type": "string",
            "description": "The organization that was active when the session was created, and under which its jobs are written."
          },
          "status": {
            "$ref": "#/components/schemas/SessionStatus"
          },
          "resume_step": {
            "type": "string",
            "description": "Workflow step id to open when the session is resumed, e.g. `generate`. A hint only; it does not restrict navigation in either direction."
          },
          "workflow_version": {
            "type": "string",
            "description": "The version of the workflow that made the session, where the workflow stated one."
          },
          "created_at": {
            "type": "number",
            "description": "Epoch seconds, fractional."
          },
          "updated_at": {
            "type": "number",
            "description": "Epoch seconds. Updated by every write, including autosave."
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "Incremented on every state write. Send it back as `base_version` when writing state; a mismatch returns 409."
          },
          "job_count": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of jobs recorded against the session."
          },
          "jobs": {
            "type": "array",
            "description": "The session's job references, newest first; resolve them with GET /api/workflow-sessions/{session_id}/jobs. In a listing, present only with `include=jobs`. Always present when reading a single session.",
            "items": {
              "$ref": "#/components/schemas/SessionJobRef"
            }
          }
        }
      },
      "SetActiveOrganizationRequest": {
        "type": "object",
        "required": [
          "org_id"
        ],
        "properties": {
          "org_id": {
            "type": "string",
            "description": "An organization the caller is a member of. Any other value returns 403.",
            "example": "example-lab"
          }
        }
      },
      "StageRequest": {
        "type": "object",
        "required": [
          "name",
          "owner"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The asset's handle as it appears in this job's spec, such as `configs` or `weights-stage3`. Not a path or URI.",
            "example": "weights-stage3"
          },
          "owner": {
            "$ref": "#/components/schemas/JobOwner"
          }
        }
      },
      "StageResponse": {
        "type": "object",
        "required": [
          "files"
        ],
        "properties": {
          "files": {
            "type": "array",
            "description": "Every object in the asset. May be empty.",
            "items": {
              "type": "object",
              "required": [
                "path",
                "size",
                "url"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "description": "Where to write this object, relative to the asset's destination.",
                  "example": "inference/stage1_PenCL.json"
                },
                "size": {
                  "type": "integer",
                  "description": "Bytes. Assets are immutable within a version, so a file already held at this path and size can be skipped."
                },
                "url": {
                  "type": "string",
                  "description": "Presigned and read-only; valid long enough to fetch the largest object in the asset."
                }
              }
            }
          }
        }
      },
      "TagList": {
        "type": "object",
        "required": [
          "tags"
        ],
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "description"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string",
                  "description": "What the tag lets its holder do."
                }
              }
            }
          }
        }
      },
      "TagNames": {
        "type": "array",
        "description": "The tags a person holds, in order of name: marks a system admin gives them, each letting them do or see more (`listTags`). Known once they have signed in; empty before.",
        "items": {
          "type": "string"
        },
        "uniqueItems": true
      },
      "ToolVersion": {
        "type": "object",
        "description": "The registered tool a job runs, and the package version that carries it. Set by POST /api/jobs only.",
        "required": [
          "id",
          "package",
          "version"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "package": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        }
      },
      "ToolkitSource": {
        "type": [
          "object",
          "null"
        ],
        "description": "The version the toolkit's source is at: what config.json on the default branch of the GitHub repository its newest version was registered from says, read as the portal's GitHub App. Null where it is not read: the portal has no App, or no version records a repository on GitHub.",
        "required": [
          "repo"
        ],
        "properties": {
          "repo": {
            "type": "string",
            "description": "The repository, as owner/name."
          },
          "version": {
            "type": "string",
            "description": "The version its config.json states."
          },
          "error": {
            "type": "string",
            "description": "Why the version could not be read, in place of a version."
          }
        }
      },
      "ToolkitVersion": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RegisteredVersion"
          },
          {
            "type": "object",
            "required": [
              "devkit",
              "image"
            ],
            "properties": {
              "devkit": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "The devkit version the toolkit was written for; null for a version in an earlier format the portal no longer reads."
              },
              "image": {
                "type": "string",
                "description": "The toolkit's image, as `<repository>@sha256:<fingerprint>`."
              }
            }
          }
        ]
      },
      "UniProtEntry": {
        "type": "object",
        "description": "One UniProtKB entry, shaped like a bioparsers dataset build's output record. Values reflect current UniProt, not the pinned release behind `swissprot-parsed`, so a revised entry can differ from a built dataset.",
        "required": [
          "accession",
          "reviewed",
          "fields"
        ],
        "properties": {
          "accession": {
            "type": "string",
            "description": "The entry's primary accession. May differ from the one requested: a secondary accession resolves to the entry that absorbed it."
          },
          "entry_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "UniProt's mnemonic identifier, e.g. `AATM_RABIT`."
          },
          "reviewed": {
            "type": "boolean",
            "description": "True for a Swiss-Prot entry (manually curated), false for TrEMBL (automatically annotated)."
          },
          "sequence": {
            "type": [
              "string",
              "null"
            ],
            "description": "The amino-acid sequence, one letter per residue."
          },
          "fields": {
            "$ref": "#/components/schemas/UniProtFields"
          }
        }
      },
      "UniProtFields": {
        "type": "object",
        "description": "Annotation fields keyed by the field ids GET /api/tools/bioparsers/builders publishes for the `uniprot` field set, in catalog order. A field with no value is absent, never `null` or empty. Each value follows the field's `kind`: `text` is a string, `text-list` an array of strings, `number` an integer.",
        "additionalProperties": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "integer"
            }
          ]
        }
      },
      "UploadId": {
        "type": "string",
        "minLength": 1,
        "description": "The id `upload/start` answered with."
      },
      "UploadPartsResponse": {
        "type": "object",
        "required": [
          "method",
          "parts",
          "expires_in_seconds"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "PUT"
            ]
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "number",
                "url"
              ],
              "properties": {
                "number": {
                  "type": "integer"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "expires_in_seconds": {
            "type": "integer"
          }
        }
      },
      "UploadResponse": {
        "type": "object",
        "required": [
          "url",
          "fields",
          "method",
          "size_bytes",
          "expires_in_seconds"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Form fields to send with the file. Order is preserved."
          },
          "method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "size_bytes": {
            "type": "integer"
          },
          "expires_in_seconds": {
            "type": "integer"
          }
        }
      },
      "UploadStartResponse": {
        "type": "object",
        "required": [
          "upload_id",
          "part_bytes",
          "parts",
          "size_bytes",
          "expires_in_seconds"
        ],
        "properties": {
          "upload_id": {
            "$ref": "#/components/schemas/UploadId"
          },
          "part_bytes": {
            "type": "integer",
            "description": "The size of every part but the last."
          },
          "parts": {
            "type": "integer",
            "description": "How many parts the file is sent in."
          },
          "size_bytes": {
            "type": "integer"
          },
          "expires_in_seconds": {
            "type": "integer",
            "description": "How long each part URL handed out works."
          }
        }
      },
      "Uploads": {
        "type": "object",
        "required": [
          "files",
          "bytes"
        ],
        "description": "Files uploaded in the period, as the portal keeps them: My Data's uploads that are still kept, and each job input uploaded for its job.",
        "properties": {
          "files": {
            "type": "integer"
          },
          "bytes": {
            "type": "integer"
          }
        }
      },
      "UserDataItem": {
        "type": "object",
        "description": "One My Data entry: either a single uploaded file or a dataset saved from a finished job. Dataset-only fields are absent on uploads.",
        "required": [
          "file_id",
          "display_name",
          "size_bytes",
          "uploaded_at"
        ],
        "properties": {
          "file_id": {
            "type": "string"
          },
          "display_name": {
            "type": "string",
            "maxLength": 200
          },
          "category": {
            "type": "string",
            "maxLength": 50
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "uploaded_at": {
            "type": "number",
            "description": "Epoch seconds, fractional."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "shared_with_teams": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "download_url": {
            "type": "string",
            "format": "uri"
          },
          "kind": {
            "type": "string",
            "const": "dataset",
            "description": "Present only on job-saved datasets; absent on plain uploads."
          },
          "source_job_id": {
            "type": "string",
            "description": "Dataset only."
          },
          "source_tool_id": {
            "type": "string",
            "description": "Dataset only."
          },
          "output_subpath": {
            "type": "string",
            "description": "Dataset only. The source job's primary output directory, relative to the dataset's root, for use as a downstream job's input."
          },
          "object_count": {
            "type": "integer",
            "description": "Dataset only."
          }
        }
      },
      "UserDataListing": {
        "type": "object",
        "required": [
          "items",
          "quota"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UserDataItem"
            },
            "description": "Newest first."
          },
          "quota": {
            "$ref": "#/components/schemas/Quota"
          }
        }
      },
      "WorkerRelease": {
        "type": "object",
        "description": "The worker a machine should be running, from which a page writes the command that installs or updates one, and the versions a worker can be asked to move to.",
        "required": [
          "image",
          "version",
          "runner_folder",
          "updates"
        ],
        "properties": {
          "image": {
            "type": "string",
            "description": "Where the worker's image is published, without a tag.",
            "example": "ghcr.io/natural-machine/nm-portal-host-worker"
          },
          "version": {
            "type": [
              "string",
              "null"
            ],
            "description": "The newest worker version this portal offers, which each machine's worker is held against. `null` when none is offered.",
            "example": "2026.10.5"
          },
          "updates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The offered versions a worker can be asked to move to, the newest first: those whose worker moves itself, so that one moved this way can be moved this way again.",
            "example": [
              "2026.10.5",
              "2026.10.4"
            ]
          },
          "runner_folder": {
            "type": "string",
            "description": "The folder a worker in a container shares with its machine, under the same path on both, for its runner to work in.",
            "example": "/opt/nm-portal/worker-data"
          }
        }
      },
      "WorkerUpdateAnswer": {
        "type": "object",
        "required": [
          "host_id",
          "worker_update"
        ],
        "properties": {
          "host_id": {
            "type": "string",
            "example": "byoc-1f4c2a9b8d3e5607"
          },
          "worker_update": {
            "$ref": "#/components/schemas/HostWorkerUpdate"
          }
        }
      },
      "WorkerUpdateRequest": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string",
            "description": "A host worker version, as numbers separated by dots.",
            "example": "2026.10.5"
          }
        }
      },
      "WorkflowId": {
        "type": "string",
        "description": "The workflow a session belongs to, by its name: a registered workflow (`GET /api/workflows`). Unknown values return 400.",
        "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
      },
      "WriteSessionStateRequest": {
        "type": "object",
        "required": [
          "state",
          "base_version"
        ],
        "properties": {
          "state": {
            "$ref": "#/components/schemas/SessionState"
          },
          "resume_step": {
            "type": "string"
          },
          "base_version": {
            "type": "integer",
            "minimum": 1,
            "description": "The `version` this client last read. If the stored version differs, the write is rejected with 409."
          }
        }
      },
      "WriteSessionStateResponse": {
        "type": "object",
        "required": [
          "version",
          "updated_at"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "updated_at": {
            "type": "number"
          }
        }
      }
    }
  }
}
