{
  "openapi": "3.1.0",
  "info": {
    "title": "Jean Platform API",
    "description": "A metered API for evaluating and, later, serving models of human behaviour. Authenticate with `Authorization: Bearer jean_live_...` (API key) or a session token from the dashboard. Every response carries `X-Request-Id`.",
    "version": "0.2.0",
    "x-git-sha": "6962b4e11315"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Liveness",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                },
                "example": {
                  "git_sha": "24cea6f1ac37",
                  "hfm_sha": "9f2c1ab4d7e0",
                  "env": "prod"
                }
              }
            }
          }
        },
        "x-doc-page": "get-health",
        "x-auth": "none"
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "me"
        ],
        "summary": "Who am I",
        "operationId": "getMe",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                },
                "example": {
                  "principal": "session",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "orgs": [
                    {
                      "id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "name": "Acme",
                      "plan": "free",
                      "data_use": "scoring_only",
                      "role": "owner",
                      "created_at": "2026-01-15T09:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "get-me",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/keys": {
      "get": {
        "tags": [
          "keys"
        ],
        "summary": "List API keys",
        "operationId": "listKeys",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                },
                "example": {
                  "keys": [
                    {
                      "id": "key_a1b2c3d4e5f6g7h8i9j0",
                      "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "name": "ci",
                      "prefix": "jean_live_exam",
                      "created_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                      "created_at": "2026-01-15T09:30:00Z",
                      "last_used_at": null,
                      "revoked_at": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-keys",
        "x-auth": "session",
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "keys"
        ],
        "summary": "Create an API key (shown once)",
        "operationId": "createKey",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiKeyCreate"
              },
              "example": {
                "name": "ci"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                },
                "example": {
                  "id": "key_a1b2c3d4e5f6g7h8i9j0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "name": "ci",
                  "prefix": "jean_live_exam",
                  "created_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "created_at": "2026-01-15T09:30:00Z",
                  "last_used_at": null,
                  "revoked_at": null,
                  "key": "jean_live_exampleexampleexampleexample0000"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "create-key",
        "x-auth": "session",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/keys/{key_id}": {
      "delete": {
        "tags": [
          "keys"
        ],
        "summary": "Revoke an API key (rows are never deleted)",
        "operationId": "revokeKey",
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Key Id"
            },
            "example": "key_a1b2c3d4e5f6g7h8i9j0"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKey"
                },
                "example": {
                  "id": "key_a1b2c3d4e5f6g7h8i9j0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "name": "ci",
                  "prefix": "jean_live_exam",
                  "created_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "created_at": "2026-01-15T09:30:00Z",
                  "last_used_at": null,
                  "revoked_at": null
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "revoke-key",
        "x-auth": "session",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/suites": {
      "get": {
        "tags": [
          "suites"
        ],
        "summary": "List suites",
        "operationId": "listSuites",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuiteList"
                },
                "example": {
                  "suites": [
                    {
                      "suite_id": "suite:smoke-v1",
                      "version": "1",
                      "metric": "accuracy",
                      "n_items": 200,
                      "per_item_feedback": true,
                      "description": "A tiny suite for wiring up a client.",
                      "hfm_sha": "9f2c1ab4d7e0"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-suites",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/evals": {
      "post": {
        "tags": [
          "evals"
        ],
        "summary": "Submit predictions for scoring",
        "description": "Queues an `eval` job. Inline `predictions` are capped at 5 MB of JSON. Poll `GET /v1/jobs/{id}` for the result.",
        "operationId": "submitEval",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 128
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional. Resubmitting with the same key returns the original job.",
              "title": "Idempotency-Key"
            },
            "description": "Optional. Resubmitting with the same key returns the original job.",
            "example": "YOUR-UNIQUE-REQUEST-KEY"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvalSubmit"
              },
              "example": {
                "label": "nightly",
                "predictions": [
                  {
                    "item_id": "item_4211",
                    "prediction": [
                      "item_88",
                      "item_12",
                      "item_5"
                    ]
                  },
                  {
                    "item_id": "item_4212",
                    "prediction": [
                      "item_31",
                      "item_7",
                      "item_99"
                    ]
                  }
                ],
                "suite_id": "suite:smoke-v1"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "example": {
                  "id": "job_q1w2e3r4t5y6u7i8o9p0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "type": "eval",
                  "status": "queued",
                  "request_id": "req_z9x8c7v6b5n4m3l2",
                  "label": "nightly",
                  "versions": {
                    "hfm_sha": "9f2c1ab4d7e0",
                    "suite_id": "suite:smoke-v1"
                  },
                  "attempts": 0,
                  "created_at": "2026-01-15T09:30:00Z",
                  "started_at": null,
                  "finished_at": null
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Inline predictions exceed the 5 MB cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "submit-eval",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/jobs": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "List jobs, newest first",
        "operationId": "listJobs",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "eval",
                    "predict"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Type"
            },
            "example": "eval"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "queued",
                    "running",
                    "succeeded",
                    "failed",
                    "cancelled"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            },
            "example": "queued"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            },
            "example": 50
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Return jobs created before this time.",
              "title": "Before"
            },
            "description": "Return jobs created before this time.",
            "example": "2026-01-15T09:30:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobList"
                },
                "example": {
                  "jobs": [
                    {
                      "attempts": 1,
                      "created_at": "2026-01-15T09:30:00Z",
                      "finished_at": "2026-01-15T09:30:18Z",
                      "id": "job_q1w2e3r4t5y6u7i8o9p0",
                      "label": "nightly",
                      "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "request_id": "req_z9x8c7v6b5n4m3l2",
                      "result": {
                        "hfm_sha": "9f2c1ab4d7e0",
                        "metric": "accuracy",
                        "n": 200,
                        "n_submitted": 200,
                        "n_unmatched": 0,
                        "suite_id": "suite:smoke-v1",
                        "suite_version": "1",
                        "value": 0.734
                      },
                      "started_at": "2026-01-15T09:30:02Z",
                      "status": "succeeded",
                      "trace_url": "https://storage.googleapis.com/jean-artifacts/.../trace.json",
                      "type": "eval",
                      "versions": {
                        "hfm_sha": "9f2c1ab4d7e0",
                        "suite_id": "suite:smoke-v1",
                        "suite_version": "1"
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-jobs",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/jobs/{job_id}": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Get a job",
        "operationId": "getJob",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            },
            "example": "job_q1w2e3r4t5y6u7i8o9p0"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "example": {
                  "attempts": 1,
                  "created_at": "2026-01-15T09:30:00Z",
                  "finished_at": "2026-01-15T09:30:18Z",
                  "id": "job_q1w2e3r4t5y6u7i8o9p0",
                  "label": "nightly",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "request_id": "req_z9x8c7v6b5n4m3l2",
                  "result": {
                    "hfm_sha": "9f2c1ab4d7e0",
                    "metric": "accuracy",
                    "n": 200,
                    "n_submitted": 200,
                    "n_unmatched": 0,
                    "suite_id": "suite:smoke-v1",
                    "suite_version": "1",
                    "value": 0.734
                  },
                  "started_at": "2026-01-15T09:30:02Z",
                  "status": "succeeded",
                  "trace_url": "https://storage.googleapis.com/jean-artifacts/.../trace.json",
                  "type": "eval",
                  "versions": {
                    "hfm_sha": "9f2c1ab4d7e0",
                    "suite_id": "suite:smoke-v1",
                    "suite_version": "1"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "get-job",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/jobs/{job_id}/cancel": {
      "post": {
        "tags": [
          "jobs"
        ],
        "summary": "Cancel a queued job",
        "operationId": "cancelJob",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            },
            "example": "job_q1w2e3r4t5y6u7i8o9p0"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                },
                "example": {
                  "attempts": 1,
                  "created_at": "2026-01-15T09:30:00Z",
                  "finished_at": "2026-01-15T09:30:18Z",
                  "id": "job_q1w2e3r4t5y6u7i8o9p0",
                  "label": "nightly",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "request_id": "req_z9x8c7v6b5n4m3l2",
                  "result": {
                    "hfm_sha": "9f2c1ab4d7e0",
                    "metric": "accuracy",
                    "n": 200,
                    "n_submitted": 200,
                    "n_unmatched": 0,
                    "suite_id": "suite:smoke-v1",
                    "suite_version": "1",
                    "value": 0.734
                  },
                  "started_at": "2026-01-15T09:30:02Z",
                  "status": "succeeded",
                  "trace_url": "https://storage.googleapis.com/jean-artifacts/.../trace.json",
                  "type": "eval",
                  "versions": {
                    "hfm_sha": "9f2c1ab4d7e0",
                    "suite_id": "suite:smoke-v1",
                    "suite_version": "1"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The job is not in a cancellable state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "cancel-job",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/jobs/{job_id}/trace": {
      "get": {
        "tags": [
          "jobs"
        ],
        "summary": "Fetch trace.json through the API",
        "operationId": "getJobTrace",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            },
            "example": "job_q1w2e3r4t5y6u7i8o9p0"
          }
        ],
        "responses": {
          "200": {
            "description": "The OpenInference-style trace.",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "get-job-trace",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "usage"
        ],
        "summary": "Usage this period",
        "operationId": "getUsage",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                },
                "example": {
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "plan": "free",
                  "period_start": "2026-01-15T09:30:00Z",
                  "period_end": "2026-01-15T09:30:00Z",
                  "totals": {
                    "eval_items": 18000,
                    "requests": 412
                  },
                  "active_jobs": 1,
                  "limits": {
                    "concurrent_jobs": 2,
                    "eval_items_per_month": 20000
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "get-usage",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/members": {
      "get": {
        "tags": [
          "org"
        ],
        "summary": "List org members",
        "operationId": "listMembers",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberList"
                },
                "example": {
                  "members": [
                    {
                      "user_id": "usr_b2c3d4e5f6g7h8i9j0k1",
                      "email": "ada@example.com",
                      "role": "owner",
                      "created_at": "2026-01-15T09:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-members",
        "x-auth": "session",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/members/{user_id}": {
      "patch": {
        "tags": [
          "org"
        ],
        "summary": "Promote or demote a member",
        "description": "Owners only. An org must always keep at least one owner, so demoting the last one is refused with 409 `invalid_state`; promote a second owner first. An owner may demote themselves once another owner exists.",
        "operationId": "setMemberRole",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            },
            "example": "usr_b2c3d4e5f6g7h8i9j0k1"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemberRoleUpdate"
              },
              "example": {
                "role": "owner"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Member"
                },
                "example": {
                  "user_id": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "email": "ada@example.com",
                  "role": "owner",
                  "created_at": "2026-01-15T09:30:00Z"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "An org must keep at least one owner; this would remove the last.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "set-member-role",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "tags": [
          "org"
        ],
        "summary": "Remove a member from the org",
        "description": "Owners only, and the way someone is offboarded. The last owner cannot be removed (409 `invalid_state`). API keys belong to the org, not to the person who created them, so they keep working; revoke the departing person's keys separately if their access should end with them.",
        "operationId": "removeMember",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "User Id"
            },
            "example": "usr_b2c3d4e5f6g7h8i9j0k1"
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "An org must keep at least one owner; this would remove the last.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "remove-member",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/invites": {
      "get": {
        "tags": [
          "org"
        ],
        "summary": "List invites",
        "operationId": "listInvites",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteList"
                },
                "example": {
                  "invites": [
                    {
                      "id": "inv_a1b2c3d4e5f6g7h8i9j0",
                      "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "email": "ada@example.com",
                      "role": "owner",
                      "invited_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                      "created_at": "2026-01-15T09:30:00Z",
                      "expires_at": "2026-01-15T09:30:00Z",
                      "accepted_at": null,
                      "accepted_by": null,
                      "revoked_at": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-invites",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "org"
        ],
        "summary": "Invite a teammate by email",
        "description": "The invite is consumed on the invitee's first sign-in with that email address. Owners only. Invites expire after 14 days.",
        "operationId": "createInvite",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteCreate"
              },
              "example": {
                "email": "ada@example.com"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invite"
                },
                "example": {
                  "id": "inv_a1b2c3d4e5f6g7h8i9j0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "email": "ada@example.com",
                  "role": "owner",
                  "invited_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "created_at": "2026-01-15T09:30:00Z",
                  "expires_at": "2026-01-15T09:30:00Z",
                  "accepted_at": null,
                  "accepted_by": null,
                  "revoked_at": null
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "create-invite",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/invites/{invite_id}": {
      "delete": {
        "tags": [
          "org"
        ],
        "summary": "Revoke an invite",
        "operationId": "revokeInvite",
        "parameters": [
          {
            "name": "invite_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Invite Id"
            },
            "example": "inv_a1b2c3d4e5f6g7h8i9j0"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invite"
                },
                "example": {
                  "id": "inv_a1b2c3d4e5f6g7h8i9j0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "email": "ada@example.com",
                  "role": "owner",
                  "invited_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "created_at": "2026-01-15T09:30:00Z",
                  "expires_at": "2026-01-15T09:30:00Z",
                  "accepted_at": null,
                  "accepted_by": null,
                  "revoked_at": null
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "revoke-invite",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/domains": {
      "get": {
        "tags": [
          "org"
        ],
        "summary": "List claimed domains",
        "operationId": "listDomains",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgDomainList"
                },
                "example": {
                  "domains": [
                    {
                      "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "domain": "example.com",
                      "claimed_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                      "verified_at": "2026-01-15T09:30:00Z",
                      "created_at": "2026-01-15T09:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-domains",
        "x-auth": "session",
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "org"
        ],
        "summary": "Claim an email domain",
        "description": "New users who sign in with a verified email on a claimed domain join this org as members. An owner may claim the domain of their own verified email; public mailbox domains cannot be claimed. Each domain belongs to at most one org.",
        "operationId": "claimDomain",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DomainClaim"
              },
              "example": {
                "domain": "example.com"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgDomain"
                },
                "example": {
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "domain": "example.com",
                  "claimed_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "verified_at": "2026-01-15T09:30:00Z",
                  "created_at": "2026-01-15T09:30:00Z"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "claim-domain",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/domains/{domain}": {
      "delete": {
        "tags": [
          "org"
        ],
        "summary": "Release a claimed domain",
        "operationId": "releaseDomain",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Domain"
            },
            "example": "example.com"
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "release-domain",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/audit": {
      "get": {
        "tags": [
          "org"
        ],
        "summary": "The org's audit log",
        "operationId": "listAuditEvents",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            },
            "example": 100
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventList"
                },
                "example": {
                  "events": [
                    {
                      "id": 1842,
                      "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                      "actor_user_id": "usr_b2c3d4e5f6g7h8i9j0k1",
                      "actor_key_id": "key_a1b2c3d4e5f6g7h8i9j0",
                      "action": "key.create",
                      "target": "key_a1b2c3d4e5f6g7h8i9j0",
                      "request_id": "req_z9x8c7v6b5n4m3l2",
                      "details": {
                        "name": "ci"
                      },
                      "ts": "2026-01-15T09:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "list-audit-events",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "uploads"
        ],
        "summary": "Reserve an upload and get a PUT URL",
        "description": "Reserves a private object for this org and returns a time-limited PUT URL. PUT exactly `size_bytes` with `content_type`, then pass `ref` to a job as `input_ref`. Objects are private to the org and are only ever read by the worker.",
        "operationId": "createUpload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadCreate"
              },
              "example": {
                "kind": "predictions",
                "size_bytes": 2048
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                },
                "example": {
                  "id": "upl_a1b2c3d4e5f6g7h8i9j0",
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "kind": "predictions",
                  "content_type": "application/json",
                  "size_bytes": 2048,
                  "ref": "upload:upl_a1b2c3d4e5f6g7h8i9j0",
                  "put_url": "https://storage.googleapis.com/jean-uploads/...",
                  "put_headers": {
                    "Content-Type": "application/json"
                  },
                  "expires_at": "2026-01-15T09:30:00Z"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "create-upload",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/uploads/{upload_id}/{kind}": {
      "put": {
        "tags": [
          "uploads"
        ],
        "summary": "Upload bytes through the API (local artifact backend only)",
        "description": "In production `put_url` is a signed GCS URL and this route returns 404. With the local artifact backend it accepts the bytes directly.",
        "operationId": "putUploadBytes",
        "parameters": [
          {
            "name": "upload_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Upload Id"
            },
            "example": "upl_a1b2c3d4e5f6g7h8i9j0"
          },
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Kind"
            },
            "example": "predictions"
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No such resource in this org.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Upload exceeds the size cap.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "put-upload-bytes",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/v1/terms": {
      "get": {
        "tags": [
          "org"
        ],
        "summary": "Terms status",
        "operationId": "getTerms",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TermsStatus"
                },
                "example": {
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "current_version": "2026-09-01",
                  "data_use": "scoring_only",
                  "accepted_version": "2026-09-01",
                  "accepted_at": "2026-01-15T09:30:00Z",
                  "accepted_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "up_to_date": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "get-terms",
        "x-auth": "any",
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "org"
        ],
        "summary": "Accept the current terms and set the org's data-use choice",
        "description": "Owners only. Records who accepted which version, from where, and sets `org.data_use`. The default before any acceptance is `scoring_only`.",
        "operationId": "acceptTerms",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TermsAccept"
              },
              "example": {
                "terms_version": "2026-09-01"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TermsStatus"
                },
                "example": {
                  "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
                  "current_version": "2026-09-01",
                  "data_use": "scoring_only",
                  "accepted_version": "2026-09-01",
                  "accepted_at": "2026-01-15T09:30:00Z",
                  "accepted_by": "usr_b2c3d4e5f6g7h8i9j0k1",
                  "up_to_date": true
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated, invalid token or revoked key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden, session required or org required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Already exists, or stale version.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Quota or rate limit exceeded; `error.details` says which, and when.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Internal error; quote `error.request_id` when reporting it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "x-doc-page": "accept-terms",
        "x-auth": "owner",
        "security": [
          {
            "bearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ApiKey": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "key_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "examples": [
              "ci"
            ]
          },
          "prefix": {
            "type": "string",
            "title": "Prefix",
            "description": "`jean_live_` plus the first four random chars.",
            "examples": [
              "jean_live_exam"
            ]
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At",
            "examples": [
              null
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At",
            "description": "Set once revoked.",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "name",
          "prefix",
          "created_by",
          "created_at",
          "last_used_at",
          "revoked_at"
        ],
        "title": "ApiKey"
      },
      "ApiKeyCreate": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1,
            "title": "Name",
            "examples": [
              "ci"
            ]
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "ApiKeyCreate"
      },
      "ApiKeyCreated": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "key_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "name": {
            "type": "string",
            "title": "Name",
            "examples": [
              "ci"
            ]
          },
          "prefix": {
            "type": "string",
            "title": "Prefix",
            "description": "`jean_live_` plus the first four random chars.",
            "examples": [
              "jean_live_exam"
            ]
          },
          "created_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created By"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At",
            "examples": [
              null
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At",
            "description": "Set once revoked.",
            "examples": [
              null
            ]
          },
          "key": {
            "type": "string",
            "title": "Key",
            "description": "The full key. Shown once; never retrievable again.",
            "examples": [
              "jean_live_exampleexampleexampleexample0000"
            ]
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "name",
          "prefix",
          "created_by",
          "created_at",
          "last_used_at",
          "revoked_at",
          "key"
        ],
        "title": "ApiKeyCreated"
      },
      "ApiKeyList": {
        "properties": {
          "keys": {
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            },
            "type": "array",
            "title": "Keys"
          }
        },
        "type": "object",
        "required": [
          "keys"
        ],
        "title": "ApiKeyList"
      },
      "AuditEvent": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "examples": [
              1842
            ]
          },
          "org_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Org Id"
          },
          "actor_user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor User Id"
          },
          "actor_key_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor Key Id"
          },
          "action": {
            "type": "string",
            "title": "Action",
            "examples": [
              "key.create"
            ]
          },
          "target": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target",
            "examples": [
              "key_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Id"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Details",
            "examples": [
              {
                "name": "ci"
              }
            ]
          },
          "ts": {
            "type": "string",
            "format": "date-time",
            "title": "Ts"
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "actor_user_id",
          "actor_key_id",
          "action",
          "target",
          "request_id",
          "details",
          "ts"
        ],
        "title": "AuditEvent"
      },
      "AuditEventList": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            },
            "type": "array",
            "title": "Events"
          }
        },
        "type": "object",
        "required": [
          "events"
        ],
        "title": "AuditEventList"
      },
      "DomainClaim": {
        "properties": {
          "domain": {
            "type": "string",
            "maxLength": 253,
            "minLength": 3,
            "pattern": "^[a-z0-9.-]+\\.[a-z]{2,}$",
            "title": "Domain",
            "description": "Lower-case. Must be the domain of the caller's own verified email."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "domain"
        ],
        "title": "DomainClaim"
      },
      "EvalResult": {
        "properties": {
          "suite_id": {
            "type": "string",
            "title": "Suite Id",
            "examples": [
              "suite:smoke-v1"
            ]
          },
          "suite_version": {
            "type": "string",
            "title": "Suite Version",
            "examples": [
              "1"
            ]
          },
          "metric": {
            "type": "string",
            "title": "Metric",
            "examples": [
              "accuracy"
            ]
          },
          "value": {
            "type": "number",
            "title": "Value",
            "examples": [
              0.734
            ]
          },
          "n": {
            "type": "integer",
            "title": "N",
            "description": "Items scored (matched to the suite).",
            "examples": [
              200
            ]
          },
          "n_submitted": {
            "type": "integer",
            "title": "N Submitted",
            "examples": [
              200
            ]
          },
          "n_unmatched": {
            "type": "integer",
            "title": "N Unmatched",
            "examples": [
              0
            ]
          },
          "per_item": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PerItem"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Per Item",
            "description": "Per-item correctness, when the suite allows it. `null` on a held-out suite, which never returns anything item-level. Never a reference answer."
          },
          "hfm_sha": {
            "type": "string",
            "title": "Hfm Sha"
          }
        },
        "type": "object",
        "required": [
          "suite_id",
          "suite_version",
          "metric",
          "value",
          "n",
          "n_submitted",
          "n_unmatched",
          "hfm_sha"
        ],
        "title": "EvalResult"
      },
      "EvalSubmit": {
        "properties": {
          "suite_id": {
            "type": "string",
            "title": "Suite Id",
            "examples": [
              "suite:smoke-v1"
            ]
          },
          "predictions": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Prediction"
                },
                "type": "array",
                "minItems": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Predictions",
            "description": "Inline predictions. Capped at 5 MB of JSON."
          },
          "input_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Input Ref",
            "description": "An upload `ref` from POST /v1/uploads (kind `predictions`) instead of inline."
          },
          "label": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "suite_id"
        ],
        "title": "EvalSubmit",
        "example": {
          "label": "nightly",
          "predictions": [
            {
              "item_id": "item_4211",
              "prediction": [
                "item_88",
                "item_12",
                "item_5"
              ]
            },
            {
              "item_id": "item_4212",
              "prediction": [
                "item_31",
                "item_7",
                "item_99"
              ]
            }
          ],
          "suite_id": "suite:smoke-v1"
        }
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "Health": {
        "properties": {
          "status": {
            "type": "string",
            "const": "ok",
            "title": "Status",
            "default": "ok"
          },
          "git_sha": {
            "type": "string",
            "title": "Git Sha"
          },
          "hfm_sha": {
            "type": "string",
            "title": "Hfm Sha"
          },
          "env": {
            "type": "string",
            "title": "Env",
            "examples": [
              "prod"
            ]
          },
          "schema_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schema Version",
            "description": "The latest applied migration. Equal across environments."
          }
        },
        "type": "object",
        "required": [
          "git_sha",
          "hfm_sha",
          "env"
        ],
        "title": "Health"
      },
      "Invite": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "inv_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ],
            "title": "Role"
          },
          "invited_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invited By"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          },
          "accepted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted At",
            "examples": [
              null
            ]
          },
          "accepted_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted By",
            "examples": [
              null
            ]
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At",
            "examples": [
              null
            ]
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "email",
          "role",
          "invited_by",
          "created_at",
          "expires_at",
          "accepted_at",
          "accepted_by",
          "revoked_at"
        ],
        "title": "Invite"
      },
      "InviteCreate": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 254,
            "minLength": 3,
            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
            "title": "Email"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ],
            "title": "Role",
            "default": "member"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "email"
        ],
        "title": "InviteCreate"
      },
      "InviteList": {
        "properties": {
          "invites": {
            "items": {
              "$ref": "#/components/schemas/Invite"
            },
            "type": "array",
            "title": "Invites"
          }
        },
        "type": "object",
        "required": [
          "invites"
        ],
        "title": "InviteList"
      },
      "Job": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "job_q1w2e3r4t5y6u7i8o9p0"
            ]
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "type": {
            "type": "string",
            "enum": [
              "eval",
              "predict"
            ],
            "title": "Type"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ],
            "title": "Status"
          },
          "request_id": {
            "type": "string",
            "title": "Request Id"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "versions": {
            "$ref": "#/components/schemas/JobVersions"
          },
          "attempts": {
            "type": "integer",
            "title": "Attempts",
            "examples": [
              1
            ]
          },
          "error": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/JobError"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "finished_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EvalResult"
              },
              {
                "type": "null"
              }
            ],
            "description": "Present when succeeded."
          },
          "trace_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trace Url",
            "description": "Time-limited URL to trace.json once the job has run."
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "type",
          "status",
          "request_id",
          "versions",
          "attempts",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "title": "Job",
        "example": {
          "attempts": 1,
          "created_at": "2026-01-15T09:30:00Z",
          "finished_at": "2026-01-15T09:30:18Z",
          "id": "job_q1w2e3r4t5y6u7i8o9p0",
          "label": "nightly",
          "org_id": "org_k3j2h4g5f6d7s8a9q0w1",
          "request_id": "req_z9x8c7v6b5n4m3l2",
          "result": {
            "hfm_sha": "9f2c1ab4d7e0",
            "metric": "accuracy",
            "n": 200,
            "n_submitted": 200,
            "n_unmatched": 0,
            "suite_id": "suite:smoke-v1",
            "suite_version": "1",
            "value": 0.734
          },
          "started_at": "2026-01-15T09:30:02Z",
          "status": "succeeded",
          "trace_url": "https://storage.googleapis.com/jean-artifacts/.../trace.json",
          "type": "eval",
          "versions": {
            "hfm_sha": "9f2c1ab4d7e0",
            "suite_id": "suite:smoke-v1",
            "suite_version": "1"
          }
        }
      },
      "JobError": {
        "properties": {
          "code": {
            "type": "string",
            "title": "Code",
            "examples": [
              "scorer_failed"
            ]
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Details"
          }
        },
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "title": "JobError"
      },
      "JobList": {
        "properties": {
          "jobs": {
            "items": {
              "$ref": "#/components/schemas/Job"
            },
            "type": "array",
            "title": "Jobs"
          },
          "next_before": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Before",
            "description": "Pass as `before` to fetch the next page."
          }
        },
        "type": "object",
        "required": [
          "jobs"
        ],
        "title": "JobList"
      },
      "JobVersions": {
        "properties": {
          "hfm_sha": {
            "type": "string",
            "title": "Hfm Sha"
          },
          "suite_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suite Id",
            "examples": [
              "suite:smoke-v1"
            ]
          },
          "suite_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Suite Version",
            "examples": [
              "1"
            ]
          },
          "model_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Id"
          }
        },
        "type": "object",
        "required": [
          "hfm_sha"
        ],
        "title": "JobVersions"
      },
      "Me": {
        "properties": {
          "principal": {
            "type": "string",
            "enum": [
              "session",
              "key"
            ],
            "title": "Principal"
          },
          "org_id": {
            "type": "string",
            "title": "Org Id",
            "description": "The org this request resolved to."
          },
          "terms_up_to_date": {
            "type": "boolean",
            "title": "Terms Up To Date",
            "description": "False until an owner accepts the current terms version.",
            "default": false
          },
          "user": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UserSummary"
              },
              {
                "type": "null"
              }
            ],
            "description": "Present for session tokens."
          },
          "api_key_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Api Key Id",
            "description": "Present for API keys."
          },
          "orgs": {
            "items": {
              "$ref": "#/components/schemas/OrgSummary"
            },
            "type": "array",
            "title": "Orgs"
          }
        },
        "type": "object",
        "required": [
          "principal",
          "org_id",
          "orgs"
        ],
        "title": "Me"
      },
      "Member": {
        "properties": {
          "user_id": {
            "type": "string",
            "title": "User Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ],
            "title": "Role"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "user_id",
          "email",
          "role",
          "created_at"
        ],
        "title": "Member"
      },
      "MemberList": {
        "properties": {
          "members": {
            "items": {
              "$ref": "#/components/schemas/Member"
            },
            "type": "array",
            "title": "Members"
          }
        },
        "type": "object",
        "required": [
          "members"
        ],
        "title": "MemberList"
      },
      "MemberRoleUpdate": {
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ],
            "title": "Role"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "role"
        ],
        "title": "MemberRoleUpdate"
      },
      "OrgDomain": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "domain": {
            "type": "string",
            "title": "Domain"
          },
          "claimed_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Claimed By"
          },
          "verified_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verified At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "domain",
          "claimed_by",
          "verified_at",
          "created_at"
        ],
        "title": "OrgDomain"
      },
      "OrgDomainList": {
        "properties": {
          "domains": {
            "items": {
              "$ref": "#/components/schemas/OrgDomain"
            },
            "type": "array",
            "title": "Domains"
          }
        },
        "type": "object",
        "required": [
          "domains"
        ],
        "title": "OrgDomainList"
      },
      "OrgSummary": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "org_k3j2h4g5f6d7s8a9q0w1"
            ]
          },
          "name": {
            "type": "string",
            "title": "Name",
            "examples": [
              "Acme"
            ]
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "dev",
              "team"
            ],
            "title": "Plan"
          },
          "data_use": {
            "type": "string",
            "enum": [
              "scoring_only",
              "aggregate_ok",
              "training_ok"
            ],
            "title": "Data Use"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "member"
            ],
            "title": "Role"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "plan",
          "data_use",
          "role",
          "created_at"
        ],
        "title": "OrgSummary"
      },
      "PerItem": {
        "properties": {
          "item_id": {
            "type": "string",
            "title": "Item Id",
            "examples": [
              "item_4211"
            ]
          },
          "correct": {
            "type": "boolean",
            "title": "Correct"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "item_id",
          "correct"
        ],
        "title": "PerItem"
      },
      "Prediction": {
        "properties": {
          "item_id": {
            "type": "string",
            "maxLength": 256,
            "minLength": 1,
            "title": "Item Id"
          },
          "prediction": {
            "title": "Prediction"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "item_id",
          "prediction"
        ],
        "title": "Prediction"
      },
      "Suite": {
        "properties": {
          "suite_id": {
            "type": "string",
            "title": "Suite Id",
            "examples": [
              "suite:smoke-v1"
            ]
          },
          "version": {
            "type": "string",
            "title": "Version",
            "examples": [
              "1"
            ]
          },
          "metric": {
            "type": "string",
            "title": "Metric",
            "examples": [
              "accuracy"
            ]
          },
          "n_items": {
            "type": "integer",
            "title": "N Items",
            "examples": [
              200
            ]
          },
          "per_item_feedback": {
            "type": "boolean",
            "title": "Per Item Feedback"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "examples": [
              "A tiny suite for wiring up a client."
            ]
          },
          "hfm_sha": {
            "type": "string",
            "title": "Hfm Sha"
          }
        },
        "type": "object",
        "required": [
          "suite_id",
          "version",
          "metric",
          "n_items",
          "per_item_feedback",
          "description",
          "hfm_sha"
        ],
        "title": "Suite"
      },
      "SuiteList": {
        "properties": {
          "suites": {
            "items": {
              "$ref": "#/components/schemas/Suite"
            },
            "type": "array",
            "title": "Suites"
          }
        },
        "type": "object",
        "required": [
          "suites"
        ],
        "title": "SuiteList"
      },
      "TermsAccept": {
        "properties": {
          "terms_version": {
            "type": "string",
            "title": "Terms Version",
            "description": "Must equal `current_version` from GET /v1/terms.",
            "examples": [
              "2026-09-01"
            ]
          },
          "data_use": {
            "type": "string",
            "enum": [
              "scoring_only",
              "aggregate_ok",
              "training_ok"
            ],
            "title": "Data Use",
            "default": "scoring_only"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "terms_version"
        ],
        "title": "TermsAccept"
      },
      "TermsStatus": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "current_version": {
            "type": "string",
            "title": "Current Version",
            "examples": [
              "2026-09-01"
            ]
          },
          "data_use": {
            "type": "string",
            "enum": [
              "scoring_only",
              "aggregate_ok",
              "training_ok"
            ],
            "title": "Data Use"
          },
          "accepted_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted Version",
            "examples": [
              "2026-09-01"
            ]
          },
          "accepted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted At"
          },
          "accepted_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted By"
          },
          "up_to_date": {
            "type": "boolean",
            "title": "Up To Date"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "current_version",
          "data_use",
          "accepted_version",
          "accepted_at",
          "accepted_by",
          "up_to_date"
        ],
        "title": "TermsStatus"
      },
      "Upload": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "examples": [
              "upl_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "kind": {
            "type": "string",
            "enum": [
              "outputs",
              "panel",
              "predictions"
            ],
            "title": "Kind",
            "examples": [
              "predictions"
            ]
          },
          "content_type": {
            "type": "string",
            "title": "Content Type",
            "examples": [
              "application/json"
            ]
          },
          "size_bytes": {
            "type": "integer",
            "title": "Size Bytes",
            "examples": [
              2048
            ]
          },
          "ref": {
            "type": "string",
            "title": "Ref",
            "description": "Pass this as `input_ref` (or `panel_ref`) when submitting a job.",
            "examples": [
              "upload:upl_a1b2c3d4e5f6g7h8i9j0"
            ]
          },
          "put_url": {
            "type": "string",
            "title": "Put Url",
            "description": "PUT the bytes here, with exactly `content_type` and `size_bytes`.",
            "examples": [
              "https://storage.googleapis.com/jean-uploads/..."
            ]
          },
          "put_headers": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Put Headers",
            "description": "Headers the PUT must carry.",
            "examples": [
              {
                "Content-Type": "application/json"
              }
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "org_id",
          "kind",
          "content_type",
          "size_bytes",
          "ref",
          "put_url",
          "put_headers",
          "expires_at"
        ],
        "title": "Upload"
      },
      "UploadCreate": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "outputs",
              "panel",
              "predictions"
            ],
            "title": "Kind",
            "description": "`predictions` (JSON list for POST /v1/evals), `outputs` (JSONL), `panel` (CSV).",
            "examples": [
              "predictions"
            ]
          },
          "content_type": {
            "type": "string",
            "enum": [
              "application/json",
              "application/x-ndjson",
              "text/csv"
            ],
            "title": "Content Type",
            "default": "application/json"
          },
          "size_bytes": {
            "type": "integer",
            "maximum": 209715200,
            "exclusiveMinimum": 0,
            "title": "Size Bytes",
            "description": "Exact size you will PUT.",
            "examples": [
              2048
            ]
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "kind",
          "size_bytes"
        ],
        "title": "UploadCreate"
      },
      "Usage": {
        "properties": {
          "org_id": {
            "type": "string",
            "title": "Org Id"
          },
          "plan": {
            "type": "string",
            "title": "Plan",
            "examples": [
              "free"
            ]
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "title": "Period Start"
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "title": "Period End"
          },
          "totals": {
            "additionalProperties": {
              "type": "number"
            },
            "propertyNames": {
              "enum": [
                "requests",
                "eval_items",
                "predict_tokens",
                "gpu_seconds"
              ]
            },
            "type": "object",
            "title": "Totals",
            "description": "Sum of usage_event.quantity by metric for the period.",
            "examples": [
              {
                "eval_items": 18000,
                "requests": 412
              }
            ]
          },
          "active_jobs": {
            "type": "integer",
            "title": "Active Jobs",
            "examples": [
              1
            ]
          },
          "limits": {
            "$ref": "#/components/schemas/UsageLimits"
          }
        },
        "type": "object",
        "required": [
          "org_id",
          "plan",
          "period_start",
          "period_end",
          "totals",
          "active_jobs",
          "limits"
        ],
        "title": "Usage"
      },
      "UsageLimits": {
        "properties": {
          "concurrent_jobs": {
            "type": "integer",
            "title": "Concurrent Jobs",
            "examples": [
              2
            ]
          },
          "eval_items_per_month": {
            "type": "integer",
            "title": "Eval Items Per Month",
            "examples": [
              20000
            ]
          }
        },
        "type": "object",
        "required": [
          "concurrent_jobs",
          "eval_items_per_month"
        ],
        "title": "UsageLimits"
      },
      "UserSummary": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "email",
          "created_at"
        ],
        "title": "UserSummary"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "ErrorEnvelope": {
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorBody",
            "description": "The one error envelope every non-2xx response uses."
          }
        },
        "required": [
          "error"
        ],
        "title": "ErrorEnvelope",
        "type": "object",
        "example": {
          "error": {
            "code": "quota_exceeded",
            "message": "this org has used its eval items for the period",
            "request_id": "req_z9x8c7v6b5n4m3l2",
            "details": {
              "metric": "eval_items",
              "limit": 20000,
              "resets_at": "2026-01-15T09:30:00Z"
            }
          }
        }
      },
      "ErrorBody": {
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "request_id": {
            "title": "Request Id",
            "type": "string"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Details"
          }
        },
        "required": [
          "code",
          "message",
          "request_id"
        ],
        "title": "ErrorBody",
        "type": "object"
      },
      "ErrorCode": {
        "enum": [
          "invalid_request",
          "validation_failed",
          "payload_too_large",
          "unauthenticated",
          "invalid_token",
          "key_revoked",
          "forbidden",
          "session_required",
          "org_required",
          "not_found",
          "conflict",
          "invalid_state",
          "quota_exceeded",
          "rate_limited",
          "internal",
          "unavailable"
        ],
        "title": "ErrorCode",
        "type": "string"
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (`jean_live_...`) or a dashboard session token."
      }
    }
  },
  "tags": [
    {
      "name": "health",
      "description": "Liveness and build identity.",
      "x-label": "Health"
    },
    {
      "name": "me",
      "description": "Who am I and which orgs do I belong to.",
      "x-label": "Identity"
    },
    {
      "name": "keys",
      "description": "API key management. Session token only.",
      "x-label": "API keys"
    },
    {
      "name": "suites",
      "description": "Evaluation suites this org may submit to.",
      "x-label": "Suites"
    },
    {
      "name": "evals",
      "description": "Submit predictions for scoring. Returns a job.",
      "x-label": "Evals"
    },
    {
      "name": "jobs",
      "description": "Job status, results and traces.",
      "x-label": "Jobs"
    },
    {
      "name": "usage",
      "description": "Metered usage for the current period.",
      "x-label": "Usage"
    },
    {
      "name": "org",
      "description": "Members, invites, claimed domains and the audit log.",
      "x-label": "Organisation"
    },
    {
      "name": "uploads",
      "description": "Large inputs: reserve, PUT, reference from a job.",
      "x-label": "Uploads"
    }
  ],
  "servers": [
    {
      "url": "https://api-833252724876.us-central1.run.app",
      "description": "prod"
    }
  ],
  "x-error-codes": {
    "invalid_request": 400,
    "validation_failed": 422,
    "payload_too_large": 413,
    "unauthenticated": 401,
    "invalid_token": 401,
    "key_revoked": 401,
    "forbidden": 403,
    "session_required": 403,
    "org_required": 403,
    "not_found": 404,
    "conflict": 409,
    "invalid_state": 409,
    "quota_exceeded": 429,
    "rate_limited": 429,
    "internal": 500,
    "unavailable": 503
  }
}
