{"openapi":"3.1.0","info":{"title":"Earth Optimization API","version":"2026-07-14","description":"Earth Optimization Services' OAuth, MCP, task, document, collection, referral, voting, people, and organization endpoints for apps and websites that integrate with Optimitron.","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"}},"servers":[{"url":"https://warondisease.org"}],"tags":[{"name":"OAuth"},{"name":"MCP"},{"name":"Tasks"},{"name":"Documents"},{"name":"Collections"},{"name":"Content"},{"name":"Referrals"},{"name":"Referendums"},{"name":"People"},{"name":"Organizations"},{"name":"Profile"}],"paths":{"/.well-known/oauth-authorization-server":{"get":{"tags":["OAuth"],"summary":"OAuth authorization server metadata","responses":{"200":{"description":"OAuth metadata","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/.well-known/oauth-protected-resource/mcp":{"get":{"tags":["OAuth"],"summary":"Protected resource metadata for the MCP server","responses":{"200":{"description":"Protected resource metadata","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/mcp/oauth/register":{"post":{"tags":["OAuth"],"summary":"Register a public OAuth client","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthClientRegistration"}}}},"responses":{"201":{"description":"Registered client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthClient"}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"500":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/mcp/oauth/authorize":{"get":{"tags":["OAuth"],"summary":"Start the OAuth authorization code plus PKCE flow","parameters":[{"$ref":"#/components/parameters/client_id"},{"$ref":"#/components/parameters/redirect_uri"},{"$ref":"#/components/parameters/response_type"},{"$ref":"#/components/parameters/scope"},{"$ref":"#/components/parameters/state"},{"$ref":"#/components/parameters/code_challenge"},{"$ref":"#/components/parameters/code_challenge_method"}],"responses":{"302":{"description":"Redirects to the Optimitron consent page"},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/mcp/oauth/token":{"post":{"tags":["OAuth"],"summary":"Exchange an authorization code or refresh token","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/OAuthTokenRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenRequest"}}}},"responses":{"200":{"description":"Bearer token response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenResponse"}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/mcp/oauth/revoke":{"post":{"tags":["OAuth"],"summary":"Revoke a refresh token grant","requestBody":{"required":false,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Revocation is idempotent","content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean","const":false}},"required":["active"]}}}}}}},"/api/mcp/tools":{"get":{"tags":["MCP"],"summary":"List MCP tools and required scopes","responses":{"200":{"description":"Tool catalog","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/mcp":{"get":{"tags":["MCP"],"summary":"MCP Streamable HTTP endpoint","security":[{"OptimitronOAuth":[]}],"responses":{"200":{"description":"MCP stream response"},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["MCP"],"summary":"Call MCP JSON-RPC tools over Streamable HTTP","security":[{"OptimitronOAuth":[]}],"responses":{"200":{"description":"MCP stream response"},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["MCP"],"summary":"Close an MCP session","security":[{"OptimitronOAuth":[]}],"responses":{"200":{"description":"MCP stream response"},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tasks":{"get":{"tags":["Tasks"],"summary":"List public, accessible, or created tasks","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"name":"visibility","in":"query","schema":{"enum":["public","accessible","created"]}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"assigneePersonId","in":"query","schema":{"type":"string"}},{"name":"assigneeOrganizationId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Task list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Tasks"],"summary":"Create a task","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTaskRequest"}}}},"responses":{"201":{"description":"Created task","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Task"},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tasks/{id}":{"get":{"tags":["Tasks"],"summary":"Get task detail","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"responses":{"200":{"description":"Task detail","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"patch":{"tags":["Tasks"],"summary":"Update a task created by the authenticated user","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTaskRequest"}}}},"responses":{"200":{"description":"Updated task","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Task"},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"tags":["Tasks"],"summary":"Delete a task created by the authenticated user","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"responses":{"200":{"description":"Deleted task marker","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/tasks/{id}/claim":{"post":{"tags":["Tasks"],"summary":"Claim an available task","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"responses":{"200":{"description":"Task claim","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tasks/{id}/complete":{"post":{"tags":["Tasks"],"summary":"Complete a task claim","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"completionEvidence":{"type":"string"},"actualCashCostUsd":{"type":"number"},"actualEffortSeconds":{"type":"number"}}}}}},"responses":{"200":{"description":"Completed task claim","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tasks/{id}/comments":{"get":{"tags":["Tasks"],"summary":"Read task comments and activity","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"},{"name":"sort","in":"query","schema":{"enum":["new","top"]}},{"name":"cursor","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Comment feed","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Tasks"],"summary":"Post a task comment","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/taskId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","maxLength":20000},"parentCommentId":{"type":"string"},"mediaUrl":{"type":"string"}}}}}},"responses":{"200":{"description":"Created comment","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/documents":{"get":{"tags":["Documents"],"summary":"List documents the caller can view","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"name":"taskId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Authorized document list","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Documents"],"summary":"Create a private Markdown document","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocumentRequest"}}}},"responses":{"201":{"description":"Created document","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/documents/{id}":{"get":{"tags":["Documents"],"summary":"Get an authorized document revision","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/documentId"}],"responses":{"200":{"description":"Document and revision history","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Documents"],"summary":"Append a document revision with optimistic concurrency","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/documentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocumentRequest"}}}},"responses":{"200":{"description":"Updated document","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/collections":{"get":{"tags":["Collections"],"summary":"List collections the caller can view","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"description":"Authorized collection list","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Collections"],"summary":"Create a collection with stable fields","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCollectionRequest"}}}},"responses":{"201":{"description":"Created collection","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/collections/{id}":{"get":{"tags":["Collections"],"summary":"Get an authorized collection schema and saved views","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"}],"responses":{"200":{"description":"Collection schema and permission","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Collections"],"summary":"Update a collection with optimistic concurrency","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCollectionRequest"}}}},"responses":{"200":{"description":"Updated collection","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/collections/{id}/records":{"get":{"tags":["Collections"],"summary":"Filter, sort, and page through authorized records","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/limit"},{"name":"q","in":"query","schema":{"type":"string","maxLength":500}},{"name":"filters","in":"query","description":"JSON-encoded CollectionFilter array","schema":{"type":"string"}},{"name":"sorts","in":"query","description":"JSON-encoded CollectionSort array","schema":{"type":"string"}}],"responses":{"200":{"description":"Collection records","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Collections"],"summary":"Create an idempotent collection record","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"},{"$ref":"#/components/parameters/idempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCollectionRecordRequest"}}}},"responses":{"201":{"description":"Created record","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/collections/{id}/records/{recordId}":{"get":{"tags":["Collections"],"summary":"Get an authorized collection record","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"},{"$ref":"#/components/parameters/recordId"}],"responses":{"200":{"description":"Collection record","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Collections"],"summary":"Update a record with optimistic concurrency","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"},{"$ref":"#/components/parameters/recordId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCollectionRecordRequest"}}}},"responses":{"200":{"description":"Updated record","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/collections/{id}/records/batch":{"post":{"tags":["Collections"],"summary":"Atomically create or update collection records","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["operations"],"properties":{"operations":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/CollectionRecordBatchOperation"}}}}}}},"responses":{"200":{"description":"Applied record batch","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/collections/{id}/views":{"post":{"tags":["Collections"],"summary":"Create or update a saved table view","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/collectionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionViewRequest"}}}},"responses":{"200":{"description":"Saved collection view","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/content/search":{"get":{"tags":["Content"],"summary":"Search only documents and records the caller may view","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":500}},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"description":"Authorized search results","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/content/export":{"get":{"tags":["Content"],"summary":"Export an authorized document or collection page","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"name":"resourceType","in":"query","required":true,"schema":{"enum":["document","collection"]}},{"name":"resourceId","in":"query","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"description":"Authorized content export","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/content/access":{"get":{"tags":["Content"],"summary":"List direct grants for content the caller owns","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/resourceType"},{"$ref":"#/components/parameters/resourceId"}],"responses":{"200":{"description":"Content access grants","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Content"],"summary":"Grant content access to a user or organization","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentGrantRequest"}}}},"responses":{"200":{"description":"Updated content grant","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"tags":["Content"],"summary":"Revoke a direct content access grant","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentRevokeRequest"}}}},"responses":{"200":{"description":"Revoked content grant","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/content/attachments":{"get":{"tags":["Content"],"summary":"List authorized private files","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"name":"documentId","in":"query","schema":{"type":"string"}},{"name":"collectionRecordId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Private file metadata","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Content"],"summary":"Prepare an authorized private file upload","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContentAttachmentRequest"}}}},"responses":{"201":{"description":"Short-lived private upload URL","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/content/attachments/{attachmentId}":{"get":{"tags":["Content"],"summary":"Get a short-lived authorized private download URL","security":[{},{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/attachmentId"}],"responses":{"200":{"description":"Short-lived private download URL","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"tags":["Content"],"summary":"Delete an authorized private file","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/attachmentId"}],"responses":{"200":{"description":"Deleted private file","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/content/attachments/{attachmentId}/complete":{"post":{"tags":["Content"],"summary":"Verify and finish a private file upload","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/attachmentId"}],"responses":{"200":{"description":"Completed private file upload","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/content/imports/notion":{"post":{"tags":["Content"],"summary":"Dry-run or apply an idempotent Notion export bundle","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotionImportRequest"}}}},"responses":{"200":{"description":"Per-item import review","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/referral-invitations":{"get":{"tags":["Referrals"],"summary":"List the authenticated user's referral invitations","security":[{"OptimitronOAuth":["tasks:personal"]}],"responses":{"200":{"description":"Referral invitations","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Referrals"],"summary":"Create a referral invitation and optional task link","security":[{"OptimitronOAuth":["tasks:personal"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReferralInvitationRequest"}}}},"responses":{"201":{"description":"Created referral invitation","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"patch":{"tags":["Referrals"],"summary":"Update referral invitation status or send the message","security":[{"OptimitronOAuth":["tasks:personal"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReferralInvitationRequest"}}}},"responses":{"200":{"description":"Updated referral invitation","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/referendums/{slug}/vote":{"post":{"tags":["Referendums"],"summary":"Cast or update the authenticated user's referendum vote","security":[{"OptimitronOAuth":["earthdata:write"]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferendumVoteRequest"}}}},"responses":{"200":{"description":"Vote result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/profile":{"post":{"tags":["Profile"],"summary":"Save the authenticated user's profile snapshot","security":[{"OptimitronOAuth":["tasks:personal"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Saved profile","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/people/search":{"get":{"tags":["People"],"summary":"Search people the authenticated user may assign or edit","security":[{"OptimitronOAuth":["tasks:personal"]},{"OptimitronOAuth":["earthdata:write"]}],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}}],"responses":{"200":{"description":"People search results","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PersonSearchResult"}},"success":{"type":"boolean","const":true}},"required":["data","success"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/organizations":{"get":{"tags":["Organizations"],"summary":"Search approved organizations","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}}],"responses":{"200":{"description":"Organization search results","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationSummary"}}}}}}},"post":{"tags":["Organizations"],"summary":"Create an approved organization owned by the authenticated user","security":[{"OptimitronOAuth":["earthdata:write"]},{"OptimitronOAuth":["tasks:admin"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationRequest"}}}},"responses":{"201":{"description":"Created organization","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/organizations/{id}":{"get":{"tags":["Organizations"],"summary":"Get an organization managed by the authenticated user","security":[{"OptimitronOAuth":["earthdata:write"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/organizationId"}],"responses":{"200":{"description":"Organization detail","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"patch":{"tags":["Organizations"],"summary":"Update an organization managed by the authenticated user","security":[{"OptimitronOAuth":["earthdata:write"]},{"OptimitronOAuth":["tasks:admin"]}],"parameters":[{"$ref":"#/components/parameters/organizationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrganizationRequest"}}}},"responses":{"200":{"description":"Updated organization","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Missing, expired, or insufficient OAuth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Request failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}}},"components":{"securitySchemes":{"OptimitronOAuth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://warondisease.org/api/mcp/oauth/authorize","tokenUrl":"https://warondisease.org/api/mcp/oauth/token","refreshUrl":"https://warondisease.org/api/mcp/oauth/token","scopes":{"tasks:personal":"Manage your private tasks, dependencies, comments, queues, and next-action recommendations","tasks:organization":"Manage private tasks for organizations where you have permission","actions:approve":"Approve exact outbound-action payloads as an authenticated human","tasks:admin":"Admin-only: create and manage public Optimitron tasks, people, organizations, estimates, and dependencies","earthdata:write":"Create sourced public Earth-data records: memorials, evidence, intervention reports, organization signatories, and correction reports","earthdata:admin":"Admin-only: hide, restore, merge, and resolve Earth-data records and reports","agent:run":"Admin-only: run coordinated public-task agents with leases and run logs","github":"Admin-only: access the configured GitHub repos via the server-side PAT (search code, read files, list directories, generic API passthrough)"}}}}},"parameters":{"cursor":{"name":"cursor","in":"query","schema":{"type":"string"}},"limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500}},"idempotencyKey":{"name":"Idempotency-Key","in":"header","description":"Preferred idempotency key location. The JSON body may carry the same field.","schema":{"type":"string","minLength":1,"maxLength":500}},"resourceType":{"name":"resourceType","in":"query","required":true,"schema":{"enum":["document","collection"]}},"resourceId":{"name":"resourceId","in":"query","required":true,"schema":{"type":"string"}},"taskId":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"organizationId":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"documentId":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"collectionId":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"recordId":{"name":"recordId","in":"path","required":true,"schema":{"type":"string"}},"attachmentId":{"name":"attachmentId","in":"path","required":true,"schema":{"type":"string"}},"client_id":{"name":"client_id","in":"query","required":true,"schema":{"type":"string"}},"redirect_uri":{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","format":"uri"}},"response_type":{"name":"response_type","in":"query","required":true,"schema":{"type":"string","const":"code"}},"scope":{"name":"scope","in":"query","schema":{"type":"string"}},"state":{"name":"state","in":"query","schema":{"type":"string"}},"code_challenge":{"name":"code_challenge","in":"query","required":true,"schema":{"type":"string"}},"code_challenge_method":{"name":"code_challenge_method","in":"query","schema":{"type":"string","const":"S256"}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"ContentResource":{"type":"object","additionalProperties":false,"required":["type","id"],"properties":{"type":{"enum":["document","collection"]},"id":{"type":"string","minLength":1}}},"ContentGrantee":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type","id"],"properties":{"type":{"const":"user"},"id":{"type":"string","minLength":1}}},{"type":"object","additionalProperties":false,"required":["type","email"],"properties":{"type":{"const":"user"},"email":{"type":"string","format":"email"}}},{"type":"object","additionalProperties":false,"required":["type","id"],"properties":{"type":{"const":"organization"},"id":{"type":"string","minLength":1}}}]},"ContentGrantRequest":{"type":"object","additionalProperties":false,"required":["accessLevel","grantee","resource"],"properties":{"accessLevel":{"enum":["VIEW","COMMENT","EDIT_CONTENT","EDIT","FULL_ACCESS"]},"grantee":{"$ref":"#/components/schemas/ContentGrantee"},"resource":{"$ref":"#/components/schemas/ContentResource"}}},"ContentRevokeRequest":{"type":"object","additionalProperties":false,"required":["grantee","resource"],"properties":{"grantee":{"$ref":"#/components/schemas/ContentGrantee"},"resource":{"$ref":"#/components/schemas/ContentResource"}}},"CreateDocumentRequest":{"type":"object","required":["title"],"properties":{"title":{"type":"string","minLength":1,"maxLength":300},"body":{"type":"string","maxLength":500000},"visibility":{"enum":["PUBLIC","PRIVATE"]},"jurisdictionId":{"type":["string","null"]},"organizationId":{"type":["string","null"]},"parentDocumentId":{"type":["string","null"]},"taskId":{"type":["string","null"]},"idempotencyKey":{"type":["string","null"]}}},"UpdateDocumentRequest":{"type":"object","required":["expectedVersion"],"properties":{"expectedVersion":{"type":"integer","minimum":1},"title":{"type":"string","minLength":1,"maxLength":300},"body":{"type":"string","maxLength":500000},"visibility":{"enum":["PUBLIC","PRIVATE"]},"organizationId":{"type":["string","null"]},"parentDocumentId":{"type":["string","null"]},"taskId":{"type":["string","null"]}}},"CollectionField":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"optionsJson":{},"position":{"type":"integer","minimum":0},"required":{"type":"boolean"},"targetCollectionId":{"type":"string","nullable":true},"type":{"type":"string","enum":["TEXT","RICH_TEXT","NUMBER","BOOLEAN","DATE","SELECT","MULTI_SELECT","URL","EMAIL","FILE","RELATION","TASK","PERSON","ORGANIZATION","DOCUMENT","FORMULA","ROLLUP"]}},"required":["key","name","type"],"additionalProperties":false},"CollectionRelation":{"type":"object","properties":{"fieldKey":{"type":"string"},"position":{"type":"integer","minimum":0},"targetDocumentId":{"type":"string"},"targetOrganizationId":{"type":"string"},"targetPersonId":{"type":"string"},"targetRecordId":{"type":"string"},"targetTaskId":{"type":"string"}},"required":["fieldKey"],"additionalProperties":false},"CollectionFilter":{"type":"object","properties":{"fieldKey":{"type":"string"},"operator":{"type":"string","enum":["contains","equals","greaterThan","isEmpty","lessThan","notEquals"]},"value":{}},"required":["fieldKey","operator"],"additionalProperties":false},"CollectionSort":{"type":"object","properties":{"direction":{"type":"string","enum":["asc","desc"]},"fieldKey":{"type":"string"}},"required":["direction","fieldKey"],"additionalProperties":false},"CreateCollectionRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":["string","null"],"maxLength":20000},"fields":{"type":"array","maxItems":200,"items":{"$ref":"#/components/schemas/CollectionField"}},"visibility":{"enum":["PUBLIC","PRIVATE"]},"jurisdictionId":{"type":["string","null"]},"organizationId":{"type":["string","null"]},"idempotencyKey":{"type":["string","null"]}}},"UpdateCollectionRequest":{"type":"object","required":["expectedVersion"],"properties":{"expectedVersion":{"type":"integer","minimum":1},"name":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":20000},"fields":{"type":"array","maxItems":200,"items":{"$ref":"#/components/schemas/CollectionField"}},"visibility":{"enum":["PUBLIC","PRIVATE",null]},"organizationId":{"type":["string","null"]}}},"CreateCollectionRecordRequest":{"type":"object","required":["values"],"properties":{"values":{"type":"object","additionalProperties":true},"relations":{"type":"array","maxItems":2000,"items":{"$ref":"#/components/schemas/CollectionRelation"}},"documentId":{"type":["string","null"]},"organizationId":{"type":["string","null"]},"personId":{"type":["string","null"]},"taskId":{"type":["string","null"]},"idempotencyKey":{"type":["string","null"]}}},"UpdateCollectionRecordRequest":{"type":"object","required":["expectedVersion"],"properties":{"expectedVersion":{"type":"integer","minimum":1},"values":{"type":"object","additionalProperties":true},"relations":{"type":"array","maxItems":2000,"items":{"$ref":"#/components/schemas/CollectionRelation"}},"documentId":{"type":["string","null"]},"organizationId":{"type":["string","null"]},"personId":{"type":["string","null"]},"taskId":{"type":["string","null"]}}},"CollectionRecordBatchOperation":{"anyOf":[{"type":"object","properties":{"operation":{"type":"string","enum":["create"]},"idempotencyKey":{"type":"string","minLength":1,"maxLength":500},"values":{"type":"object","additionalProperties":{}},"documentId":{"type":"string","minLength":1,"nullable":true},"organizationId":{"type":"string","minLength":1,"nullable":true},"personId":{"type":"string","minLength":1,"nullable":true},"relations":{"type":"array","items":{"type":"object","properties":{"fieldKey":{"type":"string"},"position":{"type":"integer","minimum":0},"targetDocumentId":{"type":"string"},"targetOrganizationId":{"type":"string"},"targetPersonId":{"type":"string"},"targetRecordId":{"type":"string"},"targetTaskId":{"type":"string"}},"required":["fieldKey"],"additionalProperties":false},"maxItems":2000},"taskId":{"type":"string","minLength":1,"nullable":true}},"required":["operation","idempotencyKey","values"],"additionalProperties":false},{"type":"object","properties":{"operation":{"type":"string","enum":["update"]},"expectedVersion":{"type":"integer","exclusiveMinimum":true,"minimum":0},"recordId":{"type":"string","minLength":1},"values":{"type":"object","additionalProperties":{}},"documentId":{"type":"string","minLength":1,"nullable":true},"organizationId":{"type":"string","minLength":1,"nullable":true},"personId":{"type":"string","minLength":1,"nullable":true},"relations":{"type":"array","items":{"type":"object","properties":{"fieldKey":{"type":"string"},"position":{"type":"integer","minimum":0},"targetDocumentId":{"type":"string"},"targetOrganizationId":{"type":"string"},"targetPersonId":{"type":"string"},"targetRecordId":{"type":"string"},"targetTaskId":{"type":"string"}},"required":["fieldKey"],"additionalProperties":false},"maxItems":2000},"taskId":{"type":"string","minLength":1,"nullable":true}},"required":["operation","expectedVersion","recordId"],"additionalProperties":false}]},"CollectionViewRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"viewId":{"type":"string"},"expectedVersion":{"type":"integer","minimum":1},"isDefault":{"type":"boolean"},"filters":{"type":"array","items":{"$ref":"#/components/schemas/CollectionFilter"}},"sorts":{"type":"array","items":{"$ref":"#/components/schemas/CollectionSort"}},"visibleFieldIds":{"type":"array","items":{"type":"string"}}}},"CreateContentAttachmentRequest":{"type":"object","additionalProperties":false,"required":["checksumSha256","fileName","sizeBytes"],"properties":{"checksumSha256":{"type":"string","pattern":"^[A-Za-z0-9+/]{43}=$"},"collectionRecordId":{"type":["string","null"]},"documentId":{"type":["string","null"]},"contentType":{"type":"string","maxLength":160},"fileName":{"type":"string","minLength":1,"maxLength":512},"sizeBytes":{"type":"integer","minimum":1}}},"NotionImportBundle":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"base64":{"type":"string","minLength":1,"maxLength":34956632},"collectionRecordSourceId":{"type":"string","minLength":1,"nullable":true},"collectionSourceId":{"type":"string","minLength":1,"nullable":true},"contentType":{"type":"string","minLength":1},"documentSourceId":{"type":"string","minLength":1,"nullable":true},"fileName":{"type":"string","minLength":1}},"required":["sourceId","base64","contentType","fileName"],"additionalProperties":false},"maxItems":10000,"default":[]},"collections":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"description":{"type":"string","nullable":true},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"optionsJson":{},"position":{"type":"integer","minimum":0},"required":{"type":"boolean"},"targetCollectionId":{"type":"string","minLength":1,"nullable":true},"targetCollectionSourceId":{"type":"string","minLength":1,"nullable":true},"type":{"type":"string","enum":["TEXT","RICH_TEXT","NUMBER","BOOLEAN","DATE","SELECT","MULTI_SELECT","URL","EMAIL","FILE","RELATION","TASK","PERSON","ORGANIZATION","DOCUMENT","FORMULA","ROLLUP"]}},"required":["key","name","type"],"additionalProperties":false},"maxItems":200,"default":[]},"name":{"type":"string","minLength":1,"maxLength":200},"organizationId":{"type":"string","minLength":1,"nullable":true},"organizationSourceId":{"type":"string","minLength":1,"nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"documentId":{"type":"string","minLength":1,"nullable":true},"documentSourceId":{"type":"string","minLength":1,"nullable":true},"organizationId":{"type":"string","minLength":1,"nullable":true},"organizationSourceId":{"type":"string","minLength":1,"nullable":true},"personId":{"type":"string","minLength":1,"nullable":true},"personSourceId":{"type":"string","minLength":1,"nullable":true},"relations":{"type":"array","items":{"type":"object","properties":{"fieldKey":{"type":"string","minLength":1},"position":{"type":"integer","minimum":0},"targetCollectionSourceId":{"type":"string","minLength":1,"nullable":true},"targetDocumentId":{"type":"string","minLength":1,"nullable":true},"targetDocumentSourceId":{"type":"string","minLength":1,"nullable":true},"targetOrganizationId":{"type":"string","minLength":1,"nullable":true},"targetOrganizationSourceId":{"type":"string","minLength":1,"nullable":true},"targetPersonId":{"type":"string","minLength":1,"nullable":true},"targetPersonSourceId":{"type":"string","minLength":1,"nullable":true},"targetRecordId":{"type":"string","minLength":1,"nullable":true},"targetRecordSourceId":{"type":"string","minLength":1,"nullable":true},"targetTaskId":{"type":"string","minLength":1,"nullable":true},"targetTaskSourceId":{"type":"string","minLength":1,"nullable":true}},"required":["fieldKey"],"additionalProperties":false},"maxItems":2000,"default":[]},"taskId":{"type":"string","minLength":1,"nullable":true},"taskSourceId":{"type":"string","minLength":1,"nullable":true},"values":{"type":"object","additionalProperties":{},"default":{}}},"required":["sourceId"],"additionalProperties":false},"maxItems":20000,"default":[]},"views":{"type":"array","items":{"type":"object","properties":{"filters":{"type":"array","items":{"type":"object","properties":{"fieldKey":{"type":"string"},"operator":{"type":"string","enum":["contains","equals","greaterThan","isEmpty","lessThan","notEquals"]},"value":{}},"required":["fieldKey","operator"],"additionalProperties":false},"default":[]},"isDefault":{"type":"boolean","default":false},"name":{"type":"string","minLength":1,"maxLength":200},"sorts":{"type":"array","items":{"type":"object","properties":{"direction":{"type":"string","enum":["asc","desc"]},"fieldKey":{"type":"string"}},"required":["direction","fieldKey"],"additionalProperties":false},"default":[]},"visibleFieldKeys":{"type":"array","items":{"type":"string"},"default":[]}},"required":["name"],"additionalProperties":false},"maxItems":100,"default":[]},"visibility":{"type":"string","enum":["PUBLIC","PRIVATE"],"default":"PRIVATE"}},"required":["sourceId","name"],"additionalProperties":false},"maxItems":500,"default":[]},"documents":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"markdown":{"type":"string","minLength":1,"maxLength":500000},"organizationId":{"type":"string","minLength":1,"nullable":true},"organizationSourceId":{"type":"string","minLength":1,"nullable":true},"parentSourceId":{"type":"string","minLength":1,"nullable":true},"taskId":{"type":"string","minLength":1,"nullable":true},"taskSourceId":{"type":"string","minLength":1,"nullable":true},"title":{"type":"string","minLength":1,"maxLength":300},"visibility":{"type":"string","enum":["PUBLIC","PRIVATE"],"default":"PRIVATE"}},"required":["sourceId","markdown","title"],"additionalProperties":false},"maxItems":5000,"default":[]},"export":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"exportedAt":{"type":"string","format":"date-time","nullable":true},"title":{"type":"string","minLength":1,"maxLength":300,"default":"Notion export"}},"required":["sourceId"],"additionalProperties":false},"organizations":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"description":{"type":"string","nullable":true},"name":{"type":"string","minLength":1,"maxLength":300},"slug":{"type":"string","minLength":1,"maxLength":200,"nullable":true},"type":{"type":"string","enum":["UNIVERSITY","RESEARCH_CENTER","NONPROFIT","DAO","GOVERNMENT","GOVERNMENT_AGENCY","HOSPITAL","BIOTECH","COMPANY","FOUNDATION","INTERGOVERNMENTAL","MEDIA","POLITICAL_PARTY","ADVOCACY","OTHER"],"default":"OTHER"},"website":{"type":"string","format":"uri","nullable":true}},"required":["sourceId","name"],"additionalProperties":false},"maxItems":2000,"default":[]},"people":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"bio":{"type":"string","nullable":true},"displayName":{"type":"string","minLength":1,"maxLength":300},"email":{"type":"string","format":"email","nullable":true}},"required":["sourceId","displayName"],"additionalProperties":false},"maxItems":10000,"default":[]},"preservedArtifacts":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"artifactType":{"type":"string","enum":["MANUAL_SECTION","MANUAL_SNAPSHOT","OPG_POLICY_RECOMMENDATION","OPG_POLICY_REPORT","OBG_BUDGET_CATEGORY","OBG_BUDGET_REPORT","PARAMETER_SET","CALCULATION_SOURCE","CALCULATION_RUN","EXTERNAL_SOURCE","NOTION_PAGE","NOTION_DATABASE","NOTION_EXPORT","FILE_IMPORT"]},"title":{"type":"string","minLength":1,"maxLength":300,"nullable":true}},"required":["sourceId","artifactType"],"additionalProperties":false},"maxItems":10000,"default":[]},"tasks":{"type":"array","items":{"type":"object","properties":{"raw":{},"sourceId":{"type":"string","minLength":1,"maxLength":1000},"url":{"type":"string","format":"uri","nullable":true},"acceptanceCriteria":{"type":"array","items":{"type":"string"},"maxItems":100,"default":[]},"dependencySourceIds":{"type":"array","items":{"type":"string"},"maxItems":1000,"default":[]},"description":{"type":"string","nullable":true},"dueAt":{"type":"string","format":"date-time","nullable":true},"estimatedEffortHours":{"type":"number","minimum":0,"nullable":true},"parentSourceId":{"type":"string","minLength":1,"nullable":true},"title":{"type":"string","minLength":1,"maxLength":300}},"required":["sourceId","title"],"additionalProperties":false},"maxItems":10000,"default":[]},"workspaceId":{"type":"string","minLength":1,"maxLength":1000},"workspaceName":{"type":"string","minLength":1,"maxLength":300,"nullable":true}},"required":["workspaceId"],"additionalProperties":false},"NotionImportRequest":{"type":"object","additionalProperties":false,"required":["bundle"],"properties":{"dryRun":{"type":"boolean","default":true},"bundle":{"$ref":"#/components/schemas/NotionImportBundle"}}},"OAuthClientRegistration":{"type":"object","required":["redirect_uris"],"properties":{"client_name":{"type":"string"},"redirect_uris":{"type":"array","minItems":1,"items":{"type":"string","format":"uri"}},"grant_types":{"type":"array","items":{"enum":["authorization_code","refresh_token"]}},"scope":{"type":"string"},"client_uri":{"type":"string","format":"uri"}}},"OAuthClient":{"type":"object","properties":{"client_id":{"type":"string"},"client_name":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string","format":"uri"}},"grant_types":{"type":"array","items":{"type":"string"}},"scope":{"type":"string"},"client_uri":{"type":"string","format":"uri"},"client_id_issued_at":{"type":"integer"}},"required":["client_id","redirect_uris","grant_types"]},"OAuthTokenRequest":{"oneOf":[{"type":"object","properties":{"grant_type":{"const":"authorization_code"},"code":{"type":"string"},"client_id":{"type":"string"},"redirect_uri":{"type":"string","format":"uri"},"code_verifier":{"type":"string"}},"required":["grant_type","code","client_id","redirect_uri","code_verifier"]},{"type":"object","properties":{"grant_type":{"const":"refresh_token"},"client_id":{"type":"string"},"refresh_token":{"type":"string"}},"required":["grant_type","client_id","refresh_token"]}]},"OAuthTokenResponse":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","const":"Bearer"},"expires_in":{"type":"integer"},"refresh_token":{"type":"string"},"scope":{"type":"string"}},"required":["access_token","token_type","expires_in","scope"]},"Task":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string"},"isPublic":{"type":"boolean"},"createdByUserId":{"type":["string","null"]},"assigneePersonId":{"type":["string","null"]},"assigneeOrganizationId":{"type":["string","null"]}}},"CreateTaskRequest":{"type":"object","required":["title"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"isPublic":{"type":"boolean"},"status":{"type":"string"},"category":{"type":"string"},"dueAt":{"type":"string","format":"date-time"},"estimatedEffortHours":{"type":"number"},"assigneePersonId":{"type":"string"},"assigneePersonIdentifier":{"type":"string"},"assigneeOrganizationId":{"type":"string"},"assigneePersonInvite":{"type":"object","required":["email","firstName","lastName"],"properties":{"email":{"type":"string","format":"email"},"firstName":{"type":"string"},"lastName":{"type":"string"},"currentAffiliation":{"type":"string"}}},"parentTaskId":{"type":"string"},"contactUrl":{"type":"string"},"contactLabel":{"type":"string"},"contactTemplate":{"type":"string"}}},"UpdateTaskRequest":{"type":"object","minProperties":1,"properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string"},"dueAt":{"type":["string","null"],"format":"date-time"},"estimatedEffortHours":{"type":["number","null"]},"isPublic":{"type":"boolean"},"primaryEndpoint":{"type":"object","properties":{"label":{"type":"string"},"url":{"type":"string"},"email":{"type":"string","format":"email"},"instructions":{"type":"string"}}}}},"CreateReferralInvitationRequest":{"type":"object","required":["recipientName"],"properties":{"recipientName":{"type":"string","maxLength":160},"recipientEmail":{"type":"string","format":"email"},"contactMethod":{"type":"string"},"messageFormat":{"type":"string"},"messageText":{"type":"string","maxLength":10000},"referendumSlug":{"type":"string"},"taskId":{"type":"string"},"shareAttemptId":{"type":"string"},"originUrl":{"type":"string","maxLength":2048}}},"UpdateReferralInvitationRequest":{"type":"object","required":["id","action"],"properties":{"id":{"type":"string"},"action":{"enum":["markCopied","markManualContacted","decline","cancel","sendMessage"]},"messageText":{"type":"string"},"shareChannel":{"type":"string"},"shareAttemptId":{"type":"string"},"wasEdited":{"type":"boolean"}}},"ReferendumVoteRequest":{"type":"object","required":["answer"],"properties":{"answer":{"enum":["YES","NO","ABSTAIN"]},"displayName":{"type":"string"},"ref":{"type":"string"},"makePublic":{"type":"boolean"},"inviteToken":{"type":"string"},"organizationSlug":{"type":"string"},"originUrl":{"type":"string"}}},"PersonSearchResult":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"handle":{"type":["string","null"]},"headline":{"type":["string","null"]},"affiliation":{"type":["string","null"]},"href":{"type":"string"},"image":{"type":["string","null"]},"isPublicFigure":{"type":"boolean"}}},"OrganizationSummary":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"}}},"CreateOrganizationRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"type":{"type":"string"},"website":{"type":"string"},"description":{"type":"string"},"jurisdictionId":{"type":"string"}}},"UpdateOrganizationRequest":{"type":"object","properties":{"name":{"type":"string"},"website":{"type":["string","null"]},"description":{"type":["string","null"]},"donationUrl":{"type":["string","null"]},"squareLogoUrl":{"type":["string","null"]},"wordmarkLogoUrl":{"type":["string","null"]},"contactEmail":{"type":["string","null"],"format":"email"}}}}}}