{"components":{"headers":{"RateLimitCapacity":{"description":"Maximum number of tokens the client's bucket holds. Present when the request is metered.","example":60,"schema":{"minimum":1,"type":"integer"}},"RateLimitRemaining":{"description":"Whole tokens immediately available after admission or denial. Present when the request is metered.","example":59,"schema":{"minimum":0,"type":"integer"}},"RateLimitReset":{"description":"Full-bucket refill time in Unix seconds, rounded up, assuming no more traffic. Present when the request is metered.","example":1800000001,"schema":{"format":"int64","type":"integer"}}},"parameters":{"after":{"description":"Opaque cursor for pagination (obtained from previous response's `next_cursor`).\nCursors are base64url-encoded strings - treat as opaque, do not parse or modify.\n`cursor` is accepted as an alias for `after` (with a `warnings` entry noting\nthe canonical name). The MCP `events`/`places`/`organizations` tools expose this\nvalue as `cursor`, so REST callers can pass the MCP parameter name directly.\nExample: `MTcwNjg4NjAwMDAwMDAwMDAwMDowMUhZWDNLUVc3RVJUV jlYTkJNMlA4UUpaRg`\n","in":"query","name":"after","schema":{"example":"MTcwNjg4NjAwMDAwMDAwMDAwMDowMUhZWDNLUVc3RVJUV jlYTkJNMlA4UUpaRg","type":"string"}},"city":{"description":"Filter by city/locality.","in":"query","name":"city","schema":{"type":"string"}},"context":{"description":"JSON-LD @context emission mode for the list response.\n\n- `item` (default): each item in `items` carries its own `@context` block,\n  so consumers can slice individual items out of the array and still\n  interpret them as standalone JSON-LD.\n- `document`: a single `@context` is emitted once at the top level of the\n  document, scoping every member in `items`. This omits the per-item\n  `@context` blocks and roughly halves collection response size — useful\n  for clients with fixed output budgets (e.g. MCP/agent tool results).\n  To reconstruct standalone JSON-LD items, combine the document-level\n  `@context` with any sliced item.\n","in":"query","name":"context","schema":{"default":"item","enum":["document","item"],"type":"string"}},"countrycodes":{"description":"Comma-separated ISO 3166-1 alpha-2 country codes used when geocoding\n`near_place`. Defaults to the server's configured country list.\n","example":"ca","in":"query","name":"countrycodes","schema":{"type":"string"}},"endDate":{"description":"Filter events starting on or before this date (ISO8601, e.g. 2026-06-30). Inclusive of the entire endDate day: events starting any time on that day (up to 23:59:59 in the server timezone, configurable via DEFAULT_TIMEZONE, default America/Toronto) are included. To restrict to a single day, pass the same value for both startDate and endDate. Snake_case alias end_date is accepted but triggers a warnings entry in the response.\n","in":"query","name":"endDate","schema":{"format":"date","type":"string"}},"eventDomain":{"description":"Filter by event domain","in":"query","name":"domain","schema":{"enum":["arts","music","culture","sports","community","education","general"],"type":"string"}},"eventId":{"description":"Event ULID","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"eventNearLat":{"description":"Latitude (WGS84) for event proximity filtering. Requires `near_lon`;\nzero is valid. Must be finite and within [-90, 90].\n","in":"query","name":"near_lat","schema":{"format":"double","maximum":90,"minimum":-90,"type":"number"}},"eventNearLon":{"description":"Longitude (WGS84) for event proximity filtering. Requires `near_lat`;\nzero is valid. Must be finite and within [-180, 180].\n","in":"query","name":"near_lon","schema":{"format":"double","maximum":180,"minimum":-180,"type":"number"}},"eventRadius":{"description":"Event proximity radius in kilometres. Requires both `near_lat` and\n`near_lon`. Must be finite and positive. Defaults to\n`EVENTS_DEFAULT_RADIUS_KM` (10); the configured maximum is\n`EVENTS_MAX_RADIUS_KM` (100). These event-specific defaults and limits\ndo not change the places endpoint's radius settings.\n","in":"query","name":"radius","schema":{"exclusiveMinimum":0,"format":"double","type":"number"}},"keywords":{"description":"Filter by keywords (comma-separated)","in":"query","name":"keywords","schema":{"type":"string"}},"lifecycleState":{"description":"Filter by lifecycle state. `draft` is accepted but intersects the public\nallowlist on public endpoints, so `state=draft` returns an empty result.\n`pending_review` and `deleted` are not accepted values (400). On admin\nendpoints the filter is unfiltered by the public allowlist (soft-deleted\nrows are still never listed).\n","in":"query","name":"state","schema":{"enum":["draft","published","postponed","rescheduled","sold_out","cancelled","completed"],"type":"string"}},"limit":{"description":"Maximum results per page (default 50, max 200)","in":"query","name":"limit","schema":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"localityCity":{"description":"Filter by city/addressLocality.","in":"query","name":"city","schema":{"type":"string"}},"nearLat":{"description":"Latitude for proximity search. Requires `near_lon`.","in":"query","name":"near_lat","schema":{"format":"double","maximum":90,"minimum":-90,"type":"number"}},"nearLon":{"description":"Longitude for proximity search. Requires `near_lat`.","in":"query","name":"near_lon","schema":{"format":"double","maximum":180,"minimum":-180,"type":"number"}},"nearPlace":{"description":"Place name to geocode and use as the centre of a proximity search.\nMutually exclusive with `near_lat`/`near_lon`.\n","in":"query","name":"near_place","schema":{"type":"string"}},"nodeId":{"description":"Federation node UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}},"order":{"description":"Sort direction for place and organization lists.","in":"query","name":"order","schema":{"default":"asc","enum":["asc","desc"],"type":"string"}},"organizationId":{"description":"Organization ULID","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"organizerId":{"description":"Filter by organizer ULID. Snake_case alias organizer_id is accepted but triggers a warnings entry in the response.\n","in":"query","name":"organizerId","schema":{"type":"string"}},"placeId":{"description":"Place ULID","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"query":{"description":"Matches all search terms as whole words in any order across the event\nname and description. English stemming matches forms such as `knit`\nand `knitting`. Common stop words such as `the` are ignored. A nonblank\nquery with no searchable terms returns an empty result. `search` is an\nalias for `q`. The PostgreSQL statement timeout for text searches is\nconfigurable via `EVENTS_SEARCH_TIMEOUT_MS` (default 5000 milliseconds).\n","in":"query","name":"q","schema":{"type":"string"}},"radius":{"description":"Proximity search radius in kilometres (maximum 100). Requires\n`near_place` or `near_lat` + `near_lon`. Defaults to 10 km.\n","in":"query","name":"radius","schema":{"default":10,"exclusiveMinimum":0,"format":"double","maximum":100,"type":"number"}},"region":{"description":"Filter by region/state.","in":"query","name":"region","schema":{"type":"string"}},"sort":{"description":"Sort field for place and organization lists.","in":"query","name":"sort","schema":{"default":"created_at","enum":["name","created_at"],"type":"string"}},"startDate":{"description":"Filter events starting on or after this date (ISO8601, e.g. 2026-06-01). Defaults to today when neither startDate nor endDate is provided, so past events are excluded by default. \"Today\" is midnight in the server timezone (configurable via DEFAULT_TIMEZONE, default America/Toronto). Pass an explicit startDate to override. Snake_case alias start_date is accepted but triggers a warnings entry in the response.\n","in":"query","name":"startDate","schema":{"format":"date","type":"string"}},"userId":{"description":"Admin user UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}},"venueId":{"description":"Filter by venue ULID. Snake_case alias venue_id is accepted but triggers a warnings entry in the response.\n","in":"query","name":"venueId","schema":{"type":"string"}}},"responses":{"BadRequest":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid request"},"EventSearchTimeout":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event text search exceeded the PostgreSQL statement timeout."},"Forbidden":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Insufficient permissions"},"Gone":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Tombstone"}}},"description":"Resource deleted"},"NotFound":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Resource not found"},"RateLimited":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"The client's token bucket is empty","headers":{"Retry-After":{"description":"Minimum whole seconds to wait for the next token, assuming no competing requests.","example":1,"schema":{"minimum":1,"type":"integer"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"ServiceUnavailable":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Transient database contention — retry after a brief delay","headers":{"Retry-After":{"description":"Seconds to wait before retrying","example":1,"schema":{"type":"integer"}}}},"URLSubmissionRateLimited":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"The token bucket or the separate daily URL submission quota has been exhausted.","headers":{"Retry-After":{"description":"Seconds to wait before retrying. The separate daily quota returns 86400.","schema":{"minimum":1,"type":"integer"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"Unauthorized":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Authentication required"}},"schemas":{"APIKeyUsage":{"description":"Detailed usage statistics for an API key over a date range","properties":{"api_key_id":{"description":"API key UUID","format":"uuid","type":"string"},"api_key_name":{"description":"API key name","type":"string"},"daily":{"description":"Daily breakdown of usage statistics","items":{"properties":{"date":{"format":"date","type":"string"},"error_count":{"example":3,"type":"integer"},"request_count":{"example":1523,"type":"integer"}},"required":["date","request_count","error_count"],"type":"object"},"type":"array"},"period":{"properties":{"from":{"description":"Start date of usage period","format":"date","type":"string"},"to":{"description":"End date of usage period","format":"date","type":"string"}},"required":["from","to"],"type":"object"},"total_errors":{"description":"Total number of errors (4xx/5xx) in the period","example":142,"type":"integer"},"total_requests":{"description":"Total number of requests in the period","example":34210,"type":"integer"}},"required":["api_key_id","api_key_name","period","total_requests","total_errors","daily"],"type":"object"},"AcceptInvitationResponse":{"properties":{"message":{"type":"string"},"user":{"properties":{"email":{"format":"email","type":"string"},"id":{"format":"uuid","type":"string"},"role":{"enum":["admin","editor","viewer"],"type":"string"},"username":{"type":"string"}},"required":["id","username","email","role"],"type":"object"}},"required":["message","user"],"type":"object"},"AddressComponents":{"properties":{"city":{"type":"string"},"postcode":{"type":"string"},"road":{"type":"string"},"state":{"type":"string"},"suburb":{"type":"string"}},"type":"object"},"AdminEventListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminEventSummary"},"type":"array"},"next_cursor":{"type":"string"}},"required":["items"],"type":"object"},"AdminEventResponse":{"allOf":[{"$ref":"#/components/schemas/Event"},{"properties":{"lifecycle_state":{"enum":["draft","published","postponed","rescheduled","sold_out","cancelled","completed"],"type":"string"}},"type":"object"}]},"AdminEventSummary":{"allOf":[{"$ref":"#/components/schemas/EventSummary"},{"properties":{"all_day":{"type":"boolean"},"confidence":{"format":"double","type":["number","null"]},"description":{"type":"string"},"lifecycle_state":{"type":"string"},"start_date":{"format":"date-time","type":"string"}},"type":"object"}]},"AdminOrganizationResponse":{"properties":{"address_country":{"type":"string"},"address_locality":{"type":"string"},"address_region":{"type":"string"},"created_at":{"format":"date-time","type":"string"},"description":{"type":"string"},"email":{"format":"email","type":"string"},"lifecycle":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"street_address":{"type":"string"},"telephone":{"type":"string"},"ulid":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"},"updated_at":{"format":"date-time","type":"string"},"url":{"format":"uri","type":"string"}},"required":["ulid","name","created_at","updated_at"],"type":"object"},"AdminOrganizationUpdate":{"properties":{"address_country":{"type":"string"},"address_locality":{"type":"string"},"address_region":{"type":"string"},"description":{"type":"string"},"email":{"format":"email","type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"street_address":{"type":"string"},"telephone":{"type":"string"},"url":{"format":"uri","type":"string"}},"type":"object"},"AdminPlaceResponse":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"format":"date-time","type":"string"},"description":{"type":"string"},"email":{"format":"email","type":"string"},"latitude":{"format":"double","type":["number","null"]},"lifecycle":{"type":"string"},"longitude":{"format":"double","type":["number","null"]},"name":{"type":"string"},"postal_code":{"type":"string"},"region":{"type":"string"},"street_address":{"type":"string"},"telephone":{"type":"string"},"ulid":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"},"updated_at":{"format":"date-time","type":"string"},"url":{"format":"uri","type":"string"}},"required":["ulid","name","created_at","updated_at"],"type":"object"},"AdminPlaceUpdate":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"description":{"type":"string"},"email":{"format":"email","type":"string"},"latitude":{"format":"double","type":"number"},"longitude":{"format":"double","type":"number"},"name":{"type":"string"},"postal_code":{"type":"string"},"region":{"type":"string"},"street_address":{"type":"string"},"telephone":{"type":"string"},"url":{"format":"uri","type":"string"}},"type":"object"},"AdminUserListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminUserResponse"},"type":"array"},"next_cursor":{"type":["string","null"]},"total":{"format":"int64","type":"integer"}},"required":["items","total"],"type":"object"},"AdminUserResponse":{"description":"Admin user representation returned by user management endpoints.","properties":{"created_at":{"description":"When the user account was created","format":"date-time","type":"string"},"email":{"description":"User's email address","format":"email","type":"string"},"id":{"description":"User's unique identifier","format":"uuid","type":"string"},"is_active":{"description":"Whether the user account is active","type":"boolean"},"last_login_at":{"description":"When the user last logged in, or null if never","format":"date-time","type":["string","null"]},"role":{"description":"User's role","enum":["admin","editor","viewer"],"type":"string"},"status":{"description":"Derived user status. active: account is active; pending: account created but invitation not yet accepted (no password set); inactive: account was active but has been deactivated","enum":["active","inactive","pending"],"type":"string"},"username":{"description":"User's login username","type":"string"}},"required":["id","username","email","role","is_active","status","created_at"],"type":"object"},"AllDiagnostics":{"description":"Cross-source diagnostics with filtered recent runs","properties":{"items":{"items":{"$ref":"#/components/schemas/ScraperRunDetail"},"type":"array"},"total":{"description":"Total number of runs returned","type":"integer"}},"type":"object"},"ApiCatalog":{"properties":{"linkset":{"items":{"properties":{"anchor":{"format":"uri-reference","type":"string"},"item":{"items":{"$ref":"#/components/schemas/ApiCatalogLink"},"type":"array"},"service-desc":{"items":{"$ref":"#/components/schemas/ApiCatalogLink"},"type":"array"},"service-doc":{"items":{"$ref":"#/components/schemas/ApiCatalogLink"},"type":"array"}},"required":["anchor"],"type":"object"},"type":"array"}},"required":["linkset"],"type":"object"},"ApiCatalogLink":{"properties":{"href":{"format":"uri-reference","type":"string"},"type":{"type":"string"}},"required":["href"],"type":"object"},"ApiKeyCreated":{"description":"Response when creating a new API key, includes the secret (shown only once).","properties":{"api_key":{"description":"Full API key (shown only once).","type":"string"},"expires_at":{"format":"date-time","type":["string","null"]},"federation_node_id":{"description":"Canonical UUID of the federation node the key was bound to, or\n`null`/absent for an unbound key.\n","format":"uuid","type":["string","null"]},"name":{"type":"string"},"prefix":{"description":"First 8 chars of the key.","type":"string"},"role":{"type":"string"},"warning":{"description":"Security warning instructing the caller to save the key now.","type":"string"}},"required":["api_key","prefix","name","role","warning"],"type":"object"},"ApiKeyInfo":{"description":"API key metadata (without secret), as returned by GET /api/v1/admin/api-keys.","properties":{"created_at":{"format":"date-time","type":"string"},"expires_at":{"format":"date-time","type":["string","null"]},"federation_node_id":{"description":"Federation node this key is bound to, or `null` for an unbound key.\nUnbound keys are rejected by `POST /api/v1/federation/sync`.\n","format":"uuid","type":["string","null"]},"id":{"format":"uuid","type":"string"},"is_active":{"type":"boolean"},"last_used_at":{"format":"date-time","type":["string","null"]},"name":{"type":"string"},"prefix":{"description":"First 8 chars of the key.","type":"string"},"rate_limit_tier":{"type":"string"},"role":{"type":"string"},"source_id":{"description":"Source this key is associated with, if any.","format":"uuid","type":["string","null"]}},"type":"object"},"BackfillResponse":{"properties":{"estimated_duration":{"type":"string"},"events_enqueued":{"type":"integer"},"places_enqueued":{"type":"integer"}},"required":["places_enqueued","events_enqueued","estimated_duration"],"type":"object"},"ChangeDetail":{"description":"Record of a single field change made during event normalization","properties":{"corrected":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"},{"type":"array"},{"type":"null"}],"description":"Corrected value after normalization (can be any type)","example":"2026-03-16T22:00:00Z"},"field":{"description":"Field that was changed (e.g., \"endDate\")","type":"string"},"original":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"},{"type":"array"},{"type":"null"}],"description":"Original value before normalization (can be any type)","example":"2026-03-15T22:00:00Z"},"reason":{"description":"Explanation of why the change was made","type":"string"}},"required":["field","original","corrected","reason"],"type":"object"},"ChangeEntry":{"description":"A change to an event in the federation feed.","properties":{"action":{"enum":["create","update","delete"],"type":"string"},"changed_at":{"description":"When the change was recorded.","format":"date-time","type":"string"},"changed_fields":{"description":"Advisory change metadata. Creates carry an empty object, updates\ncarry an array of field names, and deletes carry tombstone metadata.\n","oneOf":[{"additionalProperties":true,"type":"object"},{"items":{"type":"string"},"type":"array"}]},"event_id":{"description":"Internal identifier of the event.","format":"uuid","type":"string"},"event_ulid":{"description":"Event ULID used to construct the event URI on this node.","type":"string"},"federation_uri":{"description":"Origin URI for an event minted on another node.","format":"uri","type":"string"},"id":{"description":"Stable identifier of the change row.","format":"uuid","type":"string"},"license_status":{"description":"Event license status. May be empty.","type":"string"},"license_url":{"description":"Event license URL. May be empty.","type":"string"},"received_timestamp":{"description":"Creation timestamp of the event row on this node.","format":"date-time","type":"string"},"sequence_number":{"description":"Increasing per-node sequence number used to order changes.","format":"int64","type":"integer"},"snapshot":{"additionalProperties":true,"description":"JSON-LD event projection or tombstone, when requested and available.","type":"object"},"source_timestamp":{"description":"Latest source retrieval timestamp, or the zero time when unknown.","format":"date-time","type":"string"}},"required":["id","event_id","event_ulid","action","changed_at","sequence_number","license_url","license_status","source_timestamp","received_timestamp"],"type":"object"},"ChangeFeedResponse":{"description":"Federation change feed containing sequential updates for event synchronization.","properties":{"changes":{"items":{"$ref":"#/components/schemas/ChangeEntry"},"type":"array"},"cursor":{"description":"Opaque cursor for the starting sequence position of this page.","type":"string"},"has_more":{"description":"Whether another page is available for the same filters.","type":"boolean"},"next_cursor":{"description":"Opaque cursor for the next page. Empty on the final page.","type":"string"}},"required":["cursor","changes","next_cursor","has_more"],"type":"object"},"ConflictItem":{"description":"One unordered pair of entities sharing an identifier","properties":{"authority":{"type":"string"},"candidate":{"$ref":"#/components/schemas/IdentityRef"},"prior_decision":{"$ref":"#/components/schemas/DecisionRecord"},"ref":{"$ref":"#/components/schemas/IdentityRef"},"score":{"type":"number"},"suppressed":{"type":"boolean"},"uri":{"type":"string"}},"type":"object"},"ConflictsResponse":{"description":"Paginated identity conflicts feed","properties":{"items":{"items":{"$ref":"#/components/schemas/ConflictItem"},"type":"array"},"next_cursor":{"type":["string","null"]}},"required":["items"],"type":"object"},"ConsolidateResponse":{"description":"Result of an atomic event consolidation operation","properties":{"event":{"$ref":"#/components/schemas/Event","description":"The canonical event after consolidation"},"is_duplicate":{"description":"True if the canonical event was flagged as a near-duplicate of another non-retired event during post-consolidation validation.\n","type":"boolean"},"is_merged":{"description":"Always false for consolidation (admin intent is preserved, never auto-merged).\n","type":"boolean"},"lifecycle_state":{"description":"Lifecycle state of the canonical event after consolidation","enum":["published","pending_review","draft"],"type":"string"},"needs_review":{"description":"True if the canonical event was sent to the review queue due to duplicate detection or quality issues found during post-consolidation validation.\n","type":"boolean"},"retired":{"description":"ULIDs of events that were successfully retired (soft-deleted)","items":{"type":"string"},"type":"array"},"review_entries_dismissed":{"description":"IDs of review queue entries that were dismissed for retired events","items":{"type":"integer"},"type":"array"},"warnings":{"description":"Validation warnings from post-consolidation checks","items":{"$ref":"#/components/schemas/ValidationWarning"},"type":"array"}},"type":"object"},"DecisionRecord":{"description":"One identity_decisions ledger row","properties":{"action":{"enum":["link","reject"],"type":"string"},"actor":{"type":"string"},"citations":{"items":{"type":"string"},"type":"array"},"confidence":{"type":"number"},"counterpart_id":{"type":"string"},"counterpart_type":{"enum":["place","organization"],"type":"string"},"created_at":{"format":"date-time","type":"string"},"entity_id":{"type":"string"},"entity_type":{"enum":["place","organization"],"type":"string"},"id":{"type":"string"},"metadata":{"additionalProperties":true,"type":"object"},"rationale":{"type":"string"},"reversible":{"type":"boolean"},"undo_ref":{"type":"string"}},"required":["id","created_at","entity_type","entity_id","action","rationale","citations","confidence","actor","reversible"],"type":"object"},"DecisionsResponse":{"description":"Paginated identity decisions feed","properties":{"items":{"items":{"$ref":"#/components/schemas/DecisionRecord"},"type":"array"},"next_cursor":{"type":["string","null"]}},"required":["items"],"type":"object"},"Developer":{"description":"Developer account with API key management capabilities","properties":{"created_at":{"description":"When the developer account was created","format":"date-time","type":"string"},"email":{"description":"Developer's email address","format":"email","type":"string"},"github_username":{"description":"GitHub username if linked via OAuth","type":"string"},"id":{"description":"Developer UUID","format":"uuid","type":"string"},"is_active":{"description":"Whether the developer account is active","type":"boolean"},"last_login_at":{"description":"When the developer last logged in","format":"date-time","type":"string"},"max_keys":{"description":"Maximum API keys this developer can create","maximum":20,"minimum":1,"type":"integer"},"name":{"description":"Developer's full name","type":"string"}},"required":["id","email","name","max_keys","is_active","created_at"],"type":"object"},"DeveloperAPIKey":{"description":"Developer-owned API key with usage statistics (secret not included)","properties":{"created_at":{"description":"When the key was created","format":"date-time","type":"string"},"id":{"description":"API key UUID","format":"uuid","type":"string"},"is_active":{"description":"Whether the key is currently active","type":"boolean"},"last_used_at":{"description":"When the key was last used","format":"date-time","type":"string"},"name":{"description":"Human-readable name for the key","type":"string"},"prefix":{"description":"First 8 characters of the key for identification","example":"01KGJZ40","type":"string"},"role":{"description":"API key role (always 'agent' for developer keys)","enum":["agent"],"type":"string"},"usage_30d":{"description":"Number of requests in the last 30 days","example":34210,"type":"integer"},"usage_7d":{"description":"Number of requests in the last 7 days","example":8420,"type":"integer"},"usage_today":{"description":"Number of requests made today","example":1523,"type":"integer"}},"required":["id","name","prefix","role","is_active","created_at"],"type":"object"},"DeveloperAPIKeyCreated":{"description":"Response when creating a new API key, includes full secret (shown only once)","properties":{"created_at":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"key":{"description":"Full API key secret (shown only once on creation)","example":"01KGJZ40ZG0WQ5SQ...","type":"string"},"name":{"type":"string"},"prefix":{"example":"01KGJZ40","type":"string"},"role":{"enum":["agent"],"type":"string"}},"required":["id","name","prefix","key","role","created_at"],"type":"object"},"Event":{"description":"A cultural event in Schema.org Event format with SEL extensions for provenance and federation","properties":{"@context":{"description":"JSON-LD context. May be a string URL, an array of URLs, or an embedded context object.\nPer JSON-LD specification, all three forms are valid.\n","oneOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"object"}]},"@id":{"description":"Canonical URI for this event","format":"uri","type":"string"},"@type":{"enum":["Event","EventSeries"],"type":"string"},"allDay":{"description":"True for an all-day / date-only event. When true, startDate and endDate are\ndate-only YYYY-MM-DD values rather than date-times.\n","type":"boolean"},"description":{"type":"string"},"doorTime":{"description":"Door time in the node's local civil time with a DST-correct RFC3339\nnumeric offset (configurable via DEFAULT_TIMEZONE, default America/Toronto).\n","format":"date-time","type":"string"},"endDate":{"description":"Event end time. Timed events are rendered in the node's local civil time\nwith a DST-correct RFC3339 numeric offset (configurable via DEFAULT_TIMEZONE,\ndefault America/Toronto). All-day events (allDay: true) are emitted as a\ndate-only YYYY-MM-DD value instead.\n","type":"string"},"eventAttendanceMode":{"format":"uri","type":"string"},"eventSchedule":{"$ref":"#/components/schemas/Schedule","description":"Recurrence schedule for recurring events. Present only when the event\nbelongs to a series with a canonical RRULE. Derived from the RRULE\nFREQ/INTERVAL/BYDAY/BYMONTHDAY parameters mapped to ISO 8601 durations\nand schema.org Schedule vocabulary.\n"},"eventStatus":{"format":"uri","type":"string"},"image":{"format":"uri","type":"string"},"inLanguage":{"items":{"type":"string"},"type":"array"},"isAccessibleForFree":{"type":"boolean"},"keywords":{"description":"Descriptive keyword tags","items":{"type":"string"},"type":"array"},"license":{"format":"uri","type":"string"},"location":{"$ref":"#/components/schemas/Place"},"name":{"type":"string"},"offers":{"$ref":"#/components/schemas/Offer"},"organizer":{"$ref":"#/components/schemas/Organization"},"sameAs":{"items":{"format":"uri","type":"string"},"type":"array"},"sel:confidence":{"maximum":1,"minimum":0,"type":"number"},"sel:ingestedAt":{"format":"date-time","type":"string"},"sel:originNode":{"format":"uri","type":"string"},"sel:synthetic":{"description":"True for explicitly marked synthetic fixture events. Omitted when false; consumers can exclude items where this field is true. This is a fixture marker, not a verification or trust rating.","type":"boolean"},"startDate":{"description":"Event start time. Timed events are rendered in the node's local civil time\nwith a DST-correct RFC3339 numeric offset (configurable via DEFAULT_TIMEZONE,\ndefault America/Toronto). All-day events (allDay: true) are emitted as a\ndate-only YYYY-MM-DD value instead.\n","type":"string"},"subEvent":{"description":"Per-occurrence sub-events (EventSeries serialisation). Each entry is\nrendered in its own occurrence's IANA timezone and labelled with the\nmatching `timezone` value, so the numeric offset in startDate/endDate\n(and doorTime) always agrees with the `timezone` label — even for a\nmixed-zone occurrence whose stored per-occurrence zone differs from the\nnode zone. The top-level event startDate/endDate/doorTime and the list\nenvelope `timeZone` instead use the node's civil timezone.\n","items":{"$ref":"#/components/schemas/EventSummary"},"type":"array"},"timeZone":{"description":"The node's IANA civil timezone (e.g. America/Toronto), advertised once per\nevent detail response (configurable via DEFAULT_TIMEZONE, default America/Toronto).\nIt scopes the top-level event startDate/endDate/doorTime. Each subEvent entry\nis instead rendered in its own occurrence's timezone and labelled with the\nmatching `timezone` value (see subEvent).\n","type":"string"},"url":{"format":"uri","type":"string"}},"required":["@id","@type","name","startDate","location"],"type":"object"},"EventFailure":{"description":"An individual event ingest failure within a scraper run","properties":{"index":{"description":"Zero-based index of the event in the scrape batch that failed","type":"integer"},"message":{"description":"Error message describing why the event failed to ingest","type":"string"},"url":{"description":"Source URL of the event that failed to ingest","format":"uri","type":"string"}},"type":"object"},"EventInput":{"description":"Input schema for creating or updating an event. Minimal required fields with optional Schema.org properties","properties":{"allDay":{"description":"Marks the event as all-day / date-only. When true, startDate and endDate are\ntreated (and emitted) as date-only YYYY-MM-DD values. Also set automatically\nwhen startDate is a bare YYYY-MM-DD date.\n\nThis is a statement about the event's OWN dates, which mirror the first\noccurrence. It is not copied onto the other occurrences of a series: each\noccurrence row carries its own all_day/marker and is anchored in its own\ntimezone (see the occurrence-level all_day). Review fixes address the\nevent's own dates and therefore correct only the occurrence they mirror.\n","type":"boolean"},"description":{"maxLength":10000,"type":"string"},"doorTime":{"format":"date-time","type":"string"},"endDate":{"description":"Event end time, as either an RFC3339 date-time or a bare YYYY-MM-DD date\n(see startDate). All-day events are emitted as a date-only YYYY-MM-DD value.\n","type":"string"},"image":{"format":"uri","type":"string"},"inLanguage":{"items":{"type":"string"},"type":"array"},"isAccessibleForFree":{"type":"boolean"},"keywords":{"items":{"type":"string"},"type":"array"},"location":{"oneOf":[{"$ref":"#/components/schemas/PlaceInput"},{"$ref":"#/components/schemas/VirtualLocationInput"}]},"name":{"description":"Event name (configurable via VALIDATION_MAX_EVENT_NAME_LENGTH, default 500)","maxLength":500,"minLength":1,"type":"string"},"offers":{"$ref":"#/components/schemas/OfferInput"},"organizer":{"$ref":"#/components/schemas/OrganizationInput"},"recurrence":{"$ref":"#/components/schemas/RecurrenceInput","description":"Series recurrence metadata for ICS-ingested recurring events.\nWhen present, the create pipeline upserts an event_series row using\nexternal_key and the event's synthetic marker as its identity, and\nlinks this event to the series. Ordinary and synthetic inputs with\nthe same external key have separate series.\n"},"sel:synthetic":{"default":false,"description":"Declares generated fixture data. Persisted on ingest and exposed as sel:synthetic when true. Omission means false; this marker does not grant permissions or bypass validation.","type":"boolean"},"source":{"$ref":"#/components/schemas/SourceInput"},"startDate":{"description":"Event start time, as either an RFC3339 date-time or a bare YYYY-MM-DD date.\nA bare date (or allDay: true) marks the event as all-day and is stored as\nlocal midnight in the occurrence/default timezone. On output, timed events\nare rendered in the node's local civil time with a DST-correct RFC3339 offset\n(configurable via DEFAULT_TIMEZONE, default America/Toronto); all-day events\nare emitted as a date-only YYYY-MM-DD value.\n","type":"string"},"suppress_review_warnings":{"description":"Benign review-warning codes that must not route this event into\n`pending_review`. Set by the scraper from the source's\n`suppress_review_warnings` config field; API clients may send the same\nallowlist directly.\n\nOnly the codes in this enum are accepted. Every other warning code —\nincluding `exact_duplicate`, `potential_duplicate`,\n`near_duplicate_of_new_event`, `outside_geo_boundary`,\n`place_possible_duplicate`, `org_possible_duplicate`,\n`reversed_dates_*`, `zero_duration_occurrence`, `too_far_future` and\n`ambiguous_year_far_future` — is rejected with a 400 validation\nerror, whether sent directly or requested in a scraper YAML config.\nIntegrity, duplicate and date-plausibility signals can never be\nsuppressed. The date codes are excluded specifically because they are\nthe only guard against parser year errors (e.g. 2026 parsed as 2062),\nwhich must always reach review.\n\nSuppression only affects the review gate: warnings are still generated\nand passed through the ingest pipeline, still stored on the review entry\nwhen one is created, and are exposed over HTTP on review-flagged\nresponses. Duplicate detection and companion cross-linking are unchanged\nwhen the code is not suppressed; suppressing\n`cross_week_series_companion` also disables companion cross-linking for\nthat submission (otherwise the companion would still gain a new review\nrow).\n","items":{"enum":["cross_week_series_companion","low_confidence","missing_description","missing_image","multi_session_likely"],"type":"string"},"type":["array","null"]},"url":{"format":"uri","type":"string"},"virtualLocation":{"$ref":"#/components/schemas/VirtualLocationInput"},"yearWasInferred":{"description":"True when the source date lacked an explicit year and the parser inferred it.\nWhen true, events beyond VALIDATION_AMBIGUOUS_DATE_MAX_FUTURE_DAYS (default 60)\nare sent to the review queue with an ambiguous_year_far_future warning.\n","type":"boolean"}},"required":["name","startDate"],"type":"object"},"EventListResponse":{"description":"Paginated list of events with cursor-based pagination","properties":{"@context":{"description":"Document-level JSON-LD context emitted only by the public `GET /api/v1/events` list endpoint when `?context=document` is requested. Scopes every member of `items`; per-item `@context` blocks are omitted in that mode. Absent otherwise (default `item` mode and other endpoints that reuse this schema, which never emit a document-level context).\n","oneOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"object"}]},"items":{"items":{"$ref":"#/components/schemas/EventSummary"},"type":"array"},"next_cursor":{"description":"Cursor for next page","type":"string"},"timeZone":{"description":"The node's IANA civil timezone (e.g. America/Toronto), advertised once per\nresult set (configurable via DEFAULT_TIMEZONE, default America/Toronto).\n","type":"string"},"warnings":{"description":"Parameter warnings. Present when a snake_case alias (e.g. start_date) was used instead of the canonical camelCase name, OR when an unrecognised query parameter was supplied and ignored (e.g. a guessed proximity param like lat/lng/radius_km). Each entry names the offending parameter. Omitted when nothing was detected. Unrecognised parameters are never rejected — the list is returned unfiltered by them — so check warnings to avoid trusting results that were not filtered as intended.\n","items":{"type":"string"},"type":"array"}},"required":["items"],"type":"object"},"EventOccurrence":{"description":"A single occurrence (date/time/venue) of an event","properties":{"availability":{"description":"Availability status (e.g., InStock, OutOfStock)","type":"string"},"doorTime":{"description":"Doors open time (optional)","format":"date-time","type":["string","null"]},"endTime":{"description":"End date and time of the occurrence (optional)","format":"date-time","type":["string","null"]},"id":{"description":"Occurrence UUID","type":"string"},"priceCurrency":{"description":"ISO 4217 currency code (e.g., USD)","type":"string"},"priceMax":{"description":"Maximum ticket price (optional)","format":"float","type":["number","null"]},"priceMin":{"description":"Minimum ticket price (optional)","format":"float","type":["number","null"]},"startTime":{"description":"Start date and time of the occurrence","format":"date-time","type":"string"},"ticketUrl":{"description":"URL to purchase tickets (optional)","type":"string"},"timezone":{"description":"IANA timezone identifier (e.g., America/New_York)","type":"string"},"venueUlid":{"description":"ULID of the venue (optional)","type":["string","null"]},"virtualUrl":{"description":"Virtual event URL (optional)","type":["string","null"]}},"required":["id","startTime","timezone"],"type":"object"},"EventSummary":{"description":"Compact event representation returned in public and admin list responses, including the original event URL when available. For the full record (organizer, offers, provenance) fetch the individual event by @id.","properties":{"@context":{"description":"JSON-LD context. Present on every item in the default `?context=item` list mode. Omitted per-item when `?context=document` is used — the single document-level `@context` on the response then scopes the item.\n","oneOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"object"}]},"@id":{"description":"Canonical URI for this event","format":"uri","type":"string"},"@type":{"enum":["Event","EventSeries"],"type":"string"},"allDay":{"description":"True for an all-day / date-only event. When true, startDate and endDate are\ndate-only YYYY-MM-DD values rather than date-times.\n","type":"boolean"},"description":{"description":"Event description. Present when the source provided one.","type":"string"},"doorTime":{"description":"Doors-open time. Present on `subEvent` entries, rendered in the same\noccurrence zone as startDate (see timezone).\n","format":"date-time","type":"string"},"endDate":{"description":"Event end time. For list items, timed events are rendered in the node's\nlocal civil time with a DST-correct RFC3339 numeric offset (configurable\nvia DEFAULT_TIMEZONE, default America/Toronto). When this schema is used\nfor a `subEvent` entry (see Event.subEvent), the value is instead rendered\nin that occurrence's own IANA zone and matches the `timezone` label below.\nAll-day events (allDay: true) are emitted as a date-only YYYY-MM-DD value.\n","type":"string"},"eventSchedule":{"$ref":"#/components/schemas/Schedule"},"keywords":{"description":"Descriptive keyword tags. Present when the source provided them.","items":{"type":"string"},"type":"array"},"location":{"$ref":"#/components/schemas/Place"},"name":{"type":"string"},"sel:synthetic":{"description":"True for explicitly marked synthetic fixture events. Omitted when false; consumers can exclude items where this field is true. This is a fixture marker, not a verification or trust rating.","type":"boolean"},"startDate":{"description":"Event start time. For list items, timed events are rendered in the node's\nlocal civil time with a DST-correct RFC3339 numeric offset (configurable\nvia DEFAULT_TIMEZONE, default America/Toronto). When this schema is used\nfor a `subEvent` entry (see Event.subEvent), the value is instead rendered\nin that occurrence's own IANA zone and matches the `timezone` label below.\nAll-day events (allDay: true) are emitted as a date-only YYYY-MM-DD value.\n","type":"string"},"timezone":{"description":"IANA timezone identifier for this entry. Present on `subEvent` entries,\nwhere it always matches the numeric offset in startDate/endDate/doorTime\n(each occurrence is rendered in its own zone and labelled accordingly).\n","type":"string"},"url":{"description":"Original human-facing event page from events.public_url (schema.org url). Omitted when unavailable; '@id' remains the canonical SEL URI.","format":"uri","type":"string"}},"required":["@id","@type","name","startDate","location"],"type":"object"},"EventUpdateInput":{"allOf":[{"$ref":"#/components/schemas/EventInput"},{"properties":{"lifecycleState":{"enum":["draft","published","postponed","rescheduled","sold_out","cancelled","completed"],"type":"string"},"version":{"description":"Current version for optimistic locking","type":"integer"}},"type":"object"}],"description":"Schema for updating an existing event with version control for optimistic locking"},"FederationNode":{"description":"Federation node record. Field names are the Go field names because the\nunderlying struct has no JSON tags.\n","properties":{"APIVersion":{"type":"string"},"BaseURL":{"format":"uri","type":"string"},"ContactEmail":{"format":"email","type":["string","null"]},"ContactName":{"type":["string","null"]},"CreatedAt":{"format":"date-time","type":"string"},"FederationStatus":{"enum":["pending","active","paused","blocked"],"type":"string"},"GeographicScope":{"type":["string","null"]},"ID":{"format":"uuid","type":"string"},"IsOnline":{"type":"boolean"},"LastErrorAt":{"format":"date-time","type":["string","null"]},"LastErrorMessage":{"type":["string","null"]},"LastHealthCheckAt":{"format":"date-time","type":["string","null"]},"LastSuccessfulSyncAt":{"format":"date-time","type":["string","null"]},"LastSyncAt":{"format":"date-time","type":["string","null"]},"NodeDomain":{"type":"string"},"NodeName":{"type":"string"},"Notes":{"type":["string","null"]},"RequiresAuth":{"type":"boolean"},"SyncCursor":{"type":["string","null"]},"SyncDirection":{"enum":["bidirectional","pull_only","push_only","disabled"],"type":"string"},"SyncEnabled":{"type":"boolean"},"TrustLevel":{"maximum":10,"minimum":1,"type":"integer"},"UpdatedAt":{"format":"date-time","type":"string"}},"type":"object"},"FederationNodeInput":{"properties":{"APIVersion":{"type":"string"},"BaseURL":{"format":"uri","type":"string"},"ContactEmail":{"format":"email","type":"string"},"ContactName":{"type":"string"},"FederationStatus":{"enum":["pending","active","paused","blocked"],"type":"string"},"GeographicScope":{"type":"string"},"NodeDomain":{"description":"Unique node domain, e.g. `toronto.togather.foundation`.","type":"string"},"NodeName":{"type":"string"},"Notes":{"type":"string"},"SyncDirection":{"enum":["bidirectional","pull_only","push_only","disabled"],"type":"string"},"SyncEnabled":{"type":"boolean"},"TrustLevel":{"maximum":10,"minimum":1,"type":"integer"}},"required":["NodeDomain","NodeName","BaseURL","TrustLevel","FederationStatus","SyncDirection"],"type":"object"},"FederationNodeUpdate":{"properties":{"APIVersion":{"type":"string"},"BaseURL":{"format":"uri","type":"string"},"ContactEmail":{"format":"email","type":"string"},"ContactName":{"type":"string"},"FederationStatus":{"enum":["pending","active","paused","blocked"],"type":"string"},"GeographicScope":{"type":"string"},"NodeName":{"type":"string"},"Notes":{"type":"string"},"SyncDirection":{"enum":["bidirectional","pull_only","push_only","disabled"],"type":"string"},"SyncEnabled":{"type":"boolean"},"TrustLevel":{"maximum":10,"minimum":1,"type":"integer"}},"type":"object"},"FederationSyncResponse":{"properties":{"@context":{"oneOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"object"}]},"@id":{"format":"uri","type":"string"},"@type":{"enum":["Event"],"type":"string"},"federationUri":{"format":"uri","type":"string"},"localId":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"required":["@type","@id","localId","federationUri"],"type":"object"},"GeoCoordinates":{"description":"Geographic coordinates (latitude/longitude) using Schema.org GeoCoordinates vocabulary","properties":{"@type":{"enum":["GeoCoordinates"],"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"}},"type":"object"},"GeocodeResponse":{"properties":{"attribution":{"example":"Data © OpenStreetMap contributors, ODbL 1.0","type":"string"},"cached":{"type":"boolean"},"display_name":{"type":"string"},"latitude":{"format":"double","type":"number"},"longitude":{"format":"double","type":"number"},"source":{"enum":["cache","nominatim"],"type":"string"}},"required":["latitude","longitude","display_name","source","cached","attribution"],"type":"object"},"HealthCheck":{"properties":{"checks":{"additionalProperties":{"$ref":"#/components/schemas/HealthCheckResult"},"type":"object"},"docs_url":{"type":"string"},"git_commit":{"type":"string"},"slot":{"type":"string"},"status":{"enum":["healthy","degraded","unhealthy","shutting_down"],"type":"string"},"timestamp":{"format":"date-time","type":"string"},"version":{"type":"string"}},"required":["status","version","git_commit","checks","timestamp"],"type":"object"},"HealthCheckResult":{"properties":{"details":{"additionalProperties":true,"type":"object"},"latency_ms":{"format":"int64","type":"integer"},"message":{"type":"string"},"status":{"enum":["pass","warn","fail"],"type":"string"}},"required":["status"],"type":"object"},"IdentifierView":{"description":"A single external identifier observation","properties":{"authority":{"type":"string"},"confidence":{"type":"number"},"is_primary":{"type":"boolean"},"method":{"type":"string"},"observed_at":{"format":"date-time","type":"string"},"source":{"type":"string"},"uri":{"type":"string"}},"type":"object"},"IdentityLinkRequest":{"description":"Request body for recording an identifier link decision","properties":{"authority":{"type":"string"},"confidence":{"description":"Clamped to [0,1] (default 1.0)","type":"number"},"entity_id":{"description":"Entity ULID","type":"string"},"entity_type":{"enum":["place","organization"],"type":"string"},"method":{"description":"Restricted to `manual` in Phase 1 (anything else is normalised to manual)","type":"string"},"rationale":{"type":"string"},"source":{"description":"Restricted to `manual` in Phase 1 (anything else is normalised to manual)","type":"string"},"uri":{"type":"string"}},"required":["entity_type","entity_id","authority","uri"],"type":"object"},"IdentityRef":{"description":"Reference to a SEL entity by type and ULID","properties":{"entity_id":{"description":"Entity ULID","type":"string"},"entity_type":{"enum":["place","organization"],"type":"string"}},"required":["entity_type","entity_id"],"type":"object"},"IdentityRejectRequest":{"description":"Request body for recording a reject decision","properties":{"counterpart_id":{"description":"Counterpart entity ULID","type":"string"},"entity_id":{"description":"Entity ULID","type":"string"},"entity_type":{"enum":["place","organization"],"type":"string"},"reason":{"type":"string"}},"required":["entity_type","entity_id","counterpart_id"],"type":"object"},"IdentityView":{"description":"An entity's identity state (identifiers, primaries, decisions)","properties":{"decisions":{"items":{"$ref":"#/components/schemas/DecisionRecord"},"type":"array"},"identifiers":{"items":{"$ref":"#/components/schemas/IdentifierView"},"type":"array"},"primary":{"additionalProperties":{"type":"string"},"type":"object"},"ref":{"$ref":"#/components/schemas/IdentityRef"}},"type":"object"},"MergeRequest":{"properties":{"duplicate_id":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"},"primary_id":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"required":["primary_id","duplicate_id"],"type":"object"},"MergeResult":{"properties":{"already_merged":{"type":"boolean"},"canonical_id":{"type":"string"},"status":{"enum":["merged"],"type":"string"}},"required":["status","canonical_id","already_merged"],"type":"object"},"MessageResponse":{"properties":{"message":{"type":"string"}},"required":["message"],"type":"object"},"OccurrenceInput":{"description":"Input for creating or updating an event occurrence","properties":{"all_day":{"description":"Marker for an all-day (date-only) occurrence. When true, the occurrence is anchored to local midnight in its timezone. This marker does not change the wire encoding: start_time and end_time are always RFC3339 date-times in the admin occurrence API (both request and response). Sending all_day: true anchors start_time and end_time to local midnight, in the occurrence's timezone, of the civil date each value carries (the leading date of the RFC3339 value, in the value's own offset). That is the same date rule ingestion applies to startDate, so the same value anchors to the same date through either entry point; a value that is midnight in a zone east of the occurrence's keeps the date it carries rather than moving a day earlier. A start_time the request does not supply is taken from the stored row, whose date is read in the row's current timezone (before any timezone change in the same request). Retiming an all-day occurrence to a time off local midnight — on either start_time or end_time — clears the marker, so a stored row can never claim is_all_day while holding a timed instant. Clearing the end with end_time: null does not clear the marker: a date-only occurrence may have no end.\n","type":"boolean"},"availability":{"description":"Ticket availability status","enum":["available","sold_out","limited"],"type":"string"},"door_time":{"description":"Door open time (RFC3339), or null to clear","format":"date-time","type":["string","null"]},"end_time":{"description":"End time of the occurrence (RFC3339), or null to clear","format":"date-time","type":["string","null"]},"price_currency":{"description":"ISO 4217 currency code (e.g. USD)","type":"string"},"price_max":{"description":"Maximum ticket price, or null to clear","type":["number","null"]},"price_min":{"description":"Minimum ticket price (inclusive), or null to clear","type":["number","null"]},"start_time":{"description":"Start time of the occurrence (RFC3339)","format":"date-time","type":"string"},"ticket_url":{"description":"URL for purchasing tickets, or null to clear","format":"uri","type":["string","null"]},"timezone":{"description":"IANA timezone identifier (e.g. America/New_York)","type":"string"},"venue_ulid":{"description":"ULID of the venue for this occurrence, or null to clear","type":["string","null"]},"virtual_url":{"description":"URL for virtual/hybrid attendance, or null to clear","format":"uri","type":["string","null"]},"yearWasInferred":{"description":"True when the occurrence date lacked an explicit year and the parser inferred it.\n","type":"boolean"}},"type":"object"},"OccurrenceResponse":{"description":"An event occurrence as returned by the admin occurrence API","properties":{"all_day":{"description":"True if the occurrence is an all-day (date-only) event","type":"boolean"},"availability":{"type":["string","null"]},"door_time":{"format":"date-time","type":["string","null"]},"end_time":{"format":"date-time","type":["string","null"]},"id":{"description":"UUID of the occurrence","format":"uuid","type":"string"},"price_currency":{"type":["string","null"]},"price_max":{"type":["number","null"]},"price_min":{"type":["number","null"]},"start_time":{"format":"date-time","type":"string"},"ticket_url":{"format":"uri","type":["string","null"]},"timezone":{"type":"string"},"venue_id":{"description":"Internal UUID of the venue","type":["string","null"]},"venue_ulid":{"description":"Public ULID of the venue","type":["string","null"]},"virtual_url":{"format":"uri","type":["string","null"]}},"type":"object"},"Offer":{"description":"Ticketing or pricing information using Schema.org Offer vocabulary","properties":{"@type":{"enum":["Offer"],"type":"string"},"availability":{"format":"uri","type":"string"},"price":{"type":"string"},"priceCurrency":{"type":"string"},"url":{"format":"uri","type":"string"}},"type":"object"},"OfferInput":{"description":"Input schema for ticket/pricing offers","properties":{"price":{"type":"string"},"priceCurrency":{"default":"CAD","type":"string"},"url":{"format":"uri","type":"string"}},"type":"object"},"Organization":{"description":"An organization or person that organizes events, using Schema.org Organization vocabulary","properties":{"@id":{"format":"uri","type":"string"},"@type":{"enum":["Organization"],"type":"string"},"alternateName":{"type":"string"},"name":{"type":"string"},"sameAs":{"items":{"format":"uri","type":"string"},"type":"array"},"url":{"format":"uri","type":"string"}},"required":["@type","name"],"type":"object"},"OrganizationInput":{"description":"Input schema for specifying event organizers","properties":{"@id":{"format":"uri","type":"string"},"name":{"type":"string"},"url":{"format":"uri","type":"string"}},"required":["name"],"type":"object"},"OrganizationListResponse":{"description":"Paginated list of organizations with cursor-based pagination","properties":{"items":{"items":{"$ref":"#/components/schemas/Organization"},"type":"array"},"next_cursor":{"type":"string"},"warnings":{"description":"Parameter alias warnings. See EventListResponse.warnings for details.","items":{"type":"string"},"type":"array"}},"required":["items"],"type":"object"},"Place":{"description":"A physical location or venue where events occur, using Schema.org Place vocabulary","properties":{"@id":{"format":"uri","type":"string"},"@type":{"enum":["Place"],"type":"string"},"address":{"$ref":"#/components/schemas/PostalAddress"},"geo":{"$ref":"#/components/schemas/GeoCoordinates"},"name":{"type":"string"},"sameAs":{"items":{"format":"uri","type":"string"},"type":"array"},"telephone":{"type":"string"},"url":{"format":"uri","type":"string"}},"required":["@type","name"],"type":"object"},"PlaceInput":{"description":"Input schema for specifying event locations with address and geographic coordinates","properties":{"@id":{"description":"Reference to existing place by URI","format":"uri","type":"string"},"addressCountry":{"type":"string"},"addressLocality":{"type":"string"},"addressRegion":{"type":"string"},"latitude":{"type":"number"},"longitude":{"type":"number"},"name":{"type":"string"},"postalCode":{"type":"string"},"streetAddress":{"type":"string"}},"required":["name"],"type":"object"},"PlaceListResponse":{"description":"Paginated list of places (venues) with cursor-based pagination","properties":{"items":{"items":{"$ref":"#/components/schemas/Place"},"type":"array"},"next_cursor":{"type":"string"},"warnings":{"description":"Parameter alias warnings. See EventListResponse.warnings for details.","items":{"type":"string"},"type":"array"}},"required":["items"],"type":"object"},"PostalAddress":{"description":"Physical mailing address using Schema.org PostalAddress vocabulary","properties":{"@type":{"enum":["PostalAddress"],"type":"string"},"addressCountry":{"type":"string"},"addressLocality":{"type":"string"},"addressRegion":{"type":"string"},"postalCode":{"type":"string"},"streetAddress":{"type":"string"}},"type":"object"},"ProblemDetails":{"description":"RFC 7807 Problem Details","properties":{"detail":{"description":"Human-readable explanation","example":"You have reached your maximum of 5 API keys. Revoke an existing key or contact an admin to increase your limit.","type":"string"},"instance":{"description":"URI identifying the specific occurrence","example":"/api/v1/dev/api-keys","type":"string"},"status":{"description":"HTTP status code","example":409,"type":"integer"},"title":{"description":"Short, human-readable summary","example":"Maximum API keys exceeded","type":"string"},"type":{"description":"URI identifying the problem type","example":"https://sel.events/problems/max-keys-exceeded","format":"uri","type":"string"}},"required":["type","title","status"],"type":"object"},"RecurrenceInput":{"description":"Carries series-level recurrence metadata populated by the ICS mapper.\nAll occurrences from the same master VEVENT share an identical RecurrenceInput.\nThe createEventCore pipeline uses it to upsert exactly one event_series row\nper external_key and event synthetic marker.\n","properties":{"exdates":{"description":"EXDATE UTC timestamps from the master VEVENT.","items":{"format":"date-time","type":"string"},"type":"array"},"external_key":{"description":"Series identity within the event's synthetic classification, formatted as \"\u003csource_name\u003e:\u003cmaster_uid\u003e\".","type":"string"},"rdates":{"description":"RDATE UTC timestamps from the master VEVENT.","items":{"format":"date-time","type":"string"},"type":"array"},"rrule":{"description":"RFC 5545 RRULE value string (no \"RRULE:\" prefix).","type":"string"},"series_end":{"description":"UNTIL date if present in RRULE; null for COUNT-only or infinite rules.","format":"date-time","type":["string","null"]},"series_name":{"description":"Master VEVENT SUMMARY (shared across all occurrences).","type":"string"},"series_start":{"description":"DTSTART truncated to local date (TZID-aware).","format":"date-time","type":"string"},"tzid":{"description":"IANA timezone ID from DTSTART's TZID parameter.","type":"string"}},"required":["external_key","series_name","series_start","rrule","tzid"],"type":"object"},"RelatedEvent":{"description":"A related event identified from warnings or duplicate link, including full event data for side-by-side comparison","properties":{"description":{"description":"Event description (optional)","type":["string","null"]},"imageUrl":{"description":"Image URL for the event (optional)","type":["string","null"]},"name":{"description":"Event name","type":"string"},"occurrences":{"description":"List of occurrences for the related event","items":{"$ref":"#/components/schemas/EventOccurrence"},"type":"array"},"organizerName":{"description":"Name of the organizer (optional)","type":["string","null"]},"organizerUrl":{"description":"URL of the organizer (optional)","type":["string","null"]},"similarity":{"description":"Similarity score from duplicate-warning details, if available (0–1)","format":"float","type":["number","null"]},"ulid":{"description":"ULID of the related event","type":"string"},"url":{"description":"Public URL of the event (optional)","type":["string","null"]},"venueCity":{"description":"City of the venue (optional)","type":["string","null"]},"venueName":{"description":"Name of the primary venue (optional)","type":["string","null"]},"venuePostalCode":{"description":"Postal code of the venue (optional)","type":["string","null"]},"venueRegion":{"description":"Province/region of the venue (optional)","type":["string","null"]},"venueStreetAddress":{"description":"Street address of the venue (optional)","type":["string","null"]},"venueUlid":{"description":"ULID of the primary venue (optional)","type":["string","null"]}},"required":["ulid"],"type":"object"},"ReverseGeocodeResponse":{"properties":{"address":{"$ref":"#/components/schemas/AddressComponents"},"attribution":{"type":"string"},"cached":{"type":"boolean"},"display_name":{"type":"string"},"latitude":{"format":"double","type":"number"},"longitude":{"format":"double","type":"number"},"source":{"enum":["cache","nominatim"],"type":"string"}},"required":["display_name","address","latitude","longitude","source","cached","attribution"],"type":"object"},"ReviewQueueDetail":{"description":"Detailed review queue entry including original payload, normalized payload, and detected changes","properties":{"changes":{"description":"List of changes made during normalization","items":{"$ref":"#/components/schemas/ChangeDetail"},"type":"array"},"createdAt":{"description":"When the entry was created","format":"date-time","type":"string"},"duplicateOfEventUlid":{"description":"ULID of the primary event that this review entry was merged into or linked as a near-duplicate of. Set when the review action is add-occurrence or consolidation, and also when near-duplicate cross-linking creates a review entry for an existing published event.\n","type":"string"},"eventId":{"description":"Event ULID","type":"string"},"id":{"description":"Review queue entry ID","type":"integer"},"normalized":{"description":"Normalized event payload after corrections","type":"object"},"occurrences":{"description":"List of occurrences for the event associated with this review entry","items":{"$ref":"#/components/schemas/EventOccurrence"},"type":"array"},"original":{"description":"Original event payload as submitted","type":"object"},"rejectionReason":{"description":"Reason for rejection (if rejected)","type":"string"},"relatedEvents":{"description":"Related events identified from warnings or duplicate link","items":{"$ref":"#/components/schemas/RelatedEvent"},"type":"array"},"reviewNotes":{"description":"Notes from the reviewer (if approved with notes)","type":"string"},"reviewedAt":{"description":"When the review was completed (if reviewed)","format":"date-time","type":"string"},"reviewedBy":{"description":"Email of admin who reviewed (if reviewed)","type":"string"},"sourceId":{"description":"Source identifier for provenance tracking.","type":["string","null"]},"status":{"description":"Current review status. `pending` = awaiting decision; `approved` = event published; `rejected` = event deleted; `merged` = event absorbed into another event (via add-occurrence or consolidation); `dismissed` = companion review resolved via consolidation.\n","enum":["pending","approved","rejected","merged","dismissed"],"type":"string"},"warnings":{"description":"Validation warnings that triggered review","items":{"$ref":"#/components/schemas/ValidationWarning"},"type":"array"}},"required":["id","eventId","status","warnings","original","normalized","changes","createdAt","occurrences","relatedEvents"],"type":"object"},"ReviewQueueItem":{"description":"Summary of a review queue entry with event ID and reason for review","properties":{"createdAt":{"description":"When the entry was created","format":"date-time","type":"string"},"duplicateOfEventUlid":{"description":"ULID of the primary event that this review entry was merged into or linked as a near-duplicate of. Set when the review action is add-occurrence or consolidation, and also when near-duplicate cross-linking creates a review entry for an existing published event.\n","type":"string"},"eventEndTime":{"description":"Event end time","format":"date-time","type":"string"},"eventId":{"description":"Event ULID","type":"string"},"eventName":{"description":"Name of the event (from original payload)","type":"string"},"eventStartTime":{"description":"Event start time","format":"date-time","type":"string"},"eventUrl":{"description":"Original event page from events.public_url. Omitted when unavailable.","format":"uri","type":"string"},"id":{"description":"Review queue entry ID","type":"integer"},"occurrenceCount":{"description":"Number of occurrences for the event. Fetched from the live event data to reflect current occurrence information.\n","type":"integer"},"reviewedAt":{"description":"When the review was completed (if reviewed)","format":"date-time","type":"string"},"reviewedBy":{"description":"Email of admin who reviewed (if reviewed)","type":"string"},"sourceId":{"description":"Source identifier for provenance tracking.","type":["string","null"]},"sourceUrl":{"description":"Canonical feed URL of the resolved source, falling back to its legacy base URL. Omitted when the source cannot be resolved or has no URL.","format":"uri","type":"string"},"status":{"description":"Current review status. `pending` = awaiting decision; `approved` = event published; `rejected` = event deleted; `merged` = event absorbed into another event (via add-occurrence or consolidation); `dismissed` = companion review resolved via consolidation.\n","enum":["pending","approved","rejected","merged","dismissed"],"type":"string"},"warnings":{"description":"Validation warnings that triggered review","items":{"$ref":"#/components/schemas/ValidationWarning"},"type":"array"}},"required":["id","eventId","warnings","status","createdAt"],"type":"object"},"ReviewQueueListResponse":{"description":"Paginated list of events awaiting admin review","properties":{"items":{"items":{"$ref":"#/components/schemas/ReviewQueueItem"},"type":"array"},"next_cursor":{"description":"Cursor for next page (review queue entry ID)","type":"string"}},"required":["items"],"type":"object"},"Schedule":{"description":"schema.org Schedule type representing recurrence metadata for recurring events.\nDerived from canonical RRULE data stored on the event series.\n","properties":{"@type":{"enum":["Schedule"],"type":"string"},"byDay":{"description":"Days of the week from RRULE BYDAY, mapped from two-letter codes\n(MO→Monday, TU→Tuesday, etc.) to schema.org DayOfWeek full names.\n","example":["Monday","Wednesday"],"items":{"enum":["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],"type":"string"},"type":"array"},"byMonthDay":{"description":"Days of the month from RRULE BYMONTHDAY. Negative values count\nbackwards from month end (e.g. -1 is the last day).\n","example":[15,-15],"items":{"type":"integer"},"type":"array"},"endDate":{"description":"End date of the recurrence series (from last occurrence end time, if available).","format":"date-time","type":"string"},"repeatFrequency":{"description":"ISO 8601 duration for the recurrence frequency.\nDerived from RRULE FREQ and INTERVAL:\nDAILY → P1D (or P{N}D with INTERVAL=N),\nWEEKLY → P1W (or P{N}W with INTERVAL=N),\nMONTHLY → P1M (or P{N}M with INTERVAL=N),\nYEARLY → P1Y (or P{N}Y with INTERVAL=N).\nHOURLY/MINUTELY/SECONDLY are omitted with a warning log.\n","example":"P1W","type":"string"},"scheduleTimezone":{"description":"IANA timezone identifier (e.g. America/Toronto).","type":"string"},"startDate":{"description":"Start date of the recurrence series (from first occurrence).","format":"date-time","type":"string"}},"type":"object"},"ScraperConfig":{"description":"Global scraper configuration settings","properties":{"auto_scrape":{"default":true,"description":"Whether automatic scheduled scraping is enabled","type":"boolean"},"max_batch_size":{"default":100,"description":"Maximum number of events to batch per source. Scheduled bibliocommons_rss runs also use this as the per-run event cap; when a source extracts more, only the first N are kept and a result_truncated_by_limit quality warning is recorded on the run.","type":"integer"},"max_concurrent_sources":{"default":3,"description":"Maximum number of sources to scrape concurrently","type":"integer"},"rate_limit_ms":{"default":0,"description":"Minimum delay between requests in milliseconds","type":"integer"},"request_timeout_seconds":{"default":30,"description":"HTTP request timeout in seconds","type":"integer"},"retry_max_attempts":{"default":3,"description":"Maximum retry attempts for failed requests","type":"integer"}},"type":"object"},"ScraperConfigPatch":{"description":"Partial scraper configuration for PATCH requests (all fields optional)","properties":{"auto_scrape":{"type":"boolean"},"max_batch_size":{"description":"Must be greater than 0","type":"integer"},"max_concurrent_sources":{"description":"Must be greater than 0","type":"integer"},"rate_limit_ms":{"description":"Must be 0 or greater","type":"integer"},"request_timeout_seconds":{"description":"Must be greater than 0","type":"integer"},"retry_max_attempts":{"description":"Must be greater than 0","type":"integer"}},"type":"object"},"ScraperRunDetail":{"description":"A single scraper run record","properties":{"completed_at":{"format":"date-time","type":"string"},"error_message":{"type":"string"},"event_failures":{"description":"Per-event ingest failure details from the run metadata","items":{"$ref":"#/components/schemas/EventFailure"},"type":"array"},"events_dup":{"type":"integer"},"events_failed":{"type":"integer"},"events_found":{"type":"integer"},"events_new":{"type":"integer"},"id":{"type":"integer"},"location_resolved":{"description":"Events the boundary geocoder placed inside the boundary (surfaced\nfrom the run metadata). Present only when\n`GEOCODING_BOUNDARY_FALLBACK_ENABLED=true` (default `false`) and the\nfallback did work for this run.\n","type":"integer"},"location_skipped":{"description":"Events not looked up because the per-batch budget\n(`GEOCODING_BOUNDARY_FALLBACK_MAX_LOOKUPS_PER_BATCH`, default `5`)\nor time window (`GEOCODING_BOUNDARY_FALLBACK_BUDGET_MS`, default\nhalf of `SCRAPER_POLL_TIMEOUT_MS`) was exhausted. Present only when\nthe fallback was used.\n","type":"integer"},"location_unresolved":{"description":"Boundary lookups that ran but did not produce an accepted location.\nPresent only when the fallback was used.\n","type":"integer"},"quality_warnings":{"description":"Run-level quality warnings from the run metadata (the `ics_warnings`\nkey). Includes `location_unresolved: N event(s) could not be placed\nby the boundary geocoder` when the opt-in boundary fallback\n(`GEOCODING_BOUNDARY_FALLBACK_ENABLED`, default `false`) could not\nplace some events. Omitted when the run recorded none.\n","items":{"type":"string"},"type":"array"},"source_name":{"type":"string"},"source_url":{"format":"uri","type":"string"},"started_at":{"format":"date-time","type":"string"},"status":{"type":"string"},"tier":{"type":"integer"}},"type":"object"},"ScraperSourceSummary":{"description":"A scraper source with its latest run summary","properties":{"enabled":{"type":"boolean"},"extraction_method":{"description":"Extraction pipeline for this source. Empty or \"scraper\" for default tier-based dispatch, \"ics\" for ICS feed extraction, \"bibliocommons_rss\" for BiblioCommons library events RSS feeds.","enum":["","scraper","ics","bibliocommons_rss"],"type":"string"},"id":{"type":"integer"},"last_run_completed_at":{"format":"date-time","type":"string"},"last_run_error_message":{"type":"string"},"last_run_events_dup":{"type":"integer"},"last_run_events_failed":{"type":"integer"},"last_run_events_found":{"type":"integer"},"last_run_events_new":{"type":"integer"},"last_run_started_at":{"format":"date-time","type":"string"},"last_run_status":{"type":"string"},"license":{"type":"string"},"name":{"type":"string"},"schedule":{"type":"string"},"suppress_review_warnings":{"description":"Benign review-warning codes this source suppresses for review gating. Warnings are still generated and passed to the ingest pipeline; they simply do not push events into pending_review. Configurable in the source YAML via `suppress_review_warnings`; only these codes are accepted, and `server scrape sync` exits non-zero if a config lists anything else.","items":{"enum":["cross_week_series_companion","low_confidence","missing_description","missing_image","multi_session_likely"],"type":"string"},"type":"array"},"tier":{"type":"integer"},"tls_fingerprint":{"description":"TLS fingerprint spoofing mode. \"chrome_auto\" mimics Chrome's TLS handshake to bypass WAF detection (Akamai, Cloudflare). ALPN is restricted to http/1.1 only to avoid HTTP/2 protocol mismatches on Cloudflare-protected sites. Empty means disabled (default). Not used by Tier 2 (headless browser already uses real Chrome).","type":"string"},"url":{"format":"uri","type":"string"}},"type":"object"},"SeriesCandidate":{"description":"A conservative cluster of events that look like one weekly programme.","properties":{"content_varies":{"description":"True when description evidence needs investigation: more than one distinct non-empty description, or some members have a description and others do not. This is not a reason to skip. Consolidate when differences are logistics or boilerplate (capacity notices, room or location suffixes, registration phrasing, restated dates, punctuation, casing, whitespace). Keep separate when the text carries per-occurrence content (a named activity, film, guest, or topic per date) or titles form a progression (Part N, Session N, I/II/III, Beginners/Advanced), because consolidation keeps only the canonical event's description and occurrences cannot carry per-date text.\n","type":"boolean"},"day_of_week":{"description":"ISO weekday (1 = Monday, 7 = Sunday) of the canonical member's first occurrence.","maximum":7,"minimum":1,"type":"integer"},"described_member_count":{"description":"Number of members with a non-empty description fingerprint.","minimum":0,"type":"integer"},"descriptions_truncated":{"description":"True when any distinct description entry was capped at 600 characters. The full text is available on each member event.\n","type":"boolean"},"distinct_description_count":{"description":"Number of distinct non-empty member descriptions, compared after trimming leading/trailing whitespace (fingerprints only; the count and `distinct_descriptions` come from the same pass). 0 when every member has no description. This is a count of distinct descriptions, not the number of members whose descriptions differ.\n","minimum":0,"type":"integer"},"distinct_descriptions":{"description":"Deduped description evidence for admins, one entry per distinct non-empty fingerprint in first-occurrence order (members sorted by start date). Each entry is trimmed and capped at 600 characters. Dedupe uses the fingerprint, so two members whose 600-character prefixes are identical but whose full text differs remain two entries. Admin display evidence only: never log or persist this text. Always `[]` when no member has a description.\n","items":{"type":"string"},"type":"array"},"event_count":{"description":"Number of distinct events in the cluster.","type":"integer"},"first_date":{"description":"Earliest in-window occurrence date across the cluster.","format":"date","type":"string"},"last_date":{"description":"Latest in-window occurrence date across the cluster.","format":"date","type":"string"},"local_start_time":{"description":"Local start time (`HH:MM`) of the canonical member's first occurrence.","example":"18:00","type":"string"},"members":{"items":{"$ref":"#/components/schemas/SeriesCandidateMember"},"type":"array"},"name":{"description":"Most frequent member name; ties break on earliest occurrence, then lexicographically.","type":"string"},"occurrence_count":{"description":"Sum of in-window occurrences across cluster members (requested window plus one-day boundary allowance).","type":"integer"},"suggested_canonical_ulid":{"description":"Member with the earliest upcoming in-window occurrence (\u003e= now), or the earliest in-window occurrence overall when none is upcoming. Ties break on most in-window occurrences, then ULID.\n","type":"string"},"venue":{"$ref":"#/components/schemas/SeriesCandidateVenue"}},"required":["suggested_canonical_ulid","name","venue","day_of_week","local_start_time","event_count","occurrence_count","first_date","last_date","members","distinct_descriptions","described_member_count","descriptions_truncated","distinct_description_count","content_varies"],"type":"object"},"SeriesCandidateMember":{"description":"One event in a series-candidate cluster.","properties":{"lifecycle_state":{"description":"Event lifecycle state (always `published` for candidates).","type":"string"},"name":{"type":"string"},"occurrence_count":{"description":"Number of in-window occurrences on this member (requested window plus one-day boundary allowance).","type":"integer"},"start_date":{"description":"Earliest in-window occurrence local date for this member.","format":"date","type":"string"},"ulid":{"description":"Event ULID.","type":"string"}},"required":["ulid","name","start_date","occurrence_count","lifecycle_state"],"type":"object"},"SeriesCandidateVenue":{"description":"Venue shared by every member of a series candidate.","properties":{"id":{"description":"Place ULID (from `events.primary_venue_id`).","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"SeriesCandidatesResponse":{"description":"Read-only series-candidate discovery result. Counts, dates, and canonical selection are scoped to the requested window (plus the documented one-day boundary allowance), not each event's full lifetime.\n","properties":{"items":{"items":{"$ref":"#/components/schemas/SeriesCandidate"},"type":"array"},"total_clusters":{"description":"Number of clusters before `offset` and `limit` are applied.","type":"integer"},"truncated":{"description":"True when `offset + len(items) \u003c total_clusters`.","type":"boolean"}},"required":["items","total_clusters","truncated"],"type":"object"},"SimilarityCandidate":{"properties":{"name":{"type":"string"},"similarity":{"format":"double","maximum":1,"minimum":0,"type":"number"},"ulid":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}},"required":["ulid","name","similarity"],"type":"object"},"SourceDiagnostics":{"description":"Diagnostics for a single scraper source including latest run, last successful run, and recent history","properties":{"last_successful_run":{"description":"The most recent completed run (included when latest_run failed, for comparison)","oneOf":[{"$ref":"#/components/schemas/ScraperRunDetail"},{"type":"null"}]},"latest_run":{"description":"The most recent run for this source (null if no runs exist)","oneOf":[{"$ref":"#/components/schemas/ScraperRunDetail"},{"type":"null"}]},"recent_runs":{"description":"Recent runs ordered newest first (limited by query param)","items":{"$ref":"#/components/schemas/ScraperRunDetail"},"type":"array"},"source_name":{"type":"string"}},"type":"object"},"SourceInput":{"description":"Provenance metadata identifying the data source and attribution for submitted events","properties":{"eventId":{"description":"External system's event ID, scoped to the feed URL rather than a source registry row.","type":"string"},"url":{"description":"Feed URL for provenance and canonical source identity. Query strings\nand fragments are removed during validation; identity comparisons\nignore trailing slashes. Different paths on one host identify\nseparate feeds. A source name is a label and does not change this key.\n","format":"uri","type":"string"}},"type":"object"},"StatsResponse":{"description":"Public server statistics returned by `GET /api/v1/stats`.","properties":{"events_created_last_30_days":{"format":"int64","type":"integer"},"events_created_last_7_days":{"format":"int64","type":"integer"},"git_commit":{"type":"string"},"newest_event_date":{"format":"date-time","type":"string"},"oldest_event_date":{"format":"date-time","type":"string"},"past_events":{"format":"int64","type":"integer"},"pending_events":{"description":"Events currently in the `draft` lifecycle state.","format":"int64","type":"integer"},"published_events":{"format":"int64","type":"integer"},"slot":{"description":"Deployment slot (blue/green), when configured.","type":"string"},"status":{"example":"healthy","type":"string"},"timestamp":{"format":"date-time","type":"string"},"total_events":{"format":"int64","type":"integer"},"total_organizations":{"format":"int64","type":"integer"},"total_places":{"format":"int64","type":"integer"},"total_sources":{"description":"Number of source rows, including retained legacy and idle rows.\nCanonical rows use the normalized feed URL as their unique key;\nbase_url contains that full URL and names are labels. One provider\nserving different feed paths contributes multiple canonical rows.\n","format":"int64","type":"integer"},"total_users":{"format":"int64","type":"integer"},"upcoming_events":{"format":"int64","type":"integer"},"uptime_seconds":{"format":"int64","type":"integer"},"version":{"type":"string"}},"required":["status","version","git_commit","uptime_seconds","total_events","total_places","total_organizations","total_sources","total_users","published_events","pending_events","events_created_last_7_days","events_created_last_30_days","upcoming_events","past_events","timestamp"],"type":"object"},"Submission":{"description":"A URL submission record","properties":{"id":{"format":"int64","type":"integer"},"notes":{"description":"Admin review notes","type":["string","null"]},"rejection_reason":{"description":"Set when the batch validator rejects the URL","type":["string","null"]},"status":{"enum":["pending_validation","pending","processed","rejected"],"type":"string"},"submitted_at":{"format":"date-time","type":"string"},"submitter_ip":{"description":"IP address of the submitter","type":"string"},"url":{"description":"Original submitted URL","format":"uri","type":"string"},"url_norm":{"description":"Normalised URL (trailing slash stripped, lowercased scheme/host)","format":"uri","type":"string"},"validated_at":{"description":"Timestamp when the batch validator processed this submission","format":"date-time","type":["string","null"]}},"type":"object"},"SubmissionResult":{"description":"Per-URL result from the public submission endpoint","properties":{"message":{"description":"Human-readable explanation","type":"string"},"status":{"description":"`accepted` — stored for validation; `duplicate` — already submitted\nrecently; `rejected` — failed basic validation (invalid URL, etc.)\n","enum":["accepted","duplicate","rejected"],"type":"string"},"url":{"description":"The URL that was submitted","format":"uri","type":"string"}},"type":"object"},"Tombstone":{"description":"Response for deleted entities (HTTP 410)","properties":{"@context":{"type":["string","object"]},"@id":{"format":"uri","type":"string"},"@type":{"type":"string"},"eventStatus":{"format":"uri","type":"string"},"sel:deletedAt":{"format":"date-time","type":"string"},"sel:deletionReason":{"type":"string"},"sel:supersededBy":{"format":"uri","type":"string"},"sel:tombstone":{"type":"boolean"}},"type":"object"},"ValidationWarning":{"description":"Warning message from event validation or normalization process","properties":{"code":{"description":"Warning code (e.g., \"REVERSED_DATES\", \"MISSING_END_DATE\")","type":"string"},"field":{"description":"Field path that triggered the warning","type":"string"},"message":{"description":"Human-readable warning message","type":"string"},"occurrences":{"description":"List of occurrences for the event under review. These are fetched from the live event data (not from the ingest snapshot) to ensure the UI shows current occurrence information for dedup decision-making. Empty if the event has no occurrences (e.g., single-instance long-duration occurrence).\n","items":{"$ref":"#/components/schemas/EventOccurrence"},"type":"array"},"relatedEvents":{"description":"List of related events extracted from validation warnings (potential_duplicate, near_duplicate_of_new_event) and from the duplicateOfEventUlid field. Each entry includes full event data (name, description, URL, venue, occurrences, similarity) so the UI can render the side-by-side comparison panel without additional API calls. Used to determine which case applies (Case 1: empty list, Case 2/3: non-empty list).\n","items":{"$ref":"#/components/schemas/RelatedEvent"},"type":"array"},"severity":{"description":"Warning severity level","enum":["info","warning","error"],"type":"string"}},"required":["code","message"],"type":"object"},"VersionResponse":{"properties":{"build_date":{"type":"string"},"git_commit":{"type":"string"},"go_version":{"type":"string"},"version":{"type":"string"}},"required":["version","git_commit","build_date","go_version"],"type":"object"},"VirtualLocationInput":{"description":"Input schema for online/virtual event locations with URL","properties":{"@type":{"enum":["VirtualLocation"],"type":"string"},"name":{"type":"string"},"url":{"format":"uri","type":"string"}},"required":["url"],"type":"object"}},"securitySchemes":{"apiKey":{"description":"API key for agent access","scheme":"bearer","type":"http"},"bearerAuth":{"bearerFormat":"JWT","description":"JWT token for admin access","scheme":"bearer","type":"http"},"cookieAuth":{"description":"Admin JWT token in HttpOnly cookie (used by same-origin SSE endpoints)","in":"cookie","name":"auth_token","type":"apiKey"},"devCookie":{"description":"Developer JWT token in HttpOnly cookie","in":"cookie","name":"dev_auth_token","type":"apiKey"},"devJWT":{"bearerFormat":"JWT","description":"Developer JWT token for API access","scheme":"bearer","type":"http"}}},"info":{"contact":{"email":"hello@togather.foundation","name":"SEL Team","url":"https://togather.foundation"},"description":"RESTful API for the Shared Events Library, a federated events commons \nenabling discovery, submission, and management of cultural events.\n\nUnknown paths under `/api/v1` return HTTP 404 with an\n`application/problem+json` response.\n\nThe developer quickstart at `/api/docs` includes anonymous REST and MCP\nexamples for this node. The interactive reference is at `/api/docs/reference`.\n\n## Getting an API Key\n\n**Public read access:** No authentication required for reading events, places, or organizations.\n\n**Browser (CORS) access:** `GET`/`HEAD` on the public read endpoints (`/api/v1/events`,\n`/api/v1/events/{id}`, `/api/v1/events/{id}/ics`, `/api/v1/events.ics`, `/api/v1/places`,\n`/api/v1/places/{id}`, `/api/v1/organizations`, `/api/v1/organizations/{id}`,\n`/api/v1/stats`, `/api/v1/openapi.json`, `/api/v1/openapi.yaml`) answer cross-origin requests from any origin, including `Origin: null`\nfrom `file://` pages, with `Access-Control-Allow-Origin: *` and no credentials header\n(configurable via `CORS_PUBLIC_READS_OPEN`, default `true`). Browser clients can read\n`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, and `Retry-After` on\nresponses allowed by this policy, including `429`. Admin, auth and write routes only\nallow origins listed in `CORS_ALLOWED_ORIGINS`.\n\n**Authenticated write access:** To submit or manage events, you need an API key.\n\n### Two Onboarding Paths\n\n#### Option 1: Self-Service via GitHub OAuth (Instant)\n\n1. Visit `/dev/login` and click \"Sign in with GitHub\"\n2. Authorize the app on GitHub\n3. Your developer account is automatically created\n4. Navigate to `/dev/api-keys` to create your first API key\n\n#### Option 2: Email Invitation (Email/Password)\n\n1. **Request an invitation:** Email [info@togather.foundation](mailto:info@togather.foundation) with:\n   - Your name\n   - Email address\n   - Intended use case\n\n2. **Accept invitation:**\n   - Check your email for the invitation link (valid for 7 days)\n   - Set your password and display name\n   - You'll be logged in to the developer dashboard at `/dev/login`\n\n3. **Create an API key:**\n   - Navigate to `/dev/api-keys`\n   - Click \"Create New Key\"\n   - Enter a descriptive name\n   - Copy the key immediately (shown only once)\n   - Store securely (environment variable or secret manager)\n\n### Using Your API Key\n\n**Via Web Interface:**\n1. Navigate to `/dev/api-keys`\n2. Click \"Create New Key\"\n3. Enter a descriptive name\n4. Copy the key immediately (shown only once)\n5. Store securely (environment variable or secret manager)\n\n**Via API:**\n```bash\n# First, get your JWT token (if using email/password)\ncurl -X POST https://toronto.togather.foundation/api/v1/dev/login \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"email\": \"your-email@example.com\", \"password\": \"your-password\"}'\n\n# Then create a key\ncurl -X POST https://toronto.togather.foundation/api/v1/dev/api-keys \\\n     -H \"Authorization: Bearer $YOUR_JWT_TOKEN\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"name\": \"My Event Scraper\"}'\n```\n\n### Making Authenticated Requests\n\n**Reading events (no auth):**\n```bash\ncurl https://toronto.togather.foundation/api/v1/events\n```\n\n**Submitting events (with API key):**\n```bash\ncurl -X POST https://toronto.togather.foundation/api/v1/events \\\n     -H \"Authorization: Bearer your_api_key_here\" \\\n     -H \"Content-Type: application/ld+json\" \\\n     -d @event.json\n```\n\n**For complete guidance**, see:\n- [Developer Quick Start](https://github.com/Togather-Foundation/server/blob/main/docs/integration/DEVELOPER_QUICKSTART.md) (4-step onboarding)\n- [Authentication Guide](https://github.com/Togather-Foundation/server/blob/main/docs/integration/AUTHENTICATION.md) (comprehensive auth docs)\n- [API Guide](https://github.com/Togather-Foundation/server/blob/main/docs/integration/API_GUIDE.md) (endpoint reference)\n\n## Authentication\n- **Public**: No authentication required for read endpoints\n- **Agents**: API key in `Authorization: Bearer \u003ckey\u003e` header\n- **Admins**: JWT token in `Authorization: Bearer \u003ctoken\u003e` header\n- **Developers**: JWT token in `dev_auth_token` cookie or `Authorization: Bearer \u003ctoken\u003e` header\n\n## Rate Limits\nThe REST server checks a shared token bucket per client IP before route authentication.\nThe bucket capacity and refill rate per minute are configurable via\n`RATE_LIMIT_PUBLIC` (default 60). A value of 0 disables the bucket. Route-local\ntiers, including the login tier (`RATE_LIMIT_LOGIN`, default 5), are set after this check.\n\nMetered REST responses carry `X-RateLimit-Limit` (bucket capacity),\n`X-RateLimit-Remaining` (whole tokens immediately available after this decision),\nand `X-RateLimit-Reset` (Unix seconds when the bucket would be full if no more\nrequests consume tokens, rounded up). Tokens refill continuously.\nOn a token bucket `429`, use `Retry-After` as the number of seconds to wait\nfor the next token. The response body uses `application/problem+json`.\nBrowser preflights and the `/healthz` and `/readyz` probes bypass the bucket.\n\nThe URL submission endpoint applies a separate limit configurable via\n`RATE_LIMIT_SUBMISSIONS_PER_IP_PER_24H` (default 20 URLs per 24 hours per IP).\n\n## Geographic Boundaries\nEvents outside the configured geographic scope may be filtered or flagged for review.\nBoundaries are loaded from a YAML file configurable via `GEOGRAPHIC_BOUNDARY_CONFIG_FILE`\n(default `configs/boundary.yaml`). The behaviour on out-of-boundary events is controlled\nby `GEOGRAPHIC_BOUNDARY_MODE` (default `reject`; set to `review` to route to review queue).\n\n## Content Negotiation\nAPI endpoints return JSON/JSON-LD via `Accept` header:\n- `application/ld+json` - JSON-LD (default)\n- `application/json` - JSON-LD (alias)\n- `text/calendar` - iCalendar format (supported for event endpoints)\n\n## Pagination\nList endpoints use cursor-based pagination with `after` and `limit` parameters.\nDefault limit is 50, maximum is 200.\n\n### Cursor Format\nCursors are opaque base64url-encoded strings (RFC 4648, URL-safe, no padding).\n- **Event cursors**: Encode timestamp + ULID for stable ordering\n- **Change feed cursors**: Encode sequence number for federation sync\n\n**Important**: Treat cursors as opaque strings. Use the `next_cursor` value from\nAPI responses as-is. Do not parse, decode, or modify cursor values.\n\nExample pagination:\n```\nGET /api/v1/events?limit=50\n-\u003e returns { items: [...], next_cursor: \"MTcwNjg4NjAwMD...\" }\n\nGET /api/v1/events?limit=50\u0026after=MTcwNjg4NjAwMD...\n-\u003e returns next page\n```\n","license":{"name":"CC0 1.0","url":"https://creativecommons.org/publicdomain/zero/1.0/"},"title":"Shared Events Library (SEL) API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/":{"get":{"description":"The node overview for developers and agents. HTML is the default;\nrequest `Accept: text/markdown` for the Markdown representation.\nAlso available via HEAD.\n","operationId":"getNodeHomepage","responses":{"200":{"content":{"text/html":{"schema":{"type":"string"}},"text/markdown":{"schema":{"type":"string"}}},"description":"Node overview","headers":{"Vary":{"schema":{"example":"Accept","type":"string"}}}}},"security":[],"summary":"Node homepage"}},"/.well-known/api-catalog":{"get":{"description":"Returns an RFC 9727 API catalog. The catalog lists the event collection as an API entry\npoint and links to both OpenAPI formats and the developer documentation. URLs use\nSERVER_BASE_URL (default http://localhost:8080).\n","operationId":"getApiCatalog","responses":{"200":{"content":{"application/linkset+json":{"schema":{"$ref":"#/components/schemas/ApiCatalog"}}},"description":"API catalog linkset with the RFC 9727 profile","headers":{"Link":{"description":"The canonical catalog location with the api-catalog relation.","schema":{"type":"string"}}}}},"security":[],"summary":"Discover the node's REST API","tags":["Health"]},"head":{"description":"Returns the same response headers as GET without a response body.","operationId":"headApiCatalog","responses":{"200":{"description":"API catalog metadata","headers":{"Link":{"description":"The canonical catalog location with the api-catalog relation.","schema":{"type":"string"}}}}},"security":[],"summary":"Get API catalog metadata","tags":["Health"]}},"/.well-known/sel-profile":{"get":{"description":"Returns this node's SEL profile information for federation discovery.\nRequired by SEL Interoperability Profile §1.7.\n","operationId":"getSELProfile","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"node":{"example":"https://toronto.togather.foundation","format":"uri","type":"string"},"profile":{"example":"https://togather.foundation/sel/profiles/v0.1","format":"uri","type":"string"},"timeZone":{"description":"The node's IANA civil timezone (e.g. America/Toronto) used to render\nevent times in local civil time (configurable via DEFAULT_TIMEZONE,\ndefault America/Toronto).\n","type":"string"},"updated":{"format":"date-time","type":"string"},"version":{"example":"0.1.0","type":"string"}},"required":["profile","version","node","updated"],"type":"object"}}},"description":"SEL profile information"}},"security":[],"summary":"SEL node profile discovery","tags":["Health"]}},"/api/docs":{"get":{"description":"Script-free REST and MCP examples and a link to the developer portal.\nHTML is the default; request `Accept: text/markdown` for Markdown.\nThe trailing slash variant and HEAD are also supported.\n","operationId":"getDeveloperQuickstart","responses":{"200":{"content":{"text/html":{"schema":{"type":"string"}},"text/markdown":{"schema":{"type":"string"}}},"description":"Developer quickstart","headers":{"Vary":{"schema":{"example":"Accept","type":"string"}}}}},"security":[],"summary":"Developer quickstart"}},"/api/docs.md":{"get":{"description":"The REST and MCP quickstart in Markdown. Also available via HEAD.","operationId":"getDeveloperQuickstartMarkdown","responses":{"200":{"content":{"text/markdown":{"schema":{"type":"string"}}},"description":"Markdown developer quickstart"}},"security":[],"summary":"Developer quickstart in Markdown"}},"/api/docs/reference":{"get":{"description":"Scalar API reference using the node's OpenAPI specification.\nThe `/api/docs/index.html` alias and HEAD are also supported.\n","operationId":"getInteractiveAPIReference","responses":{"200":{"content":{"text/html":{"schema":{"type":"string"}}},"description":"Interactive HTML reference"}},"security":[],"summary":"Interactive API reference"}},"/api/v1/accept-invitation":{"post":{"description":"Sets the password for an invited admin user and activates the account.\nPublic endpoint; rate limited by IP.\n","operationId":"acceptInvitation","requestBody":{"content":{"application/json":{"schema":{"properties":{"password":{"description":"Password satisfying the server's length/complexity policy.","format":"password","type":"string"},"token":{"description":"Invitation token from the invitation email.","type":"string"}},"required":["token","password"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponse"}}},"description":"Invitation accepted"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid/expired token or weak password"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Accept an admin user invitation","tags":["Auth"]}},"/api/v1/admin/api-keys":{"get":{"description":"Retrieve all API keys (without secrets). Requires admin authentication.","operationId":"listApiKeys","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ApiKeyInfo"},"type":"array"}},"type":"object"}}},"description":"List of API keys (without secrets)"}},"security":[{"bearerAuth":[]}],"summary":"List API keys","tags":["Admin"],"x-internal":true},"post":{"description":"Generate a new API key for agent authentication. Returns the API key secret only once. Requires admin authentication.","operationId":"createApiKey","requestBody":{"content":{"application/json":{"schema":{"properties":{"expires_in_days":{"description":"Number of days until the key expires. Omitted, `0`, or a\nnegative value means the key does not expire; admin keys are\nexpected to set it and the CLI enforces this.\n","type":"integer"},"federation_node_id":{"description":"Bind the key to a federation node. A bound key may submit\ninbound federation sync payloads minted by that node only;\nunbound keys are rejected by `POST /api/v1/federation/sync`\nwith `403`. The node must already exist.\n","format":"uuid","type":["string","null"]},"name":{"description":"Human-readable name for the key.","type":"string"},"rate_limit_tier":{"default":"agent","description":"Rate-limit tier for the key. Defaults to `agent` when omitted.","type":"string"},"role":{"default":"agent","description":"Key role. Defaults to `agent` when omitted.","enum":["agent","admin"],"type":"string"},"source_id":{"description":"Optional source UUID to associate with the key.","format":"uuid","type":["string","null"]}},"required":["name"],"type":"object"}}},"description":"API key name and optional metadata.","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}},"description":"API key created (secret shown once)"}},"security":[{"bearerAuth":[]}],"summary":"Create a new API key","tags":["Admin"],"x-internal":true}},"/api/v1/admin/api-keys/{id}":{"delete":{"description":"Deactivates an API key by UUID. Requires admin authentication.","operationId":"revokeApiKey","parameters":[{"description":"API key UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"API key revoked"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"Revoke an API key","tags":["Admin"],"x-internal":true}},"/api/v1/admin/developers":{"get":{"description":"Retrieve a list of all developers with their API key count and usage statistics","operationId":"listDevelopers","parameters":[{"description":"Filter by developer status","in":"query","name":"status","schema":{"enum":["active","invited","deactivated"],"type":"string"}},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Developer"},"type":"array"},"next_cursor":{"type":"string"}},"type":"object"}}},"description":"List of developers"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List all developers","tags":["Admin"],"x-internal":true}},"/api/v1/admin/developers/invite":{"post":{"description":"Send an invitation to a developer by email. The developer receives an email with a link to accept the invitation.","operationId":"inviteDeveloper","requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"description":"Developer's email address","format":"email","type":"string"},"max_keys":{"default":5,"description":"Maximum API keys this developer can create","maximum":20,"minimum":1,"type":"integer"},"name":{"description":"Optional developer name","type":"string"}},"required":["email"],"type":"object"}}},"description":"Developer invitation details","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"properties":{"email":{"type":"string"},"id":{"format":"uuid","type":"string"},"invitation_expires_at":{"format":"date-time","type":"string"},"status":{"enum":["invited"],"type":"string"}},"type":"object"}}},"description":"Invitation sent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Email already registered"}},"security":[{"bearerAuth":[]}],"summary":"Invite a developer","tags":["Admin"],"x-internal":true}},"/api/v1/admin/developers/{id}":{"delete":{"description":"Deactivate developer and revoke all their API keys","operationId":"deleteDeveloper","parameters":[{"description":"Developer UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"Developer deactivated"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Deactivate developer","tags":["Admin"],"x-internal":true},"get":{"description":"Retrieve details for a specific developer including their API keys","operationId":"getDeveloper","parameters":[{"description":"Developer UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Developer"},{"properties":{"api_keys":{"items":{"$ref":"#/components/schemas/DeveloperAPIKey"},"type":"array"}},"type":"object"}]}}},"description":"Developer details"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get developer details","tags":["Admin"],"x-internal":true},"put":{"description":"Update developer's max_keys or is_active status","operationId":"updateDeveloper","parameters":[{"description":"Developer UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"is_active":{"type":"boolean"},"max_keys":{"maximum":20,"minimum":1,"type":"integer"}},"type":"object"}}},"description":"Developer settings to update","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Developer"}}},"description":"Developer updated"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Update developer settings","tags":["Admin"],"x-internal":true}},"/api/v1/admin/duplicates":{"get":{"description":"Returns pairs of potentially duplicate events. Detection is not implemented yet; the endpoint currently returns an empty list.","operationId":"listDuplicatePairs","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"next_cursor":{"type":"string"}},"required":["items"],"type":"object"}}},"description":"Duplicate pairs (currently always empty)"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List potential duplicate events","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events":{"get":{"description":"Same filters as the public list endpoint, but returns every non-deleted\nlifecycle state and adds admin-only fields (`description`, `confidence`,\n`lifecycle_state`, `start_date`, `all_day`). Soft-deleted rows are never\nlisted. Proximity uses the event-specific `EVENTS_DEFAULT_RADIUS_KM`\n(default 10) and `EVENTS_MAX_RADIUS_KM` (default 100). Date and proximity\nmust match the same occurrence; matches remain chronological and use the\nexisting cursor. Occurrences without coordinates on their effective\nvenue are excluded.\n","operationId":"listAllEventsForAdmin","parameters":[{"$ref":"#/components/parameters/startDate"},{"$ref":"#/components/parameters/endDate"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/region"},{"$ref":"#/components/parameters/venueId"},{"$ref":"#/components/parameters/organizerId"},{"$ref":"#/components/parameters/lifecycleState"},{"$ref":"#/components/parameters/eventDomain"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/keywords"},{"$ref":"#/components/parameters/eventNearLat"},{"$ref":"#/components/parameters/eventNearLon"},{"$ref":"#/components/parameters/eventRadius"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminEventListResponse"}},"application/ld+json":{"schema":{"$ref":"#/components/schemas/AdminEventListResponse"}}},"description":"Paginated list of events"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/EventSearchTimeout"}},"security":[{"bearerAuth":[]}],"summary":"List all events (admin)","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/consolidate":{"post":{"description":"Consolidate N events into a single canonical event in one atomic operation.\nEither creates a new canonical event (`event`) or promotes an existing one\n(`event_ulid`). All events listed in `retire` are soft-deleted with tombstones.\nOpen review queue entries for retired events are dismissed automatically.\nIf a competing transaction retires a target between lookup and row lock,\nconsolidation rolls back and returns 503 with `Retry-After: 1`.\n\nPost-consolidation validation (duplicate detection, quality checks) runs on\nthe canonical event; results are returned in `warnings`, `is_duplicate`, and\n`needs_review`. Near-duplicate detection after consolidation uses a similarity\nthreshold configurable via DEDUP_NEAR_DUPLICATE_THRESHOLD (default 0.4).\n\nExactly one of the following must hold:\n- `event_ulid` only: promote an existing event as canonical with no field changes.\n- `event_ulid` + `event`: promote an existing event as canonical AND apply field\n  edits atomically inside the same transaction. Patchable fields: `name`,\n  `description`, `url`, `image`, `keywords`, `eventDomain`. Fields ignored on the\n  patch path: `startDate`, `endDate`, `doorTime`, `occurrences`, `source`,\n  `lifecycle_state`, and scraper-only hints.\n- `event` only: create a new canonical event (full ingest pipeline).\n\n`retire` is required and must contain at least one ULID. The canonical event's\nULID must not appear in the `retire` list.\n","operationId":"consolidateEvents","requestBody":{"content":{"application/json":{"schema":{"properties":{"event":{"$ref":"#/components/schemas/EventInput","description":"When `event_ulid` is absent: full event payload to create a new canonical event. When `event_ulid` is present: partial patch applied atomically to the promoted canonical event. Patchable fields: name, description, url, image, keywords, eventDomain. Occurrence-derived and ingest-only fields (startDate, endDate, occurrences, source, lifecycle_state) are ignored on the patch path.\n"},"event_ulid":{"description":"ULID of an existing event to promote as the canonical event. May be combined with `event` to apply field edits atomically.\n","type":"string"},"retire":{"description":"Event ULIDs to soft-delete with tombstones. All must exist and not already be deleted. Required, minimum 1 entry.\n","items":{"type":"string"},"minItems":1,"type":"array"},"transfer_occurrences":{"default":false,"description":"If true, occurrences are copied from each retired event to the canonical event before retirement. Returns 409 if any occurrence would overlap an existing one on the canonical. Default false (Merge Duplicate path — retire only, no occurrence transfer).\n","type":"boolean"}},"required":["retire"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsolidateResponse"}}},"description":"Consolidation succeeded"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid request. Possible reasons:\n- Neither `event` nor `event_ulid` was provided\n- `retire` list is empty or missing\n- Canonical event's ULID appears in `retire`\n"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Retire target or canonical event not found"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"An occurrence from a retired event overlaps an existing occurrence on\nthe canonical event (only when transfer_occurrences is true).\n"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Unprocessable request. Possible reasons:\n- One or more retire targets are already deleted\n- The canonical event has been deleted\n- Validation error in the provided event payload\n"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Atomically consolidate multiple events into one canonical event","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/pending":{"get":{"description":"Returns events flagged for admin review (low confidence, validation issues,\netc.). Supports the event proximity filters `near_lat`, `near_lon`, and\n`radius`; both finite coordinates are required when any is supplied.\nRadius is in kilometres, defaults to `EVENTS_DEFAULT_RADIUS_KM` (10),\nand is capped by `EVENTS_MAX_RADIUS_KM` (100). Date and proximity must\nmatch the same occurrence; results use the existing chronological order\nand cursor. Occurrences without coordinates on their effective venue do\nnot match.\n","operationId":"listPendingEvents","parameters":[{"$ref":"#/components/parameters/startDate"},{"$ref":"#/components/parameters/endDate"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/region"},{"$ref":"#/components/parameters/venueId"},{"$ref":"#/components/parameters/organizerId"},{"$ref":"#/components/parameters/eventDomain"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/keywords"},{"$ref":"#/components/parameters/eventNearLat"},{"$ref":"#/components/parameters/eventNearLon"},{"$ref":"#/components/parameters/eventRadius"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/EventListResponse"}}},"description":"Paginated list of pending events"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"503":{"$ref":"#/components/responses/EventSearchTimeout"}},"security":[{"bearerAuth":[]}],"summary":"List events awaiting review","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/series-candidates":{"get":{"description":"Read-only discovery surface for weekly programmes that a source published\nas N separate events instead of one event with N occurrences.\n\nA cluster is conservative by construction: every member is a published\nevent with a primary venue, at least one occurrence falls inside the\nrequested window (plus the one-day boundary allowance), and an edge\nrequires the same `events.primary_venue_id`, normalized names with\npg_trgm similarity `\u003e= 0.80`, the same ISO weekday, occurrence dates\nexactly 7 days apart, and local start times within 30 minutes. Edges are\ntransitive (connected components), so a cluster must contain at least\n`min_events` distinct events. The detector never groups on\n`event_occurrences.venue_id` (nullable).\n\nWindow boundaries are approximate by design: request dates are UTC while\noccurrence dates are venue-local, so the storage query widens each side by\none day. Consequently `first_date`, `last_date`, member\n`occurrence_count`/`start_date`, `occurrence_count`, and the canonical\n`next_date` signal are all scoped to the requested window (plus that\none-day boundary allowance), not the event's full lifetime. Canonical\nselection prefers the earliest upcoming in-window occurrence.\n\nTypical use is for sources that suppress `cross_week_series_companion`\nand therefore never create review rows. Inspect each cluster, then call\n`POST /api/v1/admin/events/consolidate` with `transfer_occurrences: true`\nto make it one event with N occurrences. This endpoint is read-only:\nit never writes events, occurrences, review entries, or suppression state.\n\nClusters are paged: `offset` skips clusters after the deterministic sort\n(event count descending, then first date, name, venue, canonical ULID)\nand before `limit` is applied. `total_clusters` is always the full count;\n`truncated` is true when `offset + len(items) \u003c total_clusters`.\n\n`source` scopes the scan to events attributed to one provenance source in\nthe `sources` table (not `scraper_sources`). The filter is enforced in SQL\nvia `event_sources`, so an event with no source attribution is excluded\nfrom a source-scoped run. A cluster that spans sources is narrowed to the\nrequested source's events: the other members are absent from the response\nand must not be retired by a scoped consolidation. Source names are labels;\ncanonical identity is the normalized feed URL. A name matching more than\none retained row is a 400; use the source UUID in that case. Renaming a\nfeed reuses its canonical row. Historical attributions on legacy rows stay\nthere until explicit source reconciliation, so a scoped run may not include\nthose events.\n\nEach cluster reports description evidence: `distinct_description_count`,\n`distinct_descriptions`, `described_member_count`,\n`descriptions_truncated`, and `content_varies`. Descriptions are compared\nby fingerprint after trimming leading/trailing whitespace, so\nspacing-only differences collapse; wording, punctuation, and case still\ncount. `distinct_descriptions` is deduped by fingerprint and carries at\nmost 600 characters per entry (independently capped prefixes can look\nidentical while remaining distinct entries); it is admin display\nevidence and must never be logged or persisted. `content_varies` is true\nwhen there are multiple distinct descriptions or only some members are\ndescribed. It means **investigate and decide**, never skip. Typically,\nlogistics and boilerplate differences (capacity notices such as \"N spots\nremaining\" or \"this event is full\", room or location suffixes,\nregistration phrasing, restated dates, punctuation, casing, whitespace)\nare safe to consolidate, while per-occurrence content (a named activity,\nfilm, guest, or topic per date) or titles that form a progression (Part N,\nSession N, I/II/III, Beginners/Advanced) are normally kept separate,\nbecause consolidation keeps only the canonical description and\noccurrences cannot carry per-date text. These are typical cases, not a\nveto: decide from the evidence and state the reason.\n","operationId":"listSeriesCandidates","parameters":[{"description":"Look-ahead window in days (default 90).","in":"query","name":"days","required":false,"schema":{"default":90,"maximum":365,"minimum":1,"type":"integer"}},{"description":"Include this many days of recent past occurrences (default 14).","in":"query","name":"lookback_days","required":false,"schema":{"default":14,"maximum":90,"minimum":0,"type":"integer"}},{"description":"Minimum distinct events per reported cluster (default 3).","in":"query","name":"min_events","required":false,"schema":{"default":3,"maximum":50,"minimum":2,"type":"integer"}},{"description":"Optional place ULID to restrict the scan to one venue.","in":"query","name":"venue_id","required":false,"schema":{"description":"Place ULID.","pattern":"^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$","type":"string"}},{"description":"Optional provenance source identifier, resolved against the `sources`\ntable (event attribution, not `scraper_sources`). Accepts an exact\nsource name (for example `tpl-events`) or a UUID (the actual\n`sources.id`). `sources` has no ULID column, so a ULID is not a valid\nsource identifier. Unknown or ambiguous values return 400. The filter\nis applied in SQL via `event_sources`, so only events attributed to\nthat source can form clusters and events without any attribution are\nexcluded. A cluster spanning sources is narrowed to the requested\nsource's events. An event attributed to two sources appears in both\nscopes, so a scoped consolidation can retire an event that also\ncarries another source's provenance; verify the member list.\n","in":"query","name":"source","required":false,"schema":{"type":"string"}},{"description":"Number of clusters to skip after the deterministic sort and before\n`limit` is applied (default 0). `total_clusters` remains the full\ncount and `truncated` is true when `offset + len(items) \u003c\ntotal_clusters`.\n","in":"query","name":"offset","required":false,"schema":{"default":0,"maximum":10000,"minimum":0,"type":"integer"}},{"description":"Maximum number of clusters returned (default 50).","in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":200,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeriesCandidatesResponse"}}},"description":"Series-candidate clusters, ordered by event count, first date, then name"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid query parameter (out-of-range integer, malformed venue ULID, or unknown/ambiguous source identifier)"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Series-candidate scan failed"}},"security":[{"bearerAuth":[]}],"summary":"Discover weekly programmes published as separate events","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/{id}":{"delete":{"description":"Soft delete - returns 410 Gone with tombstone thereafter if the event was publicly visible; events that were never public return 404","operationId":"deleteEvent","parameters":[{"$ref":"#/components/parameters/eventId"}],"responses":{"204":{"description":"Event deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Delete an event","tags":["Admin"],"x-internal":true},"put":{"description":"Admin endpoint to edit event details. Increments version and logs change.","operationId":"updateEvent","parameters":[{"$ref":"#/components/parameters/eventId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventUpdateInput"}}},"description":"Updated event data with version for optimistic locking","required":true},"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Event"}}},"description":"Event updated"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Version conflict (optimistic locking)"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Update an event","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/{id}/occurrences":{"post":{"description":"Create a new occurrence on an existing event. The event must not be deleted.\nReturns 409 if the new occurrence overlaps an existing occurrence on the event.\n","operationId":"createOccurrence","parameters":[{"$ref":"#/components/parameters/eventId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OccurrenceInput"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OccurrenceResponse"}}},"description":"Occurrence created"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Occurrence overlaps an existing occurrence"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has been deleted"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Validation error"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Add an occurrence to an event","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/{id}/occurrences/{occurrenceId}":{"delete":{"description":"Remove a single occurrence from an event. The last occurrence of an event\ncannot be deleted (returns 422); delete the event itself instead.\n","operationId":"deleteOccurrence","parameters":[{"$ref":"#/components/parameters/eventId"},{"description":"UUID of the occurrence to delete","in":"path","name":"occurrenceId","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"Occurrence deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has been deleted"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Cannot delete the last occurrence of an event"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Delete an occurrence from an event","tags":["Admin"],"x-internal":true},"put":{"description":"Update an existing occurrence. Supports partial updates via nullable fields.\nReturns 409 if the updated occurrence would overlap another occurrence on the event.\n","operationId":"updateOccurrence","parameters":[{"$ref":"#/components/parameters/eventId"},{"description":"UUID of the occurrence to update","in":"path","name":"occurrenceId","required":true,"schema":{"format":"uuid","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OccurrenceInput"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OccurrenceResponse"}}},"description":"Occurrence updated"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Occurrence overlaps an existing occurrence"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has been deleted"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Validation error"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Update an occurrence on an event","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/{id}/publish":{"post":{"operationId":"publishEvent","parameters":[{"$ref":"#/components/parameters/eventId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminEventResponse"}}},"description":"Published event"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Publish a draft event","tags":["Admin"],"x-internal":true}},"/api/v1/admin/events/{id}/unpublish":{"post":{"operationId":"unpublishEvent","parameters":[{"$ref":"#/components/parameters/eventId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminEventResponse"}}},"description":"Unpublished event"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Move a published event back to draft","tags":["Admin"],"x-internal":true}},"/api/v1/admin/federation/nodes":{"get":{"operationId":"listFederationNodes","parameters":[{"description":"Filter by federation status.","in":"query","name":"status","schema":{"type":"string"}},{"description":"Filter by whether sync is enabled.","in":"query","name":"sync_enabled","schema":{"type":"boolean"}},{"description":"Filter by last health-check result.","in":"query","name":"is_online","schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FederationNode"},"type":"array"}},"required":["items"],"type":"object"}}},"description":"Federation nodes"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List federation nodes","tags":["Federation"],"x-internal":true},"post":{"description":"Request fields use the server's Go field names (`NodeDomain`, `NodeName`, ...)\nbecause the underlying type has no JSON tags. Keys are matched case-insensitively.\n","operationId":"createFederationNode","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FederationNodeInput"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FederationNode"}}},"description":"Node created"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"A node with this domain already exists"}},"security":[{"bearerAuth":[]}],"summary":"Register a federation node","tags":["Federation"],"x-internal":true}},"/api/v1/admin/federation/nodes/{id}":{"delete":{"operationId":"deleteFederationNode","parameters":[{"$ref":"#/components/parameters/nodeId"}],"responses":{"204":{"description":"Node deleted"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Delete a federation node","tags":["Federation"],"x-internal":true},"get":{"operationId":"getFederationNode","parameters":[{"$ref":"#/components/parameters/nodeId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FederationNode"}}},"description":"Federation node"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get a federation node","tags":["Federation"],"x-internal":true},"put":{"operationId":"updateFederationNode","parameters":[{"$ref":"#/components/parameters/nodeId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FederationNodeUpdate"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FederationNode"}}},"description":"Updated node"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Update a federation node","tags":["Federation"],"x-internal":true}},"/api/v1/admin/geocoding/backfill":{"post":{"operationId":"startGeocodingBackfill","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackfillResponse"}}},"description":"Backfill enqueued"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Enqueue geocoding jobs for places and events missing coordinates","tags":["Admin","Geocoding"],"x-internal":true}},"/api/v1/admin/identity/conflicts":{"get":{"description":"Lists unordered pairs of entities that share an external identifier (a self-join\nof entity_identifiers on equal authority/URI). Pairs whose stored evidence\nfingerprint still matches the current shared signals are marked `suppressed` and\nexcluded by default; pass `include_suppressed=true` to include them with their\n`prior_decision`. The maximum `limit` is configurable via\n`IDENTITY_CONFLICT_LIMIT_MAX` (default 200).\n","operationId":"listIdentityConflicts","parameters":[{"description":"Entity type to scan for conflicts","in":"query","name":"type","required":true,"schema":{"enum":["place","organization"],"type":"string"}},{"description":"Include suppressed pairs with their prior_decision (default false)","in":"query","name":"include_suppressed","schema":{"default":false,"type":"boolean"}},{"description":"Opaque keyset cursor from a previous response's `next_cursor`","in":"query","name":"cursor","schema":{"type":"string"}},{"description":"Maximum results per page (default 50, max configurable via IDENTITY_CONFLICT_LIMIT_MAX, default 200)","in":"query","name":"limit","schema":{"default":50,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictsResponse"}}},"description":"Paginated list of identity conflicts"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List identity conflicts","tags":["Admin"],"x-internal":true}},"/api/v1/admin/identity/decisions":{"get":{"description":"Returns the append-only identity decisions feed, newest first. Optionally filter\nby entity type and an inclusive `since` RFC3339 lower bound on `created_at`. The\nmaximum `limit` is configurable via `IDENTITY_CONFLICT_LIMIT_MAX` (default 200).\n","operationId":"listIdentityDecisions","parameters":[{"description":"Filter by entity type","in":"query","name":"type","schema":{"enum":["place","organization"],"type":"string"}},{"description":"Inclusive RFC3339 lower bound on decision `created_at`","in":"query","name":"since","schema":{"format":"date-time","type":"string"}},{"description":"Opaque keyset cursor from a previous response's `next_cursor`","in":"query","name":"cursor","schema":{"type":"string"}},{"description":"Maximum results per page (default 50, max configurable via IDENTITY_CONFLICT_LIMIT_MAX, default 200)","in":"query","name":"limit","schema":{"default":50,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionsResponse"}}},"description":"Paginated list of identity decisions"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List identity decisions","tags":["Admin"],"x-internal":true}},"/api/v1/admin/identity/link":{"post":{"description":"Records/confirms an external identifier observation for one SEL entity and\nelects the primary, appending a `link` decision. The `actor` is taken from the\nadmin JWT subject, never the request body. Client-supplied `method`/`source` are\nrestricted to the Phase 1 allow-list (`manual`); anything else is normalised to\n`manual`. `confidence` is clamped to `[0,1]` and never affects the method rank.\n","operationId":"linkIdentifier","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityLinkRequest"}}},"description":"Link request","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRecord"}}},"description":"Link decision recorded"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Record an identifier link decision","tags":["Admin"],"x-internal":true}},"/api/v1/admin/identity/reject":{"post":{"description":"Records that two entities are judged distinct, appending a `reject` decision and\nsuppressing the pair unless its evidence fingerprint changes. The evidence\nfingerprint is computed server-side from current observations, not client-supplied.\nThe `actor` is taken from the admin JWT subject, never the request body.\n","operationId":"rejectIdentifier","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityRejectRequest"}}},"description":"Reject request","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRecord"}}},"description":"Reject decision recorded"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Record a reject decision","tags":["Admin"],"x-internal":true}},"/api/v1/admin/identity/{type}/{id}":{"get":{"description":"Returns an entity's identity state: its external identifiers, the primary\nidentifier per authority, and its link/reject decision history (newest first).\n","operationId":"getIdentityView","parameters":[{"description":"Entity type","in":"path","name":"type","required":true,"schema":{"enum":["place","organization"],"type":"string"}},{"description":"Entity ULID","in":"path","name":"id","required":true,"schema":{"pattern":"^[0-9A-HJKMNP-TV-Z]{26}$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityView"}}},"description":"Entity identity view"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get entity identity view","tags":["Admin"],"x-internal":true}},"/api/v1/admin/login":{"post":{"description":"Authenticate admin user and receive JWT token","operationId":"login","requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"format":"email","type":"string"},"password":{"format":"password","type":"string"}},"required":["email","password"],"type":"object"}}},"description":"Admin credentials (email and password) for authentication","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expiresAt":{"format":"date-time","type":"string"},"token":{"type":"string"}},"type":"object"}}},"description":"Login successful"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}},"summary":"Admin login","tags":["Admin"],"x-internal":true}},"/api/v1/admin/logout":{"post":{"description":"Clears the `auth_token` HttpOnly cookie. Idempotent; never fails on a missing session.","operationId":"adminLogout","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"status":{"const":"logged out","type":"string"}},"type":"object"}}},"description":"Logged out"}},"security":[],"summary":"Log out an admin session","tags":["Admin"],"x-internal":true}},"/api/v1/admin/organizations/merge":{"post":{"operationId":"mergeOrganizations","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeResult"}}},"description":"Merge result"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Merge a duplicate organization into a primary organization","tags":["Admin"],"x-internal":true}},"/api/v1/admin/organizations/{id}":{"delete":{"description":"Soft-deletes the organization and writes a tombstone.","operationId":"adminDeleteOrganization","parameters":[{"$ref":"#/components/parameters/organizationId"}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"reason":{"type":"string"}},"type":"object"}}},"required":false},"responses":{"204":{"description":"Organization deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Soft-delete an organization (admin)","tags":["Admin"],"x-internal":true},"get":{"operationId":"adminGetOrganization","parameters":[{"$ref":"#/components/parameters/organizationId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationResponse"}}},"description":"Organization details"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get an organization (admin)","tags":["Admin"],"x-internal":true},"put":{"operationId":"adminUpdateOrganization","parameters":[{"$ref":"#/components/parameters/organizationId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrganizationUpdate"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}},"description":"Updated organization (JSON-LD)"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Update an organization (admin)","tags":["Admin"],"x-internal":true}},"/api/v1/admin/organizations/{id}/similar":{"get":{"operationId":"findSimilarOrganizations","parameters":[{"$ref":"#/components/parameters/organizationId"}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SimilarityCandidate"},"type":"array"}}},"description":"Similar organizations"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Find similar organizations","tags":["Admin"],"x-internal":true}},"/api/v1/admin/places/merge":{"post":{"operationId":"mergePlaces","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeResult"}}},"description":"Merge result"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Merge a duplicate place into a primary place","tags":["Admin"],"x-internal":true}},"/api/v1/admin/places/{id}":{"delete":{"description":"Soft-deletes the place and writes a tombstone.","operationId":"adminDeletePlace","parameters":[{"$ref":"#/components/parameters/placeId"}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"reason":{"description":"Audit reason recorded on the tombstone.","type":"string"}},"type":"object"}}},"required":false},"responses":{"204":{"description":"Place deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Soft-delete a place (admin)","tags":["Admin"],"x-internal":true},"get":{"operationId":"adminGetPlace","parameters":[{"$ref":"#/components/parameters/placeId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPlaceResponse"}}},"description":"Place details"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get a place (admin)","tags":["Admin"],"x-internal":true},"put":{"operationId":"adminUpdatePlace","parameters":[{"$ref":"#/components/parameters/placeId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPlaceUpdate"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Place"}}},"description":"Updated place (JSON-LD)"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Update a place (admin)","tags":["Admin"],"x-internal":true}},"/api/v1/admin/places/{id}/similar":{"get":{"description":"Returns candidate matches (name/location similarity ≥ 0.3), excluding the place itself.","operationId":"findSimilarPlaces","parameters":[{"$ref":"#/components/parameters/placeId"}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SimilarityCandidate"},"type":"array"}}},"description":"Similar places"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Find similar places","tags":["Admin"],"x-internal":true}},"/api/v1/admin/reports/daily-usage":{"get":{"description":"Returns API-key usage statistics for a date range, summarizing request and error\ncounts aggregated by API key and client IP. Owner-associated traffic is excluded\nvia the DAILY_REPORT_EXCLUDE_IPS env var (configurable via DAILY_REPORT_EXCLUDE_IPS, default empty)\nor the optional exclude_ips query parameter. Only data recorded since the\ndeployment of per-IP tracking (api_key_usage_ips table) is included; this\nreport is forward-looking. Error classes count HTTP 400–499 as client errors\n(including 429), and 500–599 as server errors. Historical error totals cannot\nbe classified retroactively, so class totals can be lower than total errors.\nPer-key top_ips applies the same exclusions and top limit as the global list.\n","operationId":"getDailyUsageReport","parameters":[{"description":"Start date (YYYY-MM-DD). Defaults to today in the configured timezone.","in":"query","name":"from","schema":{"format":"date","type":"string"}},{"description":"End date (YYYY-MM-DD). Defaults to `from`.","in":"query","name":"to","schema":{"format":"date","type":"string"}},{"description":"Number of top keys and IPs to return.","in":"query","name":"top","schema":{"default":3,"maximum":20,"minimum":1,"type":"integer"}},{"description":"Comma-separated list of IPs to exclude. Overrides the DAILY_REPORT_EXCLUDE_IPS env var.","in":"query","name":"exclude_ips","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"daily":{"items":{"properties":{"date":{"format":"date","type":"string"},"errors":{"format":"int64","type":"integer"},"requests":{"format":"int64","type":"integer"}},"type":"object"},"type":"array"},"distribution":{"properties":{"requests_per_key_avg":{"type":"number"},"requests_per_key_median":{"format":"int64","type":"integer"}},"type":"object"},"from":{"format":"date","type":"string"},"to":{"format":"date","type":"string"},"top_ips":{"items":{"properties":{"ip":{"type":"string"},"requests":{"format":"int64","type":"integer"}},"type":"object"},"type":"array"},"top_keys":{"items":{"properties":{"developer_email":{"type":"string"},"developer_name":{"type":"string"},"errors":{"format":"int64","type":"integer"},"errors_by_class":{"properties":{"client":{"format":"int64","type":"integer"},"server":{"format":"int64","type":"integer"}},"type":"object"},"key_name":{"type":"string"},"key_prefix":{"type":"string"},"requests":{"format":"int64","type":"integer"},"top_ips":{"items":{"properties":{"ip":{"type":"string"},"requests":{"format":"int64","type":"integer"}},"type":"object"},"type":"array"}},"type":"object"},"type":"array"},"totals":{"properties":{"active_api_keys":{"type":"integer"},"active_developers":{"type":"integer"},"error_rate_pct":{"type":"number"},"errors":{"format":"int64","type":"integer"},"errors_by_class":{"properties":{"client":{"format":"int64","type":"integer"},"server":{"format":"int64","type":"integer"}},"type":"object"},"requests":{"format":"int64","type":"integer"}},"type":"object"},"trouble":{"properties":{"flag":{"type":["string","null"]},"top_error_keys":{"items":{"properties":{"developer_email":{"type":"string"},"developer_name":{"type":"string"},"errors":{"format":"int64","type":"integer"},"errors_by_class":{"properties":{"client":{"format":"int64","type":"integer"},"server":{"format":"int64","type":"integer"}},"type":"object"},"key_name":{"type":"string"},"key_prefix":{"type":"string"},"requests":{"format":"int64","type":"integer"},"top_ips":{"items":{"properties":{"ip":{"type":"string"},"requests":{"format":"int64","type":"integer"}},"type":"object"},"type":"array"}},"type":"object"},"type":"array"}},"type":"object"}},"type":"object"}}},"description":"Daily usage report"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"Daily usage report","tags":["Admin"]}},"/api/v1/admin/review-queue":{"get":{"description":"Returns events awaiting admin review due to validation warnings or normalization changes.\nSupports filtering by status and pagination.\n","operationId":"listReviewQueue","parameters":[{"description":"Filter by review status (defaults to 'pending')","in":"query","name":"status","schema":{"default":"pending","enum":["pending","approved","rejected","merged","dismissed"],"type":"string"}},{"description":"Pagination cursor (review queue entry ID)","in":"query","name":"cursor","schema":{"type":"string"}},{"description":"Maximum results per page (default 50, max 100)","in":"query","name":"limit","schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewQueueListResponse"}}},"description":"Paginated list of review queue entries"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List review queue entries","tags":["Admin"],"x-internal":true}},"/api/v1/admin/review-queue/{id}":{"get":{"description":"Retrieve detailed information for a specific review queue entry, including\noriginal payload, normalized payload, detected changes, and validation warnings.\n","operationId":"getReviewQueueEntry","parameters":[{"description":"Review queue entry ID","in":"path","name":"id","required":true,"schema":{"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewQueueDetail"}}},"description":"Review queue entry details"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get review queue entry details","tags":["Admin"],"x-internal":true}},"/api/v1/admin/review-queue/{id}/approve":{"post":{"description":"Approve an event in the review queue and publish it. The event's lifecycle\nstate will be updated to 'published' and it will appear in public listings.\n\nSet `record_not_duplicates: true` to implement the \"Not a Duplicate\" action:\nthe event is published and the duplicate-warning candidates are recorded as a\nconfirmed non-duplicate pair, suppressing re-flagging on future ingest.\nThis differs from a plain approve only in the side-effect on the\n`not_duplicates` table; the event transition is identical.\n","operationId":"approveReviewQueueEntry","parameters":[{"description":"Review queue entry ID","in":"path","name":"id","required":true,"schema":{"minimum":1,"type":"integer"}}],"requestBody":{"content":{"application/json":{"examples":{"notADuplicate":{"summary":"Approve as not-a-duplicate (suppresses future duplicate warnings)","value":{"notes":"Different event, same venue","record_not_duplicates":true}},"withNotes":{"summary":"Approval with notes","value":{"notes":"Date corrections look good, publishing"}},"withoutNotes":{"summary":"Simple approval","value":{}}},"schema":{"properties":{"notes":{"description":"Optional review notes","type":"string"},"record_not_duplicates":{"description":"When `true`, any `potential_duplicate` warning candidates in this\nreview entry are recorded as confirmed non-duplicates. Future ingest\nof events that match these pairs will not generate duplicate warnings.\nUsed by the \"Not a Duplicate\" UI action, which approves/publishes the\nevent while acknowledging that the duplicate flag was incorrect.\nMatched companion pending reviews are rechecked best-effort after the\nduplicate warnings are removed: if no issues remain they are\nauto-approved, otherwise they stay pending with refreshed warnings.\n","type":"boolean"}},"type":"object"}}},"description":"Optional review notes for approval","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewQueueDetail"}}},"description":"Review approved and event published"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Review entry has already been processed"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has been deleted"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Approve a review queue entry","tags":["Admin"],"x-internal":true}},"/api/v1/admin/review-queue/{id}/fix":{"post":{"description":"Apply date corrections to an event and approve it for publication.\nThis endpoint is intended for fixing date-related issues detected during normalization.\n\nNote: Currently this endpoint only marks the review as approved with correction notes.\nFull date correction implementation is tracked in srv-trg.\n","operationId":"fixReviewQueueEntry","parameters":[{"description":"Review queue entry ID","in":"path","name":"id","required":true,"schema":{"minimum":1,"type":"integer"}}],"requestBody":{"content":{"application/json":{"examples":{"fixBothDates":{"summary":"Fix both dates","value":{"corrections":{"endDate":"2026-03-15T22:00:00Z","startDate":"2026-03-15T19:00:00Z"},"notes":"Corrected timezone offset"}},"fixEndDate":{"summary":"Fix reversed end date","value":{"corrections":{"endDate":"2026-03-15T22:00:00Z"},"notes":"Added 24 hours to fix reversed dates"}}},"schema":{"properties":{"corrections":{"description":"Date corrections to apply","properties":{"endDate":{"description":"Corrected end date","format":"date-time","type":"string"},"startDate":{"description":"Corrected start date","format":"date-time","type":"string"}},"type":"object"},"notes":{"description":"Optional notes about the corrections","type":"string"}},"required":["corrections"],"type":"object"}}},"description":"Date corrections to apply to the event (startDate and/or endDate)","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewQueueDetail"}}},"description":"Dates corrected and review approved"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Review entry has already been processed"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has been deleted"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Fix event dates and approve","tags":["Admin"],"x-internal":true}},"/api/v1/admin/review-queue/{id}/reject":{"post":{"description":"Reject an event in the review queue and mark it as deleted. The event will\nnot appear in public listings. A rejected submission was never publicly\nvisible, so anonymous reads return `404 Not Found` (no tombstone is served);\n`410 Gone` is reserved for events that were public before deletion.\n","operationId":"rejectReviewQueueEntry","parameters":[{"description":"Review queue entry ID","in":"path","name":"id","required":true,"schema":{"minimum":1,"type":"integer"}}],"requestBody":{"content":{"application/json":{"examples":{"invalidDates":{"summary":"Reject due to invalid dates","value":{"reason":"Event dates are in the past and cannot be corrected"}},"spam":{"summary":"Reject spam event","value":{"reason":"Spam submission - not a legitimate event"}}},"schema":{"properties":{"reason":{"description":"Required rejection reason","type":"string"}},"required":["reason"],"type":"object"}}},"description":"Rejection reason (required) explaining why the event was rejected","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewQueueDetail"}}},"description":"Review rejected and event deleted"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Review entry has already been processed"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event has already been deleted"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"bearerAuth":[]}],"summary":"Reject a review queue entry","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/config":{"get":{"description":"Returns the current global scraper configuration including concurrency limits,\ntimeouts, retry settings, and rate limiting. If no config exists in the database,\nreturns sensible defaults.\n","operationId":"getScraperConfig","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScraperConfig"}}},"description":"Current scraper configuration"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Get global scraper configuration","tags":["Admin"],"x-internal":true},"patch":{"description":"Updates the global scraper configuration with partial JSON. Only provided fields\nare applied over the current config. All numeric fields must be greater than 0\n(except rate_limit_ms which can be 0).\n\nValidation rules:\n- max_concurrent_sources: must be \u003e 0\n- request_timeout_seconds: must be \u003e 0\n- retry_max_attempts: must be \u003e 0\n- max_batch_size: must be \u003e 0\n- rate_limit_ms: must be \u003e= 0\n","operationId":"patchScraperConfig","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScraperConfigPatch"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScraperConfig"}}},"description":"Updated scraper configuration"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Validation error"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Update global scraper configuration","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/diagnostics":{"get":{"description":"Returns recent scraper runs across all sources with optional filters.\nUseful for troubleshooting failures across multiple sources at once.\n\nQuery parameters:\n- `limit`: Number of runs to return (1–100, default 20)\n- `status`: Filter by run status (failed, completed, running)\n- `source_name`: Filter by specific source name\n","operationId":"getAllDiagnostics","parameters":[{"description":"Number of runs to return (1–100, default 20)","in":"query","name":"limit","schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}},{"description":"Filter by run status","in":"query","name":"status","schema":{"enum":["failed","completed","running"],"type":"string"}},{"description":"Filter by source name","in":"query","name":"source_name","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllDiagnostics"}}},"description":"Filtered list of recent scraper runs"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Get cross-source scraper diagnostics","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/events":{"get":{"description":"Server-Sent Events stream of River job lifecycle events for scraper jobs.\nClients receive events when scrape_source jobs complete, fail, or are cancelled.\nMaintains a keepalive comment every 15 seconds to prevent proxy timeouts.\nProtected by admin cookie auth (same-origin EventSource sends cookies automatically).\n","operationId":"streamScraperEvents","responses":{"200":{"content":{"text/event-stream":{"schema":{"description":"Newline-delimited SSE stream. Each event has the form:\n  id: \u003cjob_id\u003e\n  data: {\"kind\":\"job_completed\",\"job_kind\":\"scrape_source\",\"source_name\":\"\u003cname\u003e\",\"job_id\":\u003cid\u003e}\n\nKeepalive comments (`: keepalive`) are sent every 15 seconds.\nA `retry: 5000` directive is sent on connection.\n","type":"string"}}},"description":"SSE stream of scraper job events"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Streaming not supported"}},"security":[{"cookieAuth":[]}],"summary":"Stream scraper job events","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/sources":{"get":{"description":"Returns all scraper sources with their latest run summary (status, counts,\nerror message). Supports optional filtering by enabled state.\n","operationId":"listScraperSources","parameters":[{"description":"Filter by enabled state. Omit to return all sources.","in":"query","name":"enabled","schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ScraperSourceSummary"},"type":"array"}},"type":"object"}}},"description":"List of scraper sources"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"List scraper sources","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/sources/{name}":{"patch":{"description":"Enables or disables the named scraper source. Returns the updated source.\n","operationId":"setScraperSourceEnabled","parameters":[{"description":"Scraper source name","in":"path","name":"name","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScraperSourceSummary"}}},"description":"Updated scraper source"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Enable or disable a scraper source","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/sources/{name}/diagnostics":{"get":{"description":"Returns the latest run, last successful run (for comparison when latest failed),\nand a configurable list of recent runs for the named scraper source.\n\nSmart default behavior:\n- Always includes the latest run\n- When the latest run failed, includes the last successful run for comparison\n- Returns empty response (200) if the source has no runs yet\n\nQuery parameters:\n- `limit`: Number of recent runs to return (1–100, default 10)\n","operationId":"getSourceDiagnostics","parameters":[{"description":"Scraper source name","in":"path","name":"name","required":true,"schema":{"type":"string"}},{"description":"Number of recent runs to return (1–100, default 10)","in":"query","name":"limit","schema":{"default":10,"maximum":100,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceDiagnostics"}}},"description":"Source diagnostics with latest run, last success, and recent runs"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Get diagnostics for a scraper source","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/sources/{name}/runs":{"get":{"description":"Returns the most recent runs for the named scraper source (up to 50).\n","operationId":"listScraperSourceRuns","parameters":[{"description":"Scraper source name","in":"path","name":"name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ScraperRunDetail"},"type":"array"}},"type":"object"}}},"description":"List of scraper runs"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"List run history for a scraper source","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/sources/{name}/trigger":{"post":{"description":"Dispatches a background scrape for the named source and returns 202\nimmediately. Returns 503 if this node has no scraper configured, and 404\nif the source name is unknown.\n","operationId":"triggerScraperSource","parameters":[{"description":"Scraper source name","in":"path","name":"name","required":true,"schema":{"type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"source_name":{"type":"string"},"status":{"example":"triggered","type":"string"}},"type":"object"}}},"description":"Scrape triggered"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Scraper not configured on this node"}},"security":[{"bearerAuth":[]}],"summary":"Trigger an immediate scrape for a source","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/submissions":{"get":{"description":"Returns a paginated list of URL submissions. Optionally filter by status.\nUseful for the admin review queue.\n","operationId":"listScraperSubmissions","parameters":[{"description":"Filter by submission status. One of: `pending_validation`, `pending`,\n`processed`, `rejected`.\n","in":"query","name":"status","schema":{"enum":["pending_validation","pending","processed","rejected"],"type":"string"}},{"description":"Maximum number of results (1–200, default 50).","in":"query","name":"limit","schema":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},{"description":"Number of results to skip (default 0).","in":"query","name":"offset","schema":{"default":0,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"submissions":{"items":{"$ref":"#/components/schemas/Submission"},"type":"array"},"total":{"description":"Total number of submissions matching the filter","type":"integer"}},"type":"object"}}},"description":"Paginated list of submissions"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"List URL submissions","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/submissions/{id}":{"patch":{"description":"Marks a submission as `processed` (accepted for scraping) or `rejected`,\noptionally adding admin notes. Only submissions with status `pending` may\nbe reviewed.\n","operationId":"updateScraperSubmission","parameters":[{"in":"path","name":"id","required":true,"schema":{"format":"int64","type":"integer"}}],"requestBody":{"content":{"application/json":{"example":{"notes":"Good source — add to weekly scrape rotation","status":"processed"},"schema":{"properties":{"notes":{"description":"Optional admin notes","type":["string","null"]},"status":{"description":"New status for the submission","enum":["processed","rejected"],"type":"string"}},"required":["status"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Submission"}}},"description":"Updated submission"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"bearerAuth":[]}],"summary":"Review a URL submission","tags":["Admin"],"x-internal":true}},"/api/v1/admin/scraper/trigger-all":{"post":{"description":"Queues an orchestrator job that serially scrapes all enabled sources with\ndaily or weekly schedules. Returns immediately with 202 after queuing.\n\nSerial chaining timeout behavior is configurable via:\n- `SCRAPER_SOURCE_JOB_TIMEOUT_SECONDS` (default 300)\n- `SCRAPER_CHAIN_ENQUEUE_TIMEOUT_MS` (default 5000)\n- `SCRAPER_CHAIN_ENQUEUE_RETRIES` (default 3)\n\nPast-event filtering is configurable via\n`SCRAPER_PAST_EVENT_GRACE_HOURS` (default 0): events that ended within\nthis many hours are still ingested, and 0 skips every already-ended\nevent.\n\nOptions:\n- `respect_auto_scrape` (default: true): If true and global auto_scrape is disabled, skip the run\n- `skip_up_to_date` (default: true): Skip sources with fresh runs (daily \u003c24h, weekly \u003c7d)\n","operationId":"triggerAllScraperSources","requestBody":{"content":{"application/json":{"schema":{"properties":{"respect_auto_scrape":{"default":true,"type":"boolean"},"skip_up_to_date":{"default":true,"type":"boolean"}},"type":"object"}}},"required":false},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"respect_auto_scrape":{"type":"boolean"},"skip_up_to_date":{"type":"boolean"},"status":{"example":"skipped","type":"string"}},"type":"object"}}},"description":"Run skipped (auto_scrape disabled and respect_auto_scrape=true)"},"202":{"content":{"application/json":{"schema":{"properties":{"orchestrator_job_id":{"type":"integer"},"respect_auto_scrape":{"type":"boolean"},"skip_up_to_date":{"type":"boolean"},"status":{"example":"triggered","type":"string"}},"type":"object"}}},"description":"Orchestrator job queued"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"content":{"application/json":{"schema":{"properties":{"respect_auto_scrape":{"type":"boolean"},"running_sources":{"minimum":1,"type":"integer"},"skip_up_to_date":{"type":"boolean"},"status":{"example":"already_running","type":"string"}},"type":"object"}}},"description":"Run already in progress; overlapping run-all is blocked"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Job queue not available or orchestrator not configured.\nThis can occur if:\n- The River job queue is unavailable on this node\n- The scraper orchestrator dependencies are not wired (e.g., River not initialized)\nCheck that the server is configured with `RIVER_ENABLED=true` and the database\nschema includes River tables.\n"}},"security":[{"bearerAuth":[]}],"summary":"Trigger a serial scrape run for all eligible sources","tags":["Admin"],"x-internal":true}},"/api/v1/admin/stats":{"get":{"operationId":"getAdminStats","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"pending_count":{"format":"int64","type":"integer"},"published_count":{"format":"int64","type":"integer"},"total_count":{"format":"int64","type":"integer"}},"required":["pending_count","published_count","total_count"],"type":"object"}}},"description":"Event counts"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"Get event counts for the admin dashboard","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users":{"get":{"operationId":"listUsers","parameters":[{"description":"Filter by derived status.","in":"query","name":"status","schema":{"enum":["active","inactive","pending"],"type":"string"}},{"description":"Filter by role.","in":"query","name":"role","schema":{"enum":["admin","editor","viewer"],"type":"string"}},{"description":"Results per page (1-100).","in":"query","name":"limit","schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"description":"Zero-based result offset.","in":"query","name":"offset","schema":{"default":0,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserListResponse"}}},"description":"Paginated users"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"bearerAuth":[]}],"summary":"List admin users","tags":["Admin"],"x-internal":true},"post":{"operationId":"createUser","requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"format":"email","type":"string"},"role":{"default":"viewer","enum":["admin","editor","viewer"],"type":"string"},"username":{"type":"string"}},"required":["username","email"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserResponse"}}},"description":"User created"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Username or email already exists"}},"security":[{"bearerAuth":[]}],"summary":"Create an admin user and send an invitation","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users/{id}":{"delete":{"operationId":"deleteUser","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"204":{"description":"User deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Soft-delete an admin user","tags":["Admin"],"x-internal":true},"get":{"operationId":"getUser","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserResponse"}}},"description":"User details"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get an admin user","tags":["Admin"],"x-internal":true},"put":{"operationId":"updateUser","parameters":[{"$ref":"#/components/parameters/userId"}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"format":"email","type":"string"},"role":{"enum":["admin","editor","viewer"],"type":"string"},"username":{"type":"string"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserResponse"}}},"description":"Updated user"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Update an admin user","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users/{id}/activate":{"post":{"operationId":"activateUser","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}},"description":"Activation result"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Activate an admin user","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users/{id}/activity":{"get":{"description":"Audit storage is not implemented yet; the endpoint returns an empty page with an explanatory message.","operationId":"getUserActivity","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"message":{"type":"string"},"next_cursor":{"type":["string","null"]}},"type":"object"}}},"description":"Activity page (currently empty)"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Get a user's audit activity","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users/{id}/deactivate":{"post":{"operationId":"deactivateUser","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}},"description":"Deactivation result"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Deactivate an admin user","tags":["Admin"],"x-internal":true}},"/api/v1/admin/users/{id}/resend-invitation":{"post":{"operationId":"resendUserInvitation","parameters":[{"$ref":"#/components/parameters/userId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}},"description":"Invitation resent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"bearerAuth":[]}],"summary":"Resend an invitation email","tags":["Admin"],"x-internal":true}},"/api/v1/auth/token":{"post":{"description":"Exchange an admin-role API key for a short-lived JWT token. The JWT lifetime is configurable via AUTH_TOKEN_EXCHANGE_EXPIRY_MINUTES (default 60). The global IP rate limit applies before authentication.\n","operationId":"exchangeApiKey","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"expires_at":{"description":"UTC timestamp when the token expires (RFC3339)","format":"date-time","type":"string"},"token":{"description":"Short-lived JWT token for admin API access","type":"string"}},"type":"object"}}},"description":"Token exchange successful"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[{"apiKey":[]}],"summary":"Exchange admin API key for JWT token","tags":["Auth"]}},"/api/v1/batch-status/{id}":{"get":{"description":"Retrieve the status and results of a batch event submission. Returns 404 if\nthe batch is still processing or doesn't exist.\n\nWhen the node has the boundary geocoder fallback enabled\n(`GEOCODING_BOUNDARY_FALLBACK_ENABLED`, default `false`), ingest may ask\nthe geocoder to place events whose offline location parse falls outside\nthe geographic boundary. A result that was looked up may then carry\n`location_resolution`, and the response adds `location_resolved`,\n`location_unresolved` and `location_skipped` counts. Work is bounded per\nbatch by `GEOCODING_BOUNDARY_FALLBACK_MAX_LOOKUPS_PER_BATCH` (default\n`5`) and `GEOCODING_BOUNDARY_FALLBACK_BUDGET_MS` (default half of\n`SCRAPER_POLL_TIMEOUT_MS`, i.e. `15000`); events beyond the budget keep\ntheir offline decision and are counted as skipped. A resolution that\ncontradicts supplied evidence is rejected; the coordinate-agreement\ntolerance is `GEOCODING_BOUNDARY_CONFLICT_RADIUS_KM` (default `50`).\nWith the fallback disabled the response shape is unchanged.\n","operationId":"getBatchStatus","parameters":[{"description":"Batch ID returned from batch submission","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"@context":{"type":"string"},"@type":{"enum":["BatchSubmissionResult"],"type":"string"},"batch_id":{"type":"string"},"completed_at":{"format":"date-time","type":"string"},"created":{"description":"Number of events successfully created","type":"integer"},"duplicates":{"description":"Number of duplicate events detected","type":"integer"},"failed":{"description":"Number of events that failed validation/processing","type":"integer"},"location_resolved":{"description":"Number of events the boundary geocoder placed inside the\nboundary. Present only when at least one result carries\n`location_resolution`, i.e. when the node runs with\n`GEOCODING_BOUNDARY_FALLBACK_ENABLED` (default `false`).\n","type":"integer"},"location_skipped":{"description":"Number of events not looked up because the per-batch budget\n(`GEOCODING_BOUNDARY_FALLBACK_MAX_LOOKUPS_PER_BATCH`,\ndefault `5`) or time window\n(`GEOCODING_BOUNDARY_FALLBACK_BUDGET_MS`, default half of\n`SCRAPER_POLL_TIMEOUT_MS`) was exhausted. Present only\nwhen the fallback was used.\n","type":"integer"},"location_unresolved":{"description":"Number of boundary lookups that ran but did not produce an\naccepted location. Present only when the fallback was used.\n","type":"integer"},"results":{"items":{"properties":{"error":{"description":"Error message (if failed)","type":"string"},"event_id":{"description":"ULID of created/duplicate event (if successful)","type":"string"},"index":{"description":"Index of event in original batch array","type":"integer"},"location_resolution":{"description":"Boundary geocoder outcome for this event. Absent when\nthe fallback did not run for it (including every\nevent on a node with\n`GEOCODING_BOUNDARY_FALLBACK_ENABLED` unset or\n`false`). `resolved` = placed inside the boundary;\n`unresolved` = looked up but not accepted;\n`skipped` = not looked up because the per-batch\nbudget was exhausted.\n","enum":["resolved","unresolved","skipped"],"type":"string"},"status":{"enum":["created","failed","duplicate"],"type":"string"}},"type":"object"},"type":"array"},"status":{"enum":["completed"],"type":"string"},"total":{"description":"Total number of events processed","type":"integer"}},"type":"object"}}},"description":"Batch processing completed"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Batch not found or still processing"},"410":{"$ref":"#/components/responses/Gone"}},"security":[],"summary":"Get batch processing status","tags":["Events"]}},"/api/v1/dev/accept-invitation":{"post":{"description":"Accept an invitation by token and set up developer account with password","operationId":"acceptDeveloperInvitation","requestBody":{"content":{"application/json":{"schema":{"properties":{"name":{"description":"Developer's full name","maxLength":100,"minLength":1,"type":"string"},"password":{"description":"Password for future logins (configurable via DEVELOPER_PASSWORD_MIN_LENGTH, default 8)","format":"password","minLength":8,"type":"string"},"token":{"description":"Invitation token from email","type":"string"}},"required":["token","name","password"],"type":"object"}}},"description":"Invitation acceptance details","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"developer":{"properties":{"email":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"type":"object"},"token":{"description":"JWT token for immediate access","type":"string"}},"type":"object"}}},"description":"Invitation accepted, developer account created"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid token or weak password"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invitation expired or already used"}},"security":[],"summary":"Accept developer invitation","tags":["Developer"]}},"/api/v1/dev/api-keys":{"get":{"description":"Retrieve all API keys belonging to the authenticated developer with usage summary","operationId":"listDeveloperApiKeys","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DeveloperAPIKey"},"type":"array"},"key_count":{"description":"Current number of keys","type":"integer"},"max_keys":{"description":"Maximum keys allowed for this developer","type":"integer"}},"type":"object"}}},"description":"List of API keys"},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"devCookie":[]},{"devJWT":[]}],"summary":"List own API keys","tags":["Developer"]},"post":{"description":"Create a new API key for the authenticated developer. Enforces max_keys limit.","operationId":"createDeveloperApiKey","requestBody":{"content":{"application/json":{"schema":{"properties":{"name":{"description":"Human-readable name for the key","maxLength":100,"minLength":1,"type":"string"}},"required":["name"],"type":"object"}}},"description":"API key details","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperAPIKeyCreated"}}},"description":"API key created"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Max keys exceeded"}},"security":[{"devCookie":[]},{"devJWT":[]}],"summary":"Create a new API key","tags":["Developer"]}},"/api/v1/dev/api-keys/{id}":{"delete":{"description":"Revoke an API key belonging to the authenticated developer","operationId":"revokeDeveloperApiKey","parameters":[{"description":"API key UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}}],"responses":{"204":{"description":"API key revoked"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Key not owned by developer"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"devCookie":[]},{"devJWT":[]}],"summary":"Revoke own API key","tags":["Developer"]}},"/api/v1/dev/api-keys/{id}/usage":{"get":{"description":"Retrieve usage statistics for a specific API key with daily breakdown","operationId":"getDeveloperApiKeyUsage","parameters":[{"description":"API key UUID","in":"path","name":"id","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"Start date for usage period (ISO 8601 date)","in":"query","name":"from","schema":{"format":"date","type":"string"}},{"description":"End date for usage period (ISO 8601 date)","in":"query","name":"to","schema":{"format":"date","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIKeyUsage"}}},"description":"API key usage statistics"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Key not owned by developer"},"404":{"$ref":"#/components/responses/NotFound"}},"security":[{"devCookie":[]},{"devJWT":[]}],"summary":"Get API key usage statistics","tags":["Developer"]}},"/api/v1/dev/login":{"post":{"description":"Authenticate developer with email/password and receive JWT token. The global IP rate limit applies before authentication.","operationId":"developerLogin","requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"format":"email","type":"string"},"password":{"format":"password","type":"string"}},"required":["email","password"],"type":"object"}}},"description":"Developer credentials","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"developer":{"properties":{"email":{"type":"string"},"github_username":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"type":"object"},"expires_at":{"format":"date-time","type":"string"},"token":{"description":"JWT token for API access","type":"string"}},"type":"object"}}},"description":"Login successful"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Developer login","tags":["Developer"]}},"/api/v1/dev/logout":{"post":{"description":"Clear dev_auth_token cookie","operationId":"developerLogout","responses":{"204":{"description":"Logout successful"},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"devCookie":[]}],"summary":"Developer logout","tags":["Developer"]}},"/api/v1/events":{"get":{"description":"Query events with optional filters. Returns paginated JSON-LD.\nFor iCalendar output use `GET /api/v1/events.ics` (same filter params).\nA `Link: rel=alternate; type=text/calendar` header is included in the response\npointing to the corresponding ICS feed URL.\n\nEach SEL node serves one configured geographic boundary (see\nGEOGRAPHIC_BOUNDARY_CONFIG_FILE, default configs/boundary.yaml). The `city`\nand `region` filters are interpreted against that boundary, not against\nper-event addressLocality data: a requested city/region within the node's\nconfigured localities/regions matches the whole node (all events are\nreturned); one outside it matches nothing; a dimension the node does not\nconfigure is not filtered. When both are omitted, the node's configured\nscope applies. A boundary may span multiple municipalities. Requests\nsearch this node's inventory only; they do not discover events served by\nother Togather nodes.\n\nProximity filtering uses `near_lat` and `near_lon` together, with an\noptional `radius` in kilometres. Both coordinates are required if any\nproximity parameter is supplied; a radius without coordinates is invalid.\nThe default radius is configurable via\n`EVENTS_DEFAULT_RADIUS_KM` (default 10); the maximum is configurable via\n`EVENTS_MAX_RADIUS_KM` (default 100). Both configured radii must remain finite\nwhen converted to metres; invalid settings prevent startup. Results remain ordered by their\nearliest matching occurrence (soonest first); no distance is returned or\nused for sorting. An occurrence must have a geocoded effective venue to\nmatch. An occurrence venue overrides the primary venue, and an explicit\noccurrence venue without coordinates does not fall back to primary venue\ncoordinates. Date and proximity filters must match the same occurrence.\n\nOnly publicly visible events are returned. Publicly visible lifecycle\nstates are `published`, `postponed`, `rescheduled`, `sold_out`, `cancelled`\nand `completed`; `draft`, `pending_review` and `deleted` events are never\nreturned by this endpoint. Passing `state=draft` therefore yields an empty\nlist (the explicit state intersects with the public allowlist). Admin\nclients must use `GET /api/v1/admin/events` to see every non-deleted\nlifecycle state.\n","operationId":"listEvents","parameters":[{"$ref":"#/components/parameters/startDate"},{"$ref":"#/components/parameters/endDate"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/region"},{"$ref":"#/components/parameters/venueId"},{"$ref":"#/components/parameters/organizerId"},{"$ref":"#/components/parameters/lifecycleState"},{"$ref":"#/components/parameters/eventDomain"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/keywords"},{"$ref":"#/components/parameters/eventNearLat"},{"$ref":"#/components/parameters/eventNearLon"},{"$ref":"#/components/parameters/eventRadius"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/context"}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/EventListResponse"}}},"description":"Paginated list of events","headers":{"Link":{"description":"Pagination cursor (rel=next, RFC 8288) and alternate ICS feed URL (rel=alternate)","example":"\u003c/api/v1/events?after=ABC123\u0026limit=50\u003e; rel=\"next\"","schema":{"type":"string"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/EventSearchTimeout"}},"security":[],"summary":"List events","tags":["Events"]},"post":{"description":"Submit a new event to the library. Requires agent or admin authentication.\nEvents are auto-published immediately and appear in admin review queue\nif flagged or low-confidence.\n\nNewly created events with a physical place enqueue background geocoding.\nPure virtual events do not enqueue geocoding jobs.\n\nEvents with ambiguous (inferred) years are validated against\nVALIDATION_AMBIGUOUS_DATE_MAX_FUTURE_DAYS (default 60 days in the future);\nthose exceeding this threshold are sent to the review queue.\n\n`suppress_review_warnings` may list only benign heuristic codes (see\n`EventInput`); other codes are rejected with a 400 validation error.\n","operationId":"createEvent","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventInput"}},"application/ld+json":{"schema":{"$ref":"#/components/schemas/EventInput"}}},"description":"Event data in JSON-LD or JSON format","required":true},"responses":{"201":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Event"}}},"description":"Event created successfully","headers":{"Location":{"description":"URI of the created event","schema":{"format":"uri","type":"string"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Event"}}},"description":"Duplicate event (idempotent - returns existing event)"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}},"security":[{"apiKey":[]},{"bearerAuth":[]}],"summary":"Submit a new event","tags":["Events"]}},"/api/v1/events.ics":{"get":{"description":"Query events with optional filters and return as an iCalendar (ICS) feed.\nSame filter parameters as the JSON list endpoint.\nReturns a valid VCALENDAR even when no events match (empty feed).\n`city` and `region` are interpreted against the node's configured\ngeographic boundary as described on the JSON list endpoint.\n\nProximity filters use `near_lat` and `near_lon` together, with optional\n`radius` in kilometres. The default and maximum are configurable via\n`EVENTS_DEFAULT_RADIUS_KM` (default 10) and `EVENTS_MAX_RADIUS_KM`\n(default 100). Events remain chronological by their earliest matching\noccurrence; date and proximity must match the same occurrence. An\noccurrence without coordinates on its effective venue is excluded.\n\nThe feed contains only publicly visible events (`published`, `postponed`,\n`rescheduled`, `sold_out`, `cancelled`, `completed`). `draft`,\n`pending_review` and `deleted` events are excluded.\n","operationId":"listEventsICS","parameters":[{"$ref":"#/components/parameters/startDate"},{"$ref":"#/components/parameters/endDate"},{"$ref":"#/components/parameters/city"},{"$ref":"#/components/parameters/region"},{"$ref":"#/components/parameters/venueId"},{"$ref":"#/components/parameters/organizerId"},{"$ref":"#/components/parameters/lifecycleState"},{"$ref":"#/components/parameters/eventDomain"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/keywords"},{"$ref":"#/components/parameters/eventNearLat"},{"$ref":"#/components/parameters/eventNearLon"},{"$ref":"#/components/parameters/eventRadius"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"text/calendar":{"schema":{"description":"iCalendar (RFC 5545) calendar data","type":"string"}}},"description":"iCalendar feed of events","headers":{"Content-Disposition":{"description":"Attachment filename for download","example":"attachment; filename=\"events.ics\"","schema":{"type":"string"}},"Link":{"description":"Pagination cursor for next page of results (RFC 8288)","example":"\u003c/api/v1/events.ics?after=ABC123\u0026limit=50\u003e; rel=\"next\"","schema":{"type":"string"}}}},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid filter parameters"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"},"503":{"$ref":"#/components/responses/EventSearchTimeout"}},"security":[],"summary":"List events as iCalendar feed","tags":["Events"]}},"/api/v1/events/{id}":{"get":{"description":"Retrieve a single event by its ULID. Returns JSON-LD.\nFor iCalendar output use `GET /api/v1/events/{id}/ics`.\nA `Link: rel=alternate; type=text/calendar` header is included in the response\npointing to the corresponding ICS download URL.\n\nOnly publicly visible events are served. `draft` and `pending_review`\nevents return `404 Not Found` so their existence is not leaked. Deleted\nevents that were publicly visible return `410 Gone` with a tombstone;\ndeleted events that were never public (including rejected submissions)\nreturn `404 Not Found` so their existence is not leaked. Prior visibility\nis the persisted `events.first_published_at` signal (NULL = never public),\nmaintained by the `trg_events_first_published_at` trigger. Rows already\ndeleted before the backfill with no recorded public history keep\n`first_published_at` NULL and stay 404. A legacy row still in a public\nstate is stamped from `created_at` when it next leaves a public state, so\na legacy published-then-deleted event returns 410.\n","operationId":"getEvent","parameters":[{"$ref":"#/components/parameters/eventId"}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Event"}}},"description":"Event details","headers":{"Link":{"description":"Alternate ICS download URL for calendar clients (rel=alternate)","example":"\u003c/api/v1/events/{id}/ics\u003e; rel=\"alternate\"; type=\"text/calendar\"","schema":{"type":"string"}},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"404":{"$ref":"#/components/responses/NotFound"},"410":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Tombstone"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event was publicly visible and has been deleted; response carries the tombstone payload"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Get event by ID","tags":["Events"]}},"/api/v1/events/{id}/ics":{"get":{"description":"Retrieve a single event by its ULID as an iCalendar (ICS) download.\nUseful for importing a specific event into calendar applications.\n\nOnly publicly visible events are served. `draft` and `pending_review`\nevents return `404 Not Found`. Deleted events that were publicly visible\nreturn `410 Gone` with a tombstone payload; deleted events that were\nnever public return `404 Not Found` so their existence is not leaked.\nPrior visibility is the persisted `events.first_published_at` signal\n(NULL = never public), maintained by the `trg_events_first_published_at`\ntrigger. Rows already deleted before the backfill with no recorded public\nhistory keep `first_published_at` NULL and stay 404. A legacy row still in\na public state is stamped from `created_at` when it next leaves a public\nstate, so a legacy published-then-deleted event returns 410.\n","operationId":"getEventICS","parameters":[{"$ref":"#/components/parameters/eventId"}],"responses":{"200":{"content":{"text/calendar":{"schema":{"description":"iCalendar (RFC 5545) calendar data","type":"string"}}},"description":"iCalendar event","headers":{"Content-Disposition":{"description":"Attachment filename for download","example":"attachment; filename=\"event-{id}.ics\"","schema":{"type":"string"}}}},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event not found"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Event was publicly visible and has been deleted; response carries the tombstone payload"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[],"summary":"Get event as iCalendar","tags":["Events"]}},"/api/v1/events:batch":{"post":{"description":"Submit multiple events for background processing. Returns immediately with a batch ID\nand job status URL. Use the batch status endpoint to check processing results.\n\nMaximum batch size: 100 events. Each event in the batch is processed independently,\nwith individual success/failure tracking.\n\nScraper sources may set `suppress_review_warnings` on an event to stop benign\nheuristic warning codes (e.g. `cross_week_series_companion`) from routing that\nevent into `pending_review`. Only the allowlisted codes documented on\n`EventInput` are accepted; any other code rejects the whole batch with a 400\nvalidation error. The warnings themselves are still generated and passed to the\ningest pipeline.\n","operationId":"createEventBatch","requestBody":{"content":{"application/json":{"schema":{"properties":{"events":{"items":{"$ref":"#/components/schemas/EventInput"},"maxItems":100,"minItems":1,"type":"array"}},"required":["events"],"type":"object"}}},"description":"Array of events for batch processing (max 100 events)","required":true},"responses":{"202":{"content":{"application/json":{"schema":{"properties":{"@context":{"type":"string"},"@type":{"enum":["BatchSubmission"],"type":"string"},"batch_id":{"description":"Unique identifier for this batch submission","type":"string"},"job_id":{"description":"River job queue ID","type":"integer"},"status":{"enum":["processing"],"type":"string"},"status_url":{"description":"URL to check batch processing status","format":"uri","type":"string"},"submitted":{"description":"Number of events in the batch","type":"integer"}},"type":"object"}}},"description":"Batch accepted for processing"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}},"security":[{"apiKey":[]},{"bearerAuth":[]}],"summary":"Submit multiple events in a batch","tags":["Events"]}},"/api/v1/federation/sync":{"post":{"description":"Accepts a JSON-LD Event from a trusted federation node and preserves its\noriginal URI as the canonical `@id`. Requires an API key. Supports\nidempotent retries via `Idempotency-Key`.\n\nThe optional `sel:synthetic` field must be a Boolean; absence means\nfalse. Null and other types return `400`. The marker is retained on\nimport and emitted only when true. An existing canonical URI cannot\nchange its synthetic classification; a conflicting import returns\n`400` without changing the event or its nested entities.\n\n**Node binding (fail closed).** The authenticated API key must be bound\nto a federation node (`api_keys.federation_node_id`, set at key creation\nwith `federation_node_id`). Unbound keys are rejected with `403`. The\nbound node must match the host of the payload `@id`, be\n`federation_status: active`, have `sync_enabled` true (the column\ndefault; `NULL` is treated as true), and have `sync_direction`\n`bidirectional` or `pull_only` (`NULL` is treated as bidirectional).\nEvents from `push_only`, `paused`, `blocked`, `pending`, or\n`sync_enabled: false` nodes are rejected with `403`.\n\nNested `location` and `organizer` objects that carry an `@id` must also\nbelong to the same node domain; a foreign nested `@id` is rejected with\n`403` before any event, place, or organization row is written.\nAuthorization failures never mutate the database.\n","operationId":"syncFederatedEvent","parameters":[{"description":"Client-generated key that makes retries safe.","in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"properties":{"sel:synthetic":{"default":false,"type":"boolean"}},"type":"object"}},"application/ld+json":{"schema":{"additionalProperties":true,"description":"JSON-LD Event payload (`@context`, `@type`, `@id`, `name`, `startDate`, ...).","properties":{"sel:synthetic":{"default":false,"type":"boolean"}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/FederationSyncResponse"}}},"description":"Event updated or unchanged"},"201":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/FederationSyncResponse"}}},"description":"Event created"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"security":[{"apiKey":[]}],"summary":"Import or update a federated event","tags":["Federation"]}},"/api/v1/feeds/changes":{"get":{"description":"Ordered stream of changes for federation sync. Changes include an action\nand can carry a snapshot when requested.\n\nThis is the unconditional public feed. `draft` and `pending_review`\nchanges are omitted entirely. A delete row is exposed only if\n`events.first_published_at IS NOT NULL` and that timestamp is not after\nthe delete row's `changed_at` (the event was publicly visible before that\ndeletion); tombstones for submissions that never left draft/pending_review\nare not published, and an earlier never-public delete row stays hidden if\nthe event is republished later. Legacy / imported rows whose\nfirst_published_at is NULL fail closed, so no delete row is exposed.\nA deleted event's `create`/`update` rows are omitted, but its `delete` row\nis retained so consumers observe tombstones (Core Profile v0.2 §4.3).\nSnapshots are only attached to create/update rows that were recorded while\nthe event was publicly visible and whose event is still public (rows with\nno recorded lifecycle fall back to the current event state); delete rows\ncarry a tombstone payload only for previously-public events.\n\nUnpublishing (transition to `draft`) is not a deletion: it withdraws the\nevent's create/update rows from the feed and emits no delete row. Consumers\nholding a copy must re-fetch `GET /api/v1/events/{ulid}` and treat `404` as\nwithdrawal.\n\nCursor/sequence ordering is preserved:\nfiltering happens in SQL before `ORDER BY sequence_number`.\nContinue with `next_cursor` while `has_more` is true. The final page\nreturns `has_more: false` and an empty `next_cursor`.\n","operationId":"getChangeFeed","parameters":[{"description":"Supply an opaque cursor from a previous response or an RFC 3339\ntimestamp to return changes at or after that time. A valid timestamp\nis interpreted as a time filter. Pass a nonempty `next_cursor` to\ncontinue a paginated walk.\n","in":"query","name":"since","schema":{"type":"string"}},{"deprecated":true,"description":"Legacy alias for `since` (kept for backward compatibility).","in":"query","name":"after","schema":{"type":"string"}},{"description":"Filter by change type. Omit to receive every type.","in":"query","name":"action","schema":{"enum":["create","update","delete"],"type":"string"}},{"description":"When `true`, each change may include a JSON-LD event projection or a tombstone.\nSnapshots preserve `sel:synthetic: true` for generated events and\nomit the marker for ordinary events.\nSnapshots are only attached to create/update rows that were recorded\nwhile the event was publicly visible and whose event is still public\n(rows with no recorded lifecycle fall back to the current event\nstate). Delete rows carry a tombstone payload only when\n`events.first_published_at IS NOT NULL` and it is not after the delete\nrow's `changed_at` (the event was public before that deletion); rows\nwith a NULL signal fail closed and expose no delete row.\n`include_snapshot` is therefore safe for anonymous consumers.\n","in":"query","name":"include_snapshot","schema":{"default":false,"type":"boolean"}},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeFeedResponse"}},"application/ld+json":{"schema":{"$ref":"#/components/schemas/ChangeFeedResponse"}}},"description":"Change feed"},"400":{"$ref":"#/components/responses/BadRequest"}},"security":[],"summary":"Get change feed","tags":["Feeds"]}},"/api/v1/geocode":{"get":{"description":"Forward-geocodes a free-text query via Nominatim, using the PostgreSQL\ncache when possible. Public and rate limited.\n","operationId":"geocodeAddress","parameters":[{"description":"Address or place name to geocode.","example":"Toronto City Hall","in":"query","name":"q","required":true,"schema":{"type":"string"}},{"description":"Comma-separated ISO 3166-1 alpha-2 country codes. Defaults to the\nserver's configured country list (`GEOCODING_DEFAULT_COUNTRYCODES`).\n","example":"ca","in":"query","name":"countrycodes","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeocodeResponse"}}},"description":"Geocoding result"},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Upstream geocoding failed"}},"security":[],"summary":"Geocode an address or place name","tags":["Geocoding"]}},"/api/v1/openapi.json":{"get":{"description":"Retrieve the OpenAPI 3.1 specification in JSON format. Its server URL uses SERVER_BASE_URL (default http://localhost:8080).","operationId":"getOpenApiSpec","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"OpenAPI 3.1 specification"}},"security":[],"summary":"OpenAPI specification","tags":["Health"]}},"/api/v1/openapi.yaml":{"get":{"description":"The server URL uses SERVER_BASE_URL (default http://localhost:8080).","operationId":"getOpenAPIYAML","responses":{"200":{"content":{"application/x-yaml":{"schema":{"type":"string"}}},"description":"OpenAPI document"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Get this OpenAPI specification (YAML)","tags":["Health"]}},"/api/v1/organizations":{"get":{"description":"Query organizations (event organizers) with optional filters. Returns paginated JSON-LD.","operationId":"listOrganizations","parameters":[{"$ref":"#/components/parameters/localityCity"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/sort"},{"$ref":"#/components/parameters/order"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/OrganizationListResponse"}}},"description":"Paginated list of organizations","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"List organizations","tags":["Organizations"]}},"/api/v1/organizations/{id}":{"get":{"description":"Retrieve a single organization by its unique identifier. Returns JSON-LD.","operationId":"getOrganization","parameters":[{"description":"Unique identifier of the organization (ULID or URI)","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Organization"}}},"description":"Organization details","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Get organization by ID","tags":["Organizations"]}},"/api/v1/places":{"get":{"description":"Query places (venues) with optional filters. Returns paginated JSON-LD.\nSupports proximity search via `near_lat` + `near_lon` (+ optional `radius`),\nor `near_place` to geocode a place name first.\n","operationId":"listPlaces","parameters":[{"$ref":"#/components/parameters/localityCity"},{"$ref":"#/components/parameters/query"},{"$ref":"#/components/parameters/sort"},{"$ref":"#/components/parameters/order"},{"$ref":"#/components/parameters/nearPlace"},{"$ref":"#/components/parameters/nearLat"},{"$ref":"#/components/parameters/nearLon"},{"$ref":"#/components/parameters/radius"},{"$ref":"#/components/parameters/countrycodes"},{"$ref":"#/components/parameters/after"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/PlaceListResponse"}}},"description":"Paginated list of places","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"List places","tags":["Places"]}},"/api/v1/places/{id}":{"get":{"description":"Retrieve a single place (venue) by its unique identifier. Returns JSON-LD.","operationId":"getPlace","parameters":[{"description":"Unique identifier of the place (ULID or URI)","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/ld+json":{"schema":{"$ref":"#/components/schemas/Place"}}},"description":"Place details","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[],"summary":"Get place by ID","tags":["Places"]}},"/api/v1/reverse-geocode":{"get":{"description":"Resolves latitude/longitude to an address via Nominatim, using the PostgreSQL cache when possible.","operationId":"reverseGeocode","parameters":[{"description":"Latitude (WGS84).","in":"query","name":"lat","required":true,"schema":{"format":"double","maximum":90,"minimum":-90,"type":"number"}},{"description":"Longitude (WGS84).","in":"query","name":"lon","required":true,"schema":{"format":"double","maximum":180,"minimum":-180,"type":"number"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReverseGeocodeResponse"}}},"description":"Reverse geocoding result"},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Upstream reverse geocoding failed"}},"security":[],"summary":"Reverse geocode coordinates","tags":["Geocoding"]}},"/api/v1/scraper/submissions":{"post":{"description":"Submits up to 10 URLs for review and eventual scraping. No authentication\nrequired. Rate limited to 20 URLs per IP per 24 hours (configurable via\n`RATE_LIMIT_SUBMISSIONS_PER_IP_PER_24H`).\n\nEach URL is normalised and deduplicated before insertion. The response\nincludes a per-URL result indicating whether the URL was accepted,\nalready exists (duplicate), or rejected (invalid URL).\n","operationId":"submitURLs","requestBody":{"content":{"application/json":{"example":{"urls":["https://www.toronto.ca/events-calendar/"]},"schema":{"properties":{"urls":{"example":["https://www.toronto.ca/events-calendar/"],"items":{"format":"uri","type":"string"},"maxItems":10,"minItems":1,"type":"array"}},"required":["urls"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"results":{"items":{"$ref":"#/components/schemas/SubmissionResult"},"type":"array"}},"type":"object"}}},"description":"Submission results, one entry per submitted URL"},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"$ref":"#/components/responses/URLSubmissionRateLimited"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Internal server error"}},"security":[],"summary":"Submit URLs for scraping","tags":["Scraper"]}},"/api/v1/stats":{"get":{"description":"Public counters used by landing pages and monitoring: entity counts,\nlifecycle split, recent/upcoming/past event counts and the event date range.\nResponses are cacheable for five minutes. Metered responses use a private\ncache because quota headers are specific to the client IP.\n","operationId":"getServerStats","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}},"description":"Server statistics","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitCapacity"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}}},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Failed to compute statistics"}},"security":[],"summary":"Get server statistics","tags":["Stats"]}},"/auth/github":{"get":{"description":"Redirect to GitHub OAuth authorization page with proper state parameter for CSRF protection","operationId":"githubOAuthStart","responses":{"302":{"description":"Redirect to GitHub OAuth","headers":{"Location":{"description":"GitHub OAuth authorization URL","schema":{"format":"uri","type":"string"}}}}},"security":[],"summary":"Initiate GitHub OAuth flow","tags":["OAuth"]}},"/auth/github/callback":{"get":{"description":"Handle GitHub OAuth callback, exchange code for token, and create/login developer","operationId":"githubOAuthCallback","parameters":[{"description":"Authorization code from GitHub","in":"query","name":"code","required":true,"schema":{"type":"string"}},{"description":"CSRF protection state parameter","in":"query","name":"state","required":true,"schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to developer dashboard on success","headers":{"Location":{"description":"Developer dashboard URL","schema":{"format":"uri","type":"string"}}}},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"description":"Invalid state or GitHub error"}},"security":[],"summary":"GitHub OAuth callback","tags":["OAuth"]}},"/health":{"get":{"description":"Checks database, migrations, River job queue, JSON-LD contexts and the HTTP\nlayer. Returns `503` when any critical check fails and `degraded` when a\ncheck warns.\n","operationId":"getHealth","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthCheck"}}},"description":"Healthy or degraded"},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthCheck"}}},"description":"Unhealthy or shutting down"}},"security":[],"summary":"Comprehensive health check","tags":["Health"]}},"/healthz":{"get":{"description":"Check if the service is alive and running. Used by orchestrators (Kubernetes, etc.) to determine if the service should be restarted.","operationId":"healthLiveness","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"status":{"example":"ok","type":"string"}},"type":"object"}}},"description":"Service is alive"}},"security":[],"summary":"Liveness probe","tags":["Health"]}},"/index.md":{"get":{"description":"The Markdown node overview. Also available via HEAD.","operationId":"getNodeHomepageMarkdown","responses":{"200":{"content":{"text/markdown":{"schema":{"type":"string"}}},"description":"Markdown node overview"}},"security":[],"summary":"Node homepage in Markdown"}},"/llms.txt":{"get":{"description":"Plain text index of REST and MCP guides and public tools. Also available via HEAD.","operationId":"getAgentDocumentationIndex","responses":{"200":{"content":{"text/plain":{"schema":{"type":"string"}}},"description":"Agent documentation index"}},"security":[],"summary":"Documentation index for agents"}},"/mcp":{"post":{"description":"Model Context Protocol endpoint (streamable HTTP transport, JSON-RPC 2.0).\nRead-only tools (`events`, `search`, `places`, `organizations`,\n`geocode_address`, `reverse_geocode`) are public; write/account tools\nrequire an API key. The transport is stateless: `Mcp-Session-Id` is optional\nand ignored. Manual requests may call tools directly without `initialize`.\n","operationId":"mcpStreamableHTTP","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"description":"JSON-RPC 2.0 request (`initialize`, `tools/list`, `tools/call`, ...).","type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}},"description":"JSON-RPC response or SSE stream"}},"security":[],"summary":"MCP streamable HTTP endpoint","tags":["MCP"]}},"/readyz":{"get":{"description":"Check if the service is ready to accept traffic. Verifies database connectivity and other dependencies.","operationId":"healthReadiness","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"checks":{"properties":{"database":{"type":"string"}},"type":"object"},"status":{"example":"ready","type":"string"}},"type":"object"}}},"description":"Service is ready"},"503":{"description":"Service not ready"}},"security":[],"summary":"Readiness probe","tags":["Health"]}},"/version":{"get":{"operationId":"getVersion","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionResponse"}}},"description":"Version information"}},"security":[],"summary":"Get build metadata","tags":["Health"]}}},"servers":[{"description":"SEL node root. Both served formats use the configured SERVER_BASE_URL (default http://localhost:8080). API paths include their full prefix.","url":"https://staging.toronto.togather.foundation"}],"tags":[{"description":"Administrative operations (requires admin auth)","name":"Admin"},{"description":"Authentication and token management","name":"Auth"},{"description":"Developer self-service API key management","name":"Developer"},{"description":"Event discovery and submission","name":"Events"},{"description":"Federation node management and inbound sync","name":"Federation"},{"description":"Change feeds for federation","name":"Feeds"},{"description":"Forward and reverse geocoding","name":"Geocoding"},{"description":"Health check and build metadata endpoints","name":"Health"},{"description":"Model Context Protocol streamable HTTP endpoint","name":"MCP"},{"description":"Public server statistics","name":"Stats"},{"description":"GitHub OAuth authentication","name":"OAuth"},{"description":"Organizer information","name":"Organizations"},{"description":"Venue information","name":"Places"}]}