{"openapi":"3.0.3","info":{"title":"OneGoodArea API","version":"1.0.0","description":"Area intelligence API: scores, signals, reports, and org management."},"components":{"schemas":{"Preset":{"type":"string","enum":["moving","business","investing","research"]},"SignalCategory":{"type":"string","enum":["crime","deprivation","property","schools","amenities","transport","environment"]},"Dimension":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"score":{"type":"number"},"weight":{"type":"number"},"confidence":{"type":"number","minimum":0,"maximum":1},"reasoning":{"type":"string"},"confidence_reason":{"type":"string"}},"required":["key","label","score","weight","confidence","reasoning","confidence_reason"]},"ScoreResult":{"type":"object","properties":{"area":{"type":"string"},"preset":{"type":"string"},"score":{"type":"number"},"area_type":{"type":"string","enum":["urban","suburban","rural",null],"nullable":true,"description":"The official band. Null when no official class can be found for the area; never a guessed band"},"rural_urban":{"type":"string","nullable":true,"description":"The official rural-urban class that decided area_type, in the publisher's words"},"reference":{"description":"What transport, schools and amenities were ranked against: the area's band, your cohort, or all GB neighbourhoods when the band is unavailable","oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["band"]},"band":{"type":"string","enum":["urban","suburban","rural"]}},"required":["kind","band"]},{"type":"object","properties":{"kind":{"type":"string","enum":["cohort"]},"slug":{"type":"string"},"name":{"type":"string"},"areas":{"type":"integer"}},"required":["kind","slug","name","areas"]},{"type":"object","properties":{"kind":{"type":"string","enum":["national"]},"scope":{"type":"string","enum":["GB"]},"reason":{"type":"string","enum":["area_type_unavailable"]}},"required":["kind","scope","reason"]}]},"dimensions":{"type":"array","items":{"$ref":"#/components/schemas/Dimension"},"minItems":5,"maxItems":5},"confidence":{"type":"number","minimum":0,"maximum":1},"weights_source":{"type":"string","enum":["preset","custom"]},"engine_version":{"type":"string"},"summary":{"type":"string"},"recommendations":{"type":"array","items":{"type":"string"}},"data_sources":{"type":"array","items":{"type":"string"}}},"required":["area","preset","score","area_type","rural_urban","dimensions","confidence","weights_source","reference","engine_version"]}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key from /keys. Header: Authorization: Bearer oga_live_..."},"bridgeToken":{"type":"http","scheme":"bearer","description":"Bridge token minted by the web BFF. Internal use only."},"bearerToken":{"type":"http","scheme":"bearer","description":"JWT session token. Browser login. Authorization: Bearer <jwt>."}}},"paths":{"/docs/json":{"get":{"summary":"OpenAPI spec (JSON)","tags":["Meta"],"security":[],"responses":{"200":{"description":"Default Response"}}}},"/health":{"get":{"summary":"Health check","tags":["Meta"],"description":"Liveness probe for container hosts.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"commit":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["status","commit"],"additionalProperties":false}}}}}}},"/v1/meta":{"get":{"summary":"API metadata","tags":["Meta"],"description":"Returns the supported intents, the current engine version and the methodology history, newest last.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"service":{"type":"string"},"phase":{"type":"string"},"intents":{"type":"array","items":{"type":"string"}},"engine_version":{"type":"string"},"methodology":{"type":"array","items":{"type":"object","properties":{"version":{"type":"string"},"released_at":{"type":"string"},"summary":{"type":"string"}},"required":["version","released_at","summary"],"additionalProperties":false}}},"required":["service","phase","intents","engine_version","methodology"],"additionalProperties":false}}}}}}},"/cron/training-retention":{"get":{"summary":"Training retention cron","tags":["Cron"],"description":"Nightly retention purge for training tables. Internal cron endpoint.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"retention_days":{"type":"number"},"cutoff":{"type":"string"},"planner_pairs_deleted":{"type":"number"},"brief_pairs_deleted":{"type":"number"}},"required":["retention_days","cutoff","planner_pairs_deleted","brief_pairs_deleted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/settings/delete-account":{"delete":{"summary":"Delete account","tags":["Settings"],"description":"Permanently delete the authenticated user and all associated data.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/register":{"post":{"summary":"Register","tags":["Auth"],"description":"Create a new account with email and password.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/resend-verification":{"post":{"summary":"Resend verification email","tags":["Auth"],"description":"Resend the email verification link.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/verify-email":{"post":{"summary":"Verify email","tags":["Auth"],"description":"Verify an email address using a token from the verification email.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/forgot-password":{"post":{"summary":"Forgot password","tags":["Auth"],"description":"Send a password reset email.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/reset-password":{"post":{"summary":"Reset password","tags":["Auth"],"description":"Reset password using a token from the email link.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/login":{"post":{"summary":"Login","tags":["Auth"],"description":"Authenticate with email and password.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/magic-link/request":{"post":{"summary":"Request magic link","tags":["Auth"],"description":"Send a magic login link to the user's email.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/magic-link/consume":{"post":{"summary":"Consume a magic link","tags":["Auth"],"description":"Validate and single-use consume a magic link token, verify the user's email, and return the user so the web layer can mint a session.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"image":{"anyOf":[{"type":"string"},{"type":"null"}]},"userType":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","email","name","image","userType"],"additionalProperties":false}},"required":["ok","user"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/state":{"get":{"summary":"Auth state","tags":["Auth"],"description":"Return the authenticated user's auth state (email verified + user type). Session user only: never accepts a client-supplied id.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"emailVerified":{"type":"boolean"},"userType":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["emailVerified","userType"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/check-email":{"get":{"summary":"Check email existence (GET)","tags":["Auth"],"description":"Check if an email address is already registered.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"exists":{"type":"boolean"},"provider":{"type":"string"}},"required":["exists"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Check email existence (POST)","tags":["Auth"],"description":"Check if an email address is already registered.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"exists":{"type":"boolean"},"provider":{"type":"string"}},"required":["exists"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/auth/oauth-callback":{"post":{"summary":"OAuth callback","tags":["Auth"],"description":"Handle OAuth provider callback (Google).","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/settings/password":{"post":{"summary":"Change password","tags":["Settings"],"description":"Change the authenticated user's password.","x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/activity":{"get":{"summary":"My activity log","tags":["Reports"],"description":"Recent API activity for the authenticated user.","parameters":[{"schema":{"default":1,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"in":"query","name":"page","required":true},{"schema":{"default":20,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"in":"query","name":"page_size","required":true}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"event":{"type":"string","minLength":1},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","user_id","event","metadata","created_at"],"additionalProperties":false}},"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"page":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"page_size":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["events","total","page","page_size"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/user-type":{"get":{"summary":"My user type","tags":["Me"],"description":"Returns { user_type: UserType }. Session-authed; 401 if not signed in. Replaces the deprecated /me/is-superuser endpoint.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"user_type":{"type":"string","enum":["user","engineering","admin","superuser"]}},"required":["user_type"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/tier":{"get":{"summary":"My tier","tags":["Me"],"description":"Returns { tier: string }. Session-authed; 401 if not signed in. The tier determines rate limits and LLM routing (EPIC B).","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string"}},"required":["tier"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/webhooks":{"get":{"summary":"List my webhook subscriptions","tags":["Me"],"description":"Returns the caller's webhook subscriptions (no secret).","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"status":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"last_success_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["id","url","events","causes","status","created_at","last_success_at","last_failure_at"],"additionalProperties":false}}},"required":["subscriptions"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Create a webhook subscription","tags":["Me"],"description":"Register a new webhook URL. Returns the signing secret ONCE.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string"}}},"required":["url","events"],"additionalProperties":false}}}},"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"secret":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","url","events","causes","secret","created_at"],"additionalProperties":false}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"secret":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","url","events","causes","secret","created_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/webhooks/{id}":{"delete":{"summary":"Delete a webhook subscription","tags":["Me"],"description":"Revoke a webhook subscription owned by the caller.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/webhooks/{id}/rotate-secret":{"post":{"summary":"Rotate webhook signing secret","tags":["Me"],"description":"Generate a new HMAC signing secret. Returns it ONCE; the old secret is invalidated immediately.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string"}},"required":["secret"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/portfolios":{"get":{"summary":"List my portfolios (paginated, searchable)","tags":["Me"],"description":"Paginated portfolios for the caller. Query: ?page=1&page_size=20&q=<substring>. Inline-joins areas for the page rows.","parameters":[{"schema":{"default":1,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"in":"query","name":"page","required":true},{"schema":{"default":20,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"in":"query","name":"page_size","required":true},{"schema":{"type":"string"},"in":"query","name":"q","required":false}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"portfolios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"area_count":{"type":"number"},"areas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"area":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","area","label"],"additionalProperties":false}}},"required":["id","name","created_at","updated_at","area_count","areas"],"additionalProperties":false}},"total":{"type":"number"},"page":{"type":"number"},"page_size":{"type":"number"}},"required":["portfolios","total","page","page_size"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/score-usage":{"get":{"summary":"30-day score-call usage by preset","tags":["Me"],"description":"Counts api.score.computed events over the last 30 days, grouped by preset.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"window_days":{"type":"number"},"total":{"type":"number"},"by_preset":{"type":"array","items":{"type":"object","properties":{"preset":{"type":"string"},"count":{"type":"number"}},"required":["preset","count"],"additionalProperties":false}}},"required":["window_days","total","by_preset"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/me/org":{"get":{"summary":"Get my primary org + role","tags":["Me"],"description":"Returns { org, caller_role } for the caller's primary org (owner-first, then oldest membership), or { org: null, caller_role: null } if the caller has no org.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"org":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","slug","name","created_at","updated_at"],"additionalProperties":false},{"type":"null"}]},"caller_role":{"anyOf":[{"type":"string","enum":["owner","admin","member"]},{"type":"null"}]}},"required":["org","caller_role"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update my primary org","tags":["Me"],"description":"Partial update of the caller's primary org. Owner or admin only. Returns the updated org + caller_role.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"display_name":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string","maxLength":500,"format":"uri"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string","maxLength":2000,"format":"uri"},{"type":"null"}]}},"additionalProperties":false}}}},"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"org":{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","slug","name","created_at","updated_at"],"additionalProperties":false},"caller_role":{"type":"string","enum":["owner","admin","member"]}},"required":["org","caller_role"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}}}}},"/me/profile":{"patch":{"summary":"Update my profile","tags":["Me"],"description":"Partial update of the caller's user profile. Today: `intent` only.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intents":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"additionalProperties":false}}}},"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/me":{"get":{"summary":"Current user profile","tags":["Reports"],"description":"Returns the authenticated user's profile and usage stats.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"plan_name":{"type":"string"},"generation":{"type":"string"},"api_access":{"type":"boolean"},"mcp_access":{"type":"boolean"},"api_calls_per_month":{"type":"number"},"used_this_month":{"type":"number"},"limit_this_month":{"anyOf":[{"type":"number"},{"type":"null"}]},"unmetered":{"type":"boolean"},"user_type":{"type":"string","enum":["user","engineering","admin","superuser"]},"engine_version":{"type":"string"},"addons":{"type":"array","items":{"type":"string"}},"mcp_calls_this_month":{"type":"number"},"org":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"type":"string"}},"required":["id","slug","name","display_name","brand_url","role"],"additionalProperties":false},{"type":"null"}]},"key":{"type":"object","properties":{"allowed_ip_cidrs":{"type":"array","items":{"type":"string"}},"training_optout":{"type":"boolean"}},"required":["allowed_ip_cidrs","training_optout"],"additionalProperties":false}},"required":["plan","plan_name","generation","api_access","mcp_access","api_calls_per_month","used_this_month","limit_this_month","unmetered","user_type","engine_version","addons","mcp_calls_this_month","org","key"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/usage":{"get":{"summary":"Check usage","tags":["Usage"],"description":"Check current API usage and limits.","security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"type":"boolean"},"plan":{"type":"string"},"used":{"type":"number"},"limit":{"anyOf":[{"type":"number"},{"type":"null"}]},"unmetered":{"type":"boolean"},"userType":{"type":"string","enum":["user","engineering","admin","superuser"]}},"required":["allowed","plan","used","limit","unmetered","userType"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/dashboard":{"get":{"summary":"Dashboard data","tags":["Dashboard"],"description":"Composite dashboard data for the authenticated user.","security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"planName":{"type":"string"},"used":{"type":"number"},"limit":{"anyOf":[{"type":"number"},{"type":"null"}]},"unmetered":{"type":"boolean"},"userType":{"type":"string","enum":["user","engineering","admin","superuser"]},"mcp":{"type":"object","properties":{"access":{"type":"boolean"},"addonOwned":{"type":"boolean"},"includedFreeViaPlan":{"type":"boolean"},"callsThisMonth":{"type":"number"}},"required":["access","addonOwned","includedFreeViaPlan","callsThisMonth"],"additionalProperties":false},"emailVerified":{"type":"boolean"},"primaryKey":{"anyOf":[{"type":"object","properties":{"key_prefix":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["key_prefix","name","last_used_at"],"additionalProperties":false},{"type":"null"}]},"latestCall":{"anyOf":[{"type":"object","properties":{"preset":{"type":"string"},"area":{"type":"string"},"score":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["preset","area","score","created_at"],"additionalProperties":false},{"type":"null"}]}},"required":["plan","planName","used","limit","unmetered","userType","mcp","emailVerified","primaryKey","latestCall"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/settings/subscription":{"get":{"summary":"Subscription info","tags":["Settings"],"description":"Get current subscription plan and status.","security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"planName":{"type":"string"},"hasStripeSubscription":{"type":"boolean"},"cancelAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["plan","planName","hasStripeSubscription","cancelAt"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/track":{"post":{"summary":"Track pageview","tags":["Tracking"],"description":"Record a pageview event.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"anyOf":[{"type":"string"},{"type":"null"}]},"referrer":{"anyOf":[{"type":"string"},{"type":"null"}]},"sessionId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}}},"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]}},"required":["ok"],"additionalProperties":false},{"type":"object","properties":{"statusCode":{"type":"number"},"error":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","error","message"],"additionalProperties":false}]}}}}}}},"/track/event":{"post":{"summary":"Track a custom event","tags":["Tracking"],"description":"Record a custom event. Public by design (used by the web app for QR scans).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"anyOf":[{"type":"string"},{"type":"null"}]},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"targets":{"type":"array","items":{"type":"string","enum":["db_event","tracing","logging"]}}},"additionalProperties":false}}}},"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]}},"required":["ok"],"additionalProperties":false},{"type":"object","properties":{"statusCode":{"type":"number"},"error":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","error","message"],"additionalProperties":false}]}}}}}}},"/watchlist":{"get":{"summary":"Get watchlist","tags":["Watchlist"],"description":"Get the authenticated user's saved areas watchlist.","security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"areas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"postcode":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"intent":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","postcode","label","intent","created_at"],"additionalProperties":false}}},"required":["areas"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Add to watchlist","tags":["Watchlist"],"description":"Add an area to the user's watchlist.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"postcode":{"type":"string"},"label":{"type":"string"},"intent":{"type":"string"}},"required":["postcode"],"additionalProperties":false}}}},"security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"area":{"type":"object","properties":{"id":{"type":"string"},"postcode":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"intent":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","postcode","label","intent","created_at"],"additionalProperties":false}},"required":["area"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/watchlist/{id}":{"delete":{"summary":"Remove from watchlist","tags":["Watchlist"],"description":"Remove an area from the user's watchlist.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]},{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/keys/usage":{"get":{"summary":"API key usage","tags":["Keys"],"description":"Request totals, 30-day daily series, and active keys.","parameters":[{"schema":{"type":"string"},"in":"query","name":"org","required":false}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalRequests":{"type":"number"},"requestsThisMonth":{"type":"number"},"monthlyLimit":{"anyOf":[{"type":"number"},{"type":"null"}]},"unmetered":{"type":"boolean"},"userType":{"type":"string","enum":["user","engineering","admin","superuser"]},"band":{"type":"string","enum":["fresh","active","approaching","exhausted"]},"dailyData":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"count":{"type":"number"}},"required":["day","count"],"additionalProperties":false}},"lastRequestAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key_preview":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"training_optout":{"type":"boolean"},"managed":{"type":"boolean"}},"required":["id","key_preview","name","created_at","last_used_at","training_optout","managed"],"additionalProperties":false}}},"required":["totalRequests","requestsThisMonth","monthlyLimit","unmetered","userType","band","dailyData","lastRequestAt","keys"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/keys":{"get":{"summary":"List API keys","tags":["Keys"],"description":"List the caller's API keys.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key_preview":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"training_optout":{"type":"boolean"},"managed":{"type":"boolean"}},"required":["id","key_preview","name","created_at","last_used_at","training_optout","managed"],"additionalProperties":false}}},"required":["keys"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Create API key","tags":["Keys"],"description":"Create a new API key. Returns the key once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"}},"required":["id","key","name"],"additionalProperties":false}},"required":["key"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/keys/playground":{"post":{"summary":"Provision a playground API key","tags":["Keys"],"description":"Rotates the signed-in caller's end-of-day API key for the Scalar Try-It session.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"expires_at":{"type":"string"}},"required":["key","expires_at"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/keys/{id}":{"delete":{"summary":"Revoke API key","tags":["Keys"],"description":"Revoke an API key.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update API key","tags":["Keys"],"description":"Update per-key settings (e.g. training_optout).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["training_optout"],"properties":{"training_optout":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"training_optout":{"type":"boolean"}},"required":["id","training_optout"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/stripe/webhook":{"post":{"summary":"Stripe webhook","tags":["Stripe"],"description":"Receive Stripe webhook events. Signature verified in handler.","security":[],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}}}}},"/stripe/portal":{"post":{"summary":"Billing portal","tags":["Stripe"],"description":"Create a Stripe billing portal session.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/stripe/cancel":{"post":{"summary":"Cancel subscription","tags":["Stripe"],"description":"Schedule subscription cancellation at end of billing period.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"cancel_at":{"type":"string"},"message":{"type":"string"}},"required":["success","cancel_at","message"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"cancel_at":{"type":"string"}},"required":["error","cancel_at"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/stripe/checkout":{"post":{"summary":"Checkout","tags":["Stripe"],"description":"Create a Stripe checkout session. Currently disabled (demo-led sales).","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}}}}},"/stripe/addon-checkout":{"post":{"summary":"Add-on checkout","tags":["Stripe"],"description":"Create a Stripe add-on checkout session. Currently retired (MCP included free).","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}}}}},"/v1/webhooks":{"post":{"summary":"Create webhook","tags":["Webhooks"],"description":"Register a webhook endpoint for event notifications.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","minLength":1,"description":"Required. HTTPS webhook endpoint URL."},"events":{"type":"array","items":{"type":"string"},"description":"Required. Supported: 'signal.changed' (material moves from a portfolio change check) and 'portfolio.feed' (each change-feed entry after a refresh). Unsupported entries are filtered out and duplicates collapsed."},"causes":{"type":"array","items":{"type":"string"},"description":"Optional. Which changes to receive by why they moved: 'source' (the world or its publisher), 'method' (a methodology release, same period), 'source_and_method' (both). Default ['source']."}},"example":{"url":"https://example.com/hooks","events":["signal.changed","portfolio.feed"],"causes":["source"]}}}}},"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"secret":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","url","events","causes","secret","created_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List webhooks","tags":["Webhooks"],"description":"List registered webhooks.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"status":{"type":"string"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"last_success_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"last_failure_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["id","url","events","causes","status","created_at","last_success_at","last_failure_at"],"additionalProperties":false}}},"required":["subscriptions"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/webhooks/{id}":{"delete":{"summary":"Delete webhook","tags":["Webhooks"],"description":"Delete a registered webhook.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["revoked"]}},"required":["id","status"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/webhooks/{id}/rotate-secret":{"post":{"summary":"Rotate webhook secret","tags":["Webhooks"],"description":"Rotate the signing secret for a webhook.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"secret":{"type":"string"}},"required":["id","secret"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/analytics":{"get":{"summary":"Analytics overview","tags":["Admin"],"description":"High-level admin analytics.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalUsers":{"type":"number"},"totalApiCalls":{"type":"number"},"apiCallsThisMonth":{"type":"number"},"activeUsersThisMonth":{"type":"number"},"apiCallsPerDay":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"count":{"type":"number"}},"required":["day","count"],"additionalProperties":false}},"topAreas":{"type":"array","items":{"type":"object","properties":{"area":{"anyOf":[{"type":"string"},{"type":"null"}]},"count":{"type":"number"}},"required":["area","count"],"additionalProperties":false}},"recentActivity":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["event","user_id","metadata","created_at","name","email"],"additionalProperties":false}},"userGrowth":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"count":{"type":"number"}},"required":["day","count"],"additionalProperties":false}},"usersWithApiCalls":{"type":"number"},"paidUsers":{"type":"number"},"subscriptionsByPlan":{"type":"array","items":{"type":"object","properties":{"plan":{"type":"string"},"count":{"type":"number"}},"required":["plan","count"],"additionalProperties":false}},"mrr":{"type":"number"}},"required":["totalUsers","totalApiCalls","apiCallsThisMonth","activeUsersThisMonth","apiCallsPerDay","topAreas","recentActivity","userGrowth","usersWithApiCalls","paidUsers","subscriptionsByPlan","mrr"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/traffic-analytics":{"get":{"summary":"Traffic analytics","tags":["Admin"],"description":"Traffic analytics data.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalPageviews":{"type":"number"},"pageviewsToday":{"type":"number"},"uniqueVisitorsToday":{"type":"number"},"uniqueVisitors30d":{"type":"number"},"pageviewsPerDay":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"count":{"type":"number"}},"required":["day","count"],"additionalProperties":false}},"topPages":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"count":{"type":"number"}},"required":["path","count"],"additionalProperties":false}},"topReferrers":{"type":"array","items":{"type":"object","properties":{"referrer":{"type":"string"},"count":{"type":"number"}},"required":["referrer","count"],"additionalProperties":false}},"deviceBreakdown":{"type":"array","items":{"type":"object","properties":{"device":{"type":"string"},"count":{"type":"number"}},"required":["device","count"],"additionalProperties":false}},"topCountries":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"count":{"type":"number"}},"required":["country","count"],"additionalProperties":false}}},"required":["totalPageviews","pageviewsToday","uniqueVisitorsToday","uniqueVisitors30d","pageviewsPerDay","topPages","topReferrers","deviceBreakdown","topCountries"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/audience":{"get":{"summary":"Audience stats (superuser only)","tags":["Admin"],"description":"Composite stats for the Audience tab: total/active users, signup curve, orgs by size + activity, top countries, churn signal.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"object","properties":{"total":{"type":"number"},"active_7d":{"type":"number"},"active_30d":{"type":"number"},"signups_per_day":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"count":{"type":"number"}},"required":["day","count"],"additionalProperties":false}},"churn_signal_count":{"type":"number"},"stale_users":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"email":{"type":"string"},"days_inactive":{"type":"number"}},"required":["user_id","email","days_inactive"],"additionalProperties":false}}},"required":["total","active_7d","active_30d","signups_per_day","churn_signal_count","stale_users"],"additionalProperties":false},"orgs":{"type":"object","properties":{"total":{"type":"number"},"size_distribution":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string","enum":["1","2-5","6-20","20+"]},"count":{"type":"number"}},"required":["bucket","count"],"additionalProperties":false}},"top_by_activity":{"type":"array","items":{"type":"object","properties":{"org_id":{"type":"string"},"org_name":{"type":"string"},"events_30d":{"type":"number"}},"required":["org_id","org_name","events_30d"],"additionalProperties":false}}},"required":["total","size_distribution","top_by_activity"],"additionalProperties":false},"geo":{"type":"object","properties":{"top_countries":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"count":{"type":"number"}},"required":["country","count"],"additionalProperties":false}},"unique_countries_30d":{"type":"number"}},"required":["top_countries","unique_countries_30d"],"additionalProperties":false}},"required":["users","orgs","geo"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/usage":{"get":{"summary":"Usage stats (superuser only)","tags":["Admin"],"description":"Thirty-day product, endpoint and engine-version cohorts for API activity.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totals":{"type":"object","properties":{"calls_7d":{"type":"number"},"calls_30d":{"type":"number"},"top_product":{"anyOf":[{"type":"string","enum":["Signals","Scores","Monitor","Intelligence","Org & Levers"]},{"type":"null"}]},"top_endpoint":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["calls_7d","calls_30d","top_product","top_endpoint"],"additionalProperties":false},"per_product":{"type":"array","items":{"type":"object","properties":{"product":{"type":"string","enum":["Signals","Scores","Monitor","Intelligence","Org & Levers"]},"calls_30d":{"type":"number"}},"required":["product","calls_30d"],"additionalProperties":false}},"top_endpoints":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"count":{"type":"number"},"last_seen":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["event","count","last_seen"],"additionalProperties":false}},"engine_versions":{"type":"array","items":{"type":"object","properties":{"engine_version":{"anyOf":[{"type":"string"},{"type":"null"}]},"calls_30d":{"type":"number"},"unique_users_30d":{"type":"number"},"unique_orgs_30d":{"type":"number"},"last_seen":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["engine_version","calls_30d","unique_users_30d","unique_orgs_30d","last_seen"],"additionalProperties":false}}},"required":["totals","per_product","top_endpoints","engine_versions"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/revenue":{"get":{"summary":"Revenue extras (superuser only)","tags":["Admin"],"description":"ARR + MCP add-on uptake + active add-on counts.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"arr":{"type":"number"},"mcp":{"type":"object","properties":{"total_paying":{"type":"number"},"with_mcp_addon":{"type":"number"},"in_mcp_inclusive_plan":{"type":"number"}},"required":["total_paying","with_mcp_addon","in_mcp_inclusive_plan"],"additionalProperties":false},"addons":{"type":"array","items":{"type":"object","properties":{"addon_key":{"type":"string"},"active_count":{"type":"number"}},"required":["addon_key","active_count"],"additionalProperties":false}}},"required":["arr","mcp","addons"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/mcp-adoption":{"get":{"summary":"MCP adoption stats (superuser only)","tags":["Admin"],"description":"Aggregate MCP usage last 30 days: total events, unique orgs/users, top orgs, breakdown by client app. No raw metadata.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"total_events_30d":{"type":"number"},"unique_orgs_30d":{"type":"number"},"unique_users_30d":{"type":"number"},"top_orgs":{"type":"array","items":{"type":"object","properties":{"org_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"org_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"event_count":{"type":"number"},"last_seen":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["org_id","org_name","event_count","last_seen"],"additionalProperties":false}},"by_client_app":{"type":"array","items":{"type":"object","properties":{"client_app":{"type":"string"},"event_count":{"type":"number"}},"required":["client_app","event_count"],"additionalProperties":false}}},"required":["total_events_30d","unique_orgs_30d","unique_users_30d","top_orgs","by_client_app"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/training-corpus":{"get":{"summary":"Training corpus stats (superuser only)","tags":["Admin"],"description":"Aggregate planner-pair counts (30d + total + last_seen) plus opt-out denominator over active API keys. No raw training data.","security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"planner_pairs_30d":{"type":"number"},"planner_pairs_total":{"type":"number"},"planner_last_seen":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"brief_pairs_30d":{"type":"number"},"brief_pairs_total":{"type":"number"},"brief_last_seen":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"keys_opted_out":{"type":"number"},"keys_total":{"type":"number"}},"required":["planner_pairs_30d","planner_pairs_total","planner_last_seen","brief_pairs_30d","brief_pairs_total","brief_last_seen","keys_opted_out","keys_total"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/admin/users/{id}/tier":{"post":{"summary":"Set user tier (superuser only)","tags":["Admin"],"description":"Privileged endpoint to set a user's tier. Validates against allowed values.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","enum":["anonymous","logged_in","basic","high_tier","engineering","superuser"]}},"required":["tier"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerToken":[]}],"x-internal":true,"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"tier":{"type":"string"}},"required":["ok","tier"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/area":{"get":{"summary":"Get area profile","tags":["Signals"],"description":"Full signal profile for a UK postcode (live or retired), a OneGoodArea place id, an official neighbourhood code or a place name. Returns geo metadata plus all signal categories with sources. A store-backed neighbourhood also carries its nation's deprivation domains (income, employment, health, education and more) as deciles: each has a `detail` object with the published `rank` and, where the publisher gives one, the `score` (Scotland publishes none). Wales has no crime domain. With grain=group or grain=district, crime, deprivation, property and schools are aggregated over the member neighbourhoods, deprivation domains contain mean deciles without detail, and all percentile fields are null.","parameters":[{"schema":{"type":"string"},"in":"query","name":"area","required":false,"description":"A place id (oga_pl_...), an official neighbourhood code (LSOA or Data Zone) or a UK place name (e.g. 'Manchester')."},{"schema":{"type":"string"},"in":"query","name":"postcode","required":false,"description":"UK postcode (e.g. 'SW1A 1AA'). A retired postcode resolves to the neighbourhood it was in; geo.postcode_status says which."},{"schema":{"type":"string"},"in":"query","name":"bundle","required":false,"description":"Optional bundle ID to scope available signals."},{"schema":{"type":"string"},"in":"query","name":"sort","required":false,"description":"One of period, loaded, released: order the signals newest first by their period, by when OGA loaded them, or by the publisher's release date. Undated signals come last. Omit to keep catalogue order."},{"schema":{"type":"string"},"in":"query","name":"grain","required":false,"description":"One of neighbourhood, group, district: aggregate crime, deprivation, property and schools over the neighbourhood the area resolves to, or its group (MSOA or Intermediate Zone) or district (local authority). Examples: area=Oxford&grain=group and area=Oxford&grain=district. Group and district percentiles are null. Amenity, transport and flood distinct counts remain null until AR-1069. Omit for the neighbourhood."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"geo":{"type":"object","properties":{"query":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postcode_status":{"anyOf":[{"type":"string","enum":["live","terminated"]},{"type":"null"}]},"postcode_terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]},"latitude":{"type":"number"},"longitude":{"type":"number"},"lsoa":{"anyOf":[{"type":"string"},{"type":"null"}]},"msoa":{"anyOf":[{"type":"string"},{"type":"null"}]},"admin_district":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"area_type":{"anyOf":[{"type":"string","enum":["urban","suburban","rural"]},{"type":"null"}]},"rural_urban":{"anyOf":[{"type":"string"},{"type":"null"}]},"place_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"place_type":{"anyOf":[{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},{"type":"null"}]},"neighbourhood_count":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["query","postcode","postcode_status","postcode_terminated_on","latitude","longitude","lsoa","msoa","admin_district","region","country","area_type","rural_urban","place_id","place_type","neighbourhood_count"],"additionalProperties":false},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["crime","deprivation","property","schools","amenities","transport","environment"]},"label":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"regional_percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"direction":{"type":"string","enum":["higher_is_better","lower_is_better","neutral"]},"confidence":{"type":"number","minimum":0,"maximum":1},"confidence_reason":{"type":"string"},"source":{"type":"string"},"observed_period":{"type":"string"},"source_unavailable":{"type":"boolean","enum":[true]},"detail":{"type":"object","properties":{"rank":{"description":"The published rank within the nation (a tied rank is a published mid-rank such as 2790.5).","type":"number"},"score":{"description":"The published score, where the publisher gives one (Scotland publishes none).","type":"number"}},"additionalProperties":false,"description":"Extra published figures behind `value`, for a deprivation domain."},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]}},"required":["key","category","label","value","unit","direction","confidence","confidence_reason","source","observed_period"],"additionalProperties":false}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"fetch_mode":{"type":"string","enum":["live","store","hybrid"]},"grain":{"type":"string","enum":["neighbourhood","group","district"],"description":"The area grain: one neighbourhood, its containing group, or its containing district. Group and district profiles aggregate crime, deprivation, property and schools; their percentiles are null until aggregate normalization exists."}},"required":["engine_version","generated_at","sources","fetch_mode","grain"],"additionalProperties":false}},"required":["geo","signals","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}}}}},"/v1/area/transactions":{"get":{"summary":"Get area sale transactions","tags":["Signals"],"description":"Individual HM Land Registry sale records in the neighbourhood a UK postcode is in, newest first (last 12 months), of every property type and category; `place` names the place the list covers. Served from the loaded sales, with HM Land Registry as the fallback (`meta.fetch_mode`). England and Wales only. The count is this list; it differs from the property.transaction_count signal, which counts the neighbourhood's standard residential sales in the ONS year.","parameters":[{"schema":{"type":"string"},"in":"query","name":"postcode","required":true,"description":"UK postcode (e.g. 'SW11 3ES')."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"postcode_area":{"type":"string"},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]}},"required":["place_id","place_type"],"additionalProperties":false},{"type":"null"}]},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"],"additionalProperties":false},"transaction_count":{"type":"number"},"transactions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"price":{"type":"number"},"property_type":{"type":"string"},"estate_type":{"type":"string"}},"required":["date","price","property_type","estate_type"],"additionalProperties":false}},"meta":{"type":"object","properties":{"fetch_mode":{"type":"string","enum":["store","live"]},"generated_at":{"type":"string"}},"required":["fetch_mode","generated_at"],"additionalProperties":false}},"required":["postcode_area","place","period","transaction_count","transactions","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/area/schools":{"get":{"summary":"Get area schools","tags":["Signals"],"description":"The inspected schools within 1.5km of a UK postcode, nearest first, by name and grade: the entities behind the aggregated schools.* signals, as /v1/area/transactions is for property.*. England is served from the Ofsted register; Wales and Scotland return an empty list with the reason their inspectorate publishes no comparable grades.","parameters":[{"schema":{"type":"string"},"in":"query","name":"postcode","required":true,"description":"UK postcode (e.g. 'LA22 0EN')."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"postcode":{"type":"string"},"lsoa":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"inspectorate":{"type":"string"},"radius_m":{"type":"number"},"distance_from":{"anyOf":[{"type":"string","enum":["neighbourhood_centroid","postcode"]},{"type":"null"}]},"coverage_note":{"anyOf":[{"type":"string"},{"type":"null"}]},"school_count":{"type":"number"},"schools":{"type":"array","items":{"type":"object","properties":{"urn":{"type":"number"},"name":{"type":"string"},"phase":{"anyOf":[{"type":"string"},{"type":"null"}]},"overall_effectiveness":{"anyOf":[{"type":"number"},{"type":"null"}]},"rating":{"anyOf":[{"type":"string"},{"type":"null"}]},"grade_source":{"anyOf":[{"type":"string","enum":["report_card","overall","quality_of_education","ungraded_inspection"]},{"type":"null"}]},"inspection_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"distance_m":{"type":"number"}},"required":["urn","name","phase","overall_effectiveness","rating","grade_source","inspection_date","distance_m"],"additionalProperties":false}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"},"fetch_mode":{"type":"string","enum":["store","live","none"]}},"required":["engine_version","generated_at","fetch_mode"],"additionalProperties":false}},"required":["postcode","lsoa","country","inspectorate","radius_m","distance_from","coverage_note","school_count","schools","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}}}}},"/v1/signals/metadata":{"get":{"summary":"Get the signal catalog metadata","tags":["Signals"],"description":"Returns the full signal catalog grouped by category, with public or internal visibility. No location required. Static route: takes precedence over /v1/signals/:category.","security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"signals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"type":"string"},"source":{"type":"string"},"methodology_version":{"anyOf":[{"type":"string"},{"type":"null"}]},"visibility":{"type":"string","enum":["public","internal"]},"live_override":{"type":"boolean"},"plannable":{"type":"boolean"}},"required":["key","label","unit","direction","source","methodology_version","visibility","plannable"],"additionalProperties":false}}}},"required":["signals"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/signals/{category}":{"get":{"summary":"Get signals by category","tags":["Signals"],"description":"Returns all signals for a specific category (crime, deprivation, property, schools, amenities, transport, environment). The grain query applies the same group or district aggregation as GET /v1/area.","parameters":[{"schema":{"type":"string"},"in":"query","name":"area","required":false,"description":"A place id, an official neighbourhood code or a UK place name."},{"schema":{"type":"string"},"in":"query","name":"postcode","required":false,"description":"UK postcode, live or retired."},{"schema":{"type":"string"},"in":"query","name":"sort","required":false,"description":"One of period, loaded, released: order the signals newest first by their period, by when OGA loaded them, or by the publisher's release date. Undated signals come last. Omit to keep catalogue order."},{"schema":{"type":"string"},"in":"query","name":"grain","required":false,"description":"One of neighbourhood, group, district: aggregate crime, deprivation, property and schools over the neighbourhood the area resolves to, or its group (MSOA or Intermediate Zone) or district (local authority). Examples: area=Oxford&grain=group and area=Oxford&grain=district. Group and district percentiles are null. Amenity, transport and flood distinct counts remain null until AR-1069. Omit for the neighbourhood."},{"schema":{"type":"string"},"in":"path","name":"category","required":true,"description":"Signal category name."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"geo":{"type":"object","properties":{"query":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postcode_status":{"anyOf":[{"type":"string","enum":["live","terminated"]},{"type":"null"}]},"postcode_terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]},"latitude":{"type":"number"},"longitude":{"type":"number"},"lsoa":{"anyOf":[{"type":"string"},{"type":"null"}]},"msoa":{"anyOf":[{"type":"string"},{"type":"null"}]},"admin_district":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"area_type":{"anyOf":[{"type":"string","enum":["urban","suburban","rural"]},{"type":"null"}]},"rural_urban":{"anyOf":[{"type":"string"},{"type":"null"}]},"place_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"place_type":{"anyOf":[{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},{"type":"null"}]},"neighbourhood_count":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["query","postcode","postcode_status","postcode_terminated_on","latitude","longitude","lsoa","msoa","admin_district","region","country","area_type","rural_urban","place_id","place_type","neighbourhood_count"],"additionalProperties":false},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["crime","deprivation","property","schools","amenities","transport","environment"]},"label":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"regional_percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"direction":{"type":"string","enum":["higher_is_better","lower_is_better","neutral"]},"confidence":{"type":"number","minimum":0,"maximum":1},"confidence_reason":{"type":"string"},"source":{"type":"string"},"observed_period":{"type":"string"},"source_unavailable":{"type":"boolean","enum":[true]},"detail":{"type":"object","properties":{"rank":{"description":"The published rank within the nation (a tied rank is a published mid-rank such as 2790.5).","type":"number"},"score":{"description":"The published score, where the publisher gives one (Scotland publishes none).","type":"number"}},"additionalProperties":false,"description":"Extra published figures behind `value`, for a deprivation domain."},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]}},"required":["key","category","label","value","unit","direction","confidence","confidence_reason","source","observed_period"],"additionalProperties":false}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"},"sources":{"type":"array","items":{"type":"string"}},"fetch_mode":{"type":"string","enum":["live","store","hybrid"]},"grain":{"type":"string","enum":["neighbourhood","group","district"],"description":"The area grain: one neighbourhood, its containing group, or its containing district. Group and district profiles aggregate crime, deprivation, property and schools; their percentiles are null until aggregate normalization exists."}},"required":["engine_version","generated_at","sources","fetch_mode","grain"],"additionalProperties":false}},"required":["geo","signals","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}}}}},"/v1/areas":{"get":{"summary":"Query areas by signal","tags":["Signals"],"description":"Rank areas by a signal value. Supports country/LAD scoping, percentile and value filters, and compound multi-signal queries. Deprivation signals (the deciles and ranks, and every domain such as deprivation.income) are relative within a nation, so a deprivation query must pass `country` or `lad`; without one it fails with 400 and the error \"Deprivation deciles and ranks are relative within each nation. Pass country=England, Wales or Scotland, or a lad.\"","parameters":[{"schema":{"type":"string"},"in":"query","name":"signal","required":true,"description":"Signal key to rank by (e.g. 'crime.total_12m', 'deprivation.income')."},{"schema":{"type":"string","enum":["England","Wales","Scotland"]},"in":"query","name":"country","required":false,"description":"Required with a deprivation signal unless `lad` is given."},{"schema":{"type":"string"},"in":"query","name":"lad","required":false,"description":"Local authority district code. Required with a deprivation signal unless `country` is given."},{"schema":{"type":"number","minimum":0,"maximum":100},"in":"query","name":"min_percentile","required":false,"description":"Keep areas at or above this national percentile (0 to 100)."},{"schema":{"type":"number","minimum":0,"maximum":100},"in":"query","name":"max_percentile","required":false,"description":"Keep areas at or below this national percentile (0 to 100)."},{"schema":{"type":"number"},"in":"query","name":"min_value","required":false,"description":"Keep areas whose value is at least this."},{"schema":{"type":"number"},"in":"query","name":"max_value","required":false,"description":"Keep areas whose value is at most this."},{"schema":{"type":"string","enum":["percentile","percentile_desc","value","value_desc"],"default":"percentile"},"in":"query","name":"sort","required":false,"description":"Order of the ranked list."},{"schema":{"type":"integer","minimum":1,"default":100},"in":"query","name":"limit","required":false,"description":"Rows to return; capped at 1000."},{"schema":{"type":"string","enum":["national","regional"],"default":"national"},"in":"query","name":"scope","required":false,"description":"Rank within the nation (default) or within the region."},{"schema":{"type":"string"},"in":"query","name":"bundle","required":false,"description":"Optional bundle ID to scope available signals."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"signal":{"type":"string"},"count":{"type":"number"},"areas":{"type":"array","items":{"type":"object","properties":{"geo_type":{"type":"string"},"geo_code":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number"},{"type":"null"}]},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"signals":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number"},{"type":"null"}]},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]}},"required":["value","normalized_value","percentile"],"additionalProperties":false}}},"required":["geo_type","geo_code","value","normalized_value","percentile"],"additionalProperties":false}}},"required":["signal","count","areas"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/places/resolve":{"get":{"summary":"Resolve one input to a place","tags":["Places"],"description":"Resolves a postcode, an official code (ONS, Scottish Government or ISO), a place id or a place name to the place it names, with the alias it resolved through. A name that could mean several places returns candidates with status ambiguous (HTTP 200). An input that names nothing returns status not_found with a reason (HTTP 404). Postcodes, codes and ids resolve on our own spine; names use the place search.","parameters":[{"schema":{"type":"string","maxLength":100},"in":"query","name":"q","required":true,"description":"A postcode, an official code, a place id or a place name."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["resolved"]},"input":{"type":"string"},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"resolved_via":{"type":"object","properties":{"kind":{"type":"string","enum":["place_id","postcode","code","name"]},"scheme":{"anyOf":[{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},{"type":"null"}]},"value":{"type":"string"}},"required":["kind","scheme","value"],"additionalProperties":false},"postcode":{"anyOf":[{"type":"object","properties":{"postcode":{"type":"string"},"status":{"type":"string","enum":["live","terminated"]},"terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["postcode","status","terminated_on"],"additionalProperties":false},{"type":"null"}]}},"required":["status","input","place","resolved_via","postcode"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["ambiguous"]},"input":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},{"type":"null"}]}},"required":["label","postcode","place"],"additionalProperties":false}}},"required":["status","input","candidates"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]},"input":{"type":"string"},"reason":{"type":"string","enum":["empty_input","input_too_long","invalid_input","invalid_place_id","unknown_place_id","unknown_postcode","unknown_code","nation_not_covered","name_not_found","name_not_supported_in_batch"]},"message":{"type":"string"}},"required":["status","input","reason","message"],"additionalProperties":false}]},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["result","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"result":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["resolved"]},"input":{"type":"string"},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"resolved_via":{"type":"object","properties":{"kind":{"type":"string","enum":["place_id","postcode","code","name"]},"scheme":{"anyOf":[{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},{"type":"null"}]},"value":{"type":"string"}},"required":["kind","scheme","value"],"additionalProperties":false},"postcode":{"anyOf":[{"type":"object","properties":{"postcode":{"type":"string"},"status":{"type":"string","enum":["live","terminated"]},"terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["postcode","status","terminated_on"],"additionalProperties":false},{"type":"null"}]}},"required":["status","input","place","resolved_via","postcode"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["ambiguous"]},"input":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},{"type":"null"}]}},"required":["label","postcode","place"],"additionalProperties":false}}},"required":["status","input","candidates"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]},"input":{"type":"string"},"reason":{"type":"string","enum":["empty_input","input_too_long","invalid_input","invalid_place_id","unknown_place_id","unknown_postcode","unknown_code","nation_not_covered","name_not_found","name_not_supported_in_batch"]},"message":{"type":"string"}},"required":["status","input","reason","message"],"additionalProperties":false}]},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["result","meta"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Resolve up to 1,000 inputs to places","tags":["Places"],"description":"Resolves up to 1000 postcodes, official codes and place ids in one request, each kind in one statement against our own spine, and echoes every input with its outcome in input order. Place names are not resolved in a batch; they return not_found with reason name_not_supported_in_batch and resolve one at a time through GET /v1/places/resolve.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"minItems":1,"maxItems":1000,"type":"array","items":{"type":"string","maxLength":100},"description":"Postcodes, official codes and place ids, in any mix. Validated as an array of strings, never coerced."}},"required":["inputs"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"ambiguous":{"type":"integer","minimum":0,"maximum":9007199254740991},"not_found":{"type":"integer","minimum":0,"maximum":9007199254740991},"results":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["resolved"]},"input":{"type":"string"},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"resolved_via":{"type":"object","properties":{"kind":{"type":"string","enum":["place_id","postcode","code","name"]},"scheme":{"anyOf":[{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},{"type":"null"}]},"value":{"type":"string"}},"required":["kind","scheme","value"],"additionalProperties":false},"postcode":{"anyOf":[{"type":"object","properties":{"postcode":{"type":"string"},"status":{"type":"string","enum":["live","terminated"]},"terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["postcode","status","terminated_on"],"additionalProperties":false},{"type":"null"}]}},"required":["status","input","place","resolved_via","postcode"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["ambiguous"]},"input":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},{"type":"null"}]}},"required":["label","postcode","place"],"additionalProperties":false}}},"required":["status","input","candidates"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]},"input":{"type":"string"},"reason":{"type":"string","enum":["empty_input","input_too_long","invalid_input","invalid_place_id","unknown_place_id","unknown_postcode","unknown_code","nation_not_covered","name_not_found","name_not_supported_in_batch"]},"message":{"type":"string"}},"required":["status","input","reason","message"],"additionalProperties":false}]}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["count","resolved","ambiguous","not_found","results","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/places/{id}":{"get":{"summary":"Read a place","tags":["Places"],"description":"A place by its id: type, name, country and nation, centroid, validity, every code it is known by (current first), its parents nearest first up to the country, and the places it was formed from or became.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"A place id, e.g. oga_pl_YXC6XP2HFFQEA."}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]},"id_origin":{"type":"object","properties":{"scheme":{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},"code":{"type":"string","minLength":1}},"required":["scheme","code"],"additionalProperties":false},"centroid":{"anyOf":[{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"}},"required":["latitude","longitude"],"additionalProperties":false},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation","id_origin","centroid","valid_from","valid_to"],"additionalProperties":false},"aliases":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},"code":{"type":"string"},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"current":{"type":"boolean"}},"required":["scheme","code","valid_from","valid_to","current"],"additionalProperties":false}},"parents":{"type":"array","items":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false}},"predecessors":{"type":"array","items":{"type":"object","properties":{"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"change_kind":{"type":"string","enum":["split","merge","irregular"]},"share":{"anyOf":[{"type":"number"},{"type":"null"}]},"effective_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place","change_kind","share","effective_on"],"additionalProperties":false}},"successors":{"type":"array","items":{"type":"object","properties":{"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"change_kind":{"type":"string","enum":["split","merge","irregular"]},"share":{"anyOf":[{"type":"number"},{"type":"null"}]},"effective_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place","change_kind","share","effective_on"],"additionalProperties":false}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["place","aliases","parents","predecessors","successors","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/places/map":{"post":{"summary":"Map up to 1,000 inputs to places with their stored signals","tags":["Places"],"description":"Resolves postcodes, official codes and place ids (1 to 1000) and returns, for every input in order, the place it names, the store key it is read by and the stored signals of that neighbourhood, or the reason there are none. With portfolio_id, every resolved input is added to that portfolio with its place_id. Metered by resolved row. Larger sets run as a job at POST /v1/jobs/portfolio-map.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"minItems":1,"maxItems":20000,"type":"array","items":{"type":"string","maxLength":100}},"portfolio_id":{"type":"string","minLength":1}},"required":["inputs"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"ambiguous":{"type":"integer","minimum":0,"maximum":9007199254740991},"not_found":{"type":"integer","minimum":0,"maximum":9007199254740991},"with_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"without_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"portfolio":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"added":{"type":"integer","minimum":0,"maximum":9007199254740991},"updated":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","added","updated"],"additionalProperties":false},{"type":"null"}]}},"required":["count","resolved","ambiguous","not_found","with_signals","without_signals","portfolio"],"additionalProperties":false},"rows":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer","minimum":0,"maximum":9007199254740991},"input":{"type":"string"},"resolution":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["resolved"]},"input":{"type":"string"},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"resolved_via":{"type":"object","properties":{"kind":{"type":"string","enum":["place_id","postcode","code","name"]},"scheme":{"anyOf":[{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},{"type":"null"}]},"value":{"type":"string"}},"required":["kind","scheme","value"],"additionalProperties":false},"postcode":{"anyOf":[{"type":"object","properties":{"postcode":{"type":"string"},"status":{"type":"string","enum":["live","terminated"]},"terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["postcode","status","terminated_on"],"additionalProperties":false},{"type":"null"}]}},"required":["status","input","place","resolved_via","postcode"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["ambiguous"]},"input":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},{"type":"null"}]}},"required":["label","postcode","place"],"additionalProperties":false}}},"required":["status","input","candidates"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]},"input":{"type":"string"},"reason":{"type":"string","enum":["empty_input","input_too_long","invalid_input","invalid_place_id","unknown_place_id","unknown_postcode","unknown_code","nation_not_covered","name_not_found","name_not_supported_in_batch"]},"message":{"type":"string"}},"required":["status","input","reason","message"],"additionalProperties":false}]},"store_key":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},"code":{"type":"string"}},"required":["scheme","code"],"additionalProperties":false},{"type":"null"}]},"signals":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["crime","deprivation","property","schools","amenities","transport","environment"]},"label":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"regional_percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"direction":{"type":"string","enum":["higher_is_better","lower_is_better","neutral"]},"confidence":{"type":"number","minimum":0,"maximum":1},"confidence_reason":{"type":"string"},"source":{"type":"string"},"observed_period":{"type":"string"},"source_unavailable":{"type":"boolean","enum":[true]},"detail":{"type":"object","properties":{"rank":{"description":"The published rank within the nation (a tied rank is a published mid-rank such as 2790.5).","type":"number"},"score":{"description":"The published score, where the publisher gives one (Scotland publishes none).","type":"number"}},"additionalProperties":false,"description":"Extra published figures behind `value`, for a deprivation domain."},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]}},"required":["key","category","label","value","unit","direction","confidence","confidence_reason","source","observed_period"],"additionalProperties":false}},{"type":"null"}]},"signals_note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["seq","input","resolution","store_key","signals","signals_note"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["summary","rows","notes","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/jobs/portfolio-map":{"post":{"summary":"Map up to 20,000 inputs to places as a job","tags":["Jobs"],"description":"Submits postcodes, official codes and place ids (1 to 20000) to be resolved to places with their stored signals, and returns a job at once (HTTP 202). Poll GET /v1/jobs/:id for status and read the result in pages from GET /v1/jobs/:id/rows. With portfolio_id, every resolved input is added to that portfolio with its place_id. Metered by resolved row when the job completes. Up to 1,000 inputs can instead resolve synchronously at POST /v1/places/map.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"minItems":1,"maxItems":20000,"type":"array","items":{"type":"string","maxLength":100}},"portfolio_id":{"type":"string","minLength":1}},"required":["inputs"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["portfolio_map"]},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"progress":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"done":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","done"],"additionalProperties":false},"summary":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"ambiguous":{"type":"integer","minimum":0,"maximum":9007199254740991},"not_found":{"type":"integer","minimum":0,"maximum":9007199254740991},"with_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"without_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"portfolio":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"added":{"type":"integer","minimum":0,"maximum":9007199254740991},"updated":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","added","updated"],"additionalProperties":false},{"type":"null"}]}},"required":["count","resolved","ambiguous","not_found","with_signals","without_signals","portfolio"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"started_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"finished_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["id","kind","status","attempts","progress","summary","error","created_at","started_at","finished_at"],"additionalProperties":false},"notes":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["job","notes","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/jobs":{"get":{"summary":"List your jobs","tags":["Jobs"],"description":"The caller's jobs, newest first.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"jobs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["portfolio_map"]},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"progress":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"done":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","done"],"additionalProperties":false},"summary":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"ambiguous":{"type":"integer","minimum":0,"maximum":9007199254740991},"not_found":{"type":"integer","minimum":0,"maximum":9007199254740991},"with_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"without_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"portfolio":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"added":{"type":"integer","minimum":0,"maximum":9007199254740991},"updated":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","added","updated"],"additionalProperties":false},{"type":"null"}]}},"required":["count","resolved","ambiguous","not_found","with_signals","without_signals","portfolio"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"started_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"finished_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["id","kind","status","attempts","progress","summary","error","created_at","started_at","finished_at"],"additionalProperties":false}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["jobs","meta"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/jobs/{id}":{"get":{"summary":"Read a job","tags":["Jobs"],"description":"Status, attempts, progress and, once succeeded, the summary. A job whose worker went quiet is re-queued here and run again, up to three attempts.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["portfolio_map"]},"status":{"type":"string","enum":["queued","running","succeeded","failed"]},"attempts":{"type":"integer","minimum":0,"maximum":9007199254740991},"progress":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"done":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["total","done"],"additionalProperties":false},"summary":{"anyOf":[{"type":"object","properties":{"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"resolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"ambiguous":{"type":"integer","minimum":0,"maximum":9007199254740991},"not_found":{"type":"integer","minimum":0,"maximum":9007199254740991},"with_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"without_signals":{"type":"integer","minimum":0,"maximum":9007199254740991},"portfolio":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"added":{"type":"integer","minimum":0,"maximum":9007199254740991},"updated":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["id","added","updated"],"additionalProperties":false},{"type":"null"}]}},"required":["count","resolved","ambiguous","not_found","with_signals","without_signals","portfolio"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"started_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"finished_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]}},"required":["id","kind","status","attempts","progress","summary","error","created_at","started_at","finished_at"],"additionalProperties":false},"notes":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["job","notes","meta"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/jobs/{id}/rows":{"get":{"summary":"Read a job's result rows","tags":["Jobs"],"description":"One row per input, in input order, 500 per page by default and at most 1000. Pass next_after from one page as after to read the next; rows written so far are readable while the job is still running.","parameters":[{"schema":{"type":"integer","minimum":-1,"default":-1},"in":"query","name":"after","required":false,"description":"The last seq already read; omit for the first page."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":500},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer","minimum":0,"maximum":9007199254740991},"input":{"type":"string"},"resolution":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["resolved"]},"input":{"type":"string"},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"resolved_via":{"type":"object","properties":{"kind":{"type":"string","enum":["place_id","postcode","code","name"]},"scheme":{"anyOf":[{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},{"type":"null"}]},"value":{"type":"string"}},"required":["kind","scheme","value"],"additionalProperties":false},"postcode":{"anyOf":[{"type":"object","properties":{"postcode":{"type":"string"},"status":{"type":"string","enum":["live","terminated"]},"terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["postcode","status","terminated_on"],"additionalProperties":false},{"type":"null"}]}},"required":["status","input","place","resolved_via","postcode"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["ambiguous"]},"input":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"place":{"anyOf":[{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},{"type":"null"}]}},"required":["label","postcode","place"],"additionalProperties":false}}},"required":["status","input","candidates"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]},"input":{"type":"string"},"reason":{"type":"string","enum":["empty_input","input_too_long","invalid_input","invalid_place_id","unknown_place_id","unknown_postcode","unknown_code","nation_not_covered","name_not_found","name_not_supported_in_batch"]},"message":{"type":"string"}},"required":["status","input","reason","message"],"additionalProperties":false}]},"store_key":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string","enum":["iso3166-1","iso3166-2","ctry","rgn","lad","msoa21","iz2022","lsoa21","dz2022","lsoa11","dz2011","iz2011"]},"code":{"type":"string"}},"required":["scheme","code"],"additionalProperties":false},{"type":"null"}]},"signals":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["crime","deprivation","property","schools","amenities","transport","environment"]},"label":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"normalized_value":{"anyOf":[{"type":"number"},{"type":"null"}]},"percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"regional_percentile":{"anyOf":[{"type":"number","minimum":0,"maximum":100},{"type":"null"}]},"direction":{"type":"string","enum":["higher_is_better","lower_is_better","neutral"]},"confidence":{"type":"number","minimum":0,"maximum":1},"confidence_reason":{"type":"string"},"source":{"type":"string"},"observed_period":{"type":"string"},"source_unavailable":{"type":"boolean","enum":[true]},"detail":{"type":"object","properties":{"rank":{"description":"The published rank within the nation (a tied rank is a published mid-rank such as 2790.5).","type":"number"},"score":{"description":"The published score, where the publisher gives one (Scotland publishes none).","type":"number"}},"additionalProperties":false,"description":"Extra published figures behind `value`, for a deprivation domain."},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]}},"required":["key","category","label","value","unit","direction","confidence","confidence_reason","source","observed_period"],"additionalProperties":false}},{"type":"null"}]},"signals_note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["seq","input","resolution","store_key","signals","signals_note"],"additionalProperties":false}},"next_after":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["job_id","rows","next_after","meta"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}/feed":{"get":{"summary":"What moved among the places a portfolio holds","tags":["Portfolios"],"description":"One entry per stored signal of a held place that a completed refresh changed since `since`, with the value, confidence and national decile before and after, the refresh that recorded it, and both clocks (the data's period and our recording instant). Kept when the value moved by at least threshold_pct at or above min_confidence, the confidence fell, or the decile changed. Pages follow the refresh ledger: pass next_after back as after until it is null. Re-cuts of held places are listed on the first page. No entry is produced for a place the portfolio does not hold.","parameters":[{"schema":{"type":"string"},"in":"query","name":"since","required":false,"description":"ISO 8601 instant within the last 30 days (history is kept 30 days); default 30 days ago."},{"schema":{"type":"integer","minimum":-1,"default":-1},"in":"query","name":"after","required":false,"description":"The last cursor already read; omit for the first page."},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":200},"in":"query","name":"limit","required":false},{"schema":{"type":"number","minimum":0,"default":5},"in":"query","name":"threshold_pct","required":false},{"schema":{"type":"number","minimum":0,"maximum":1,"default":0},"in":"query","name":"min_confidence","required":false},{"schema":{"type":"string"},"in":"query","name":"cause","required":false,"description":"List only entries with these causes, comma separated: source, method, source_and_method. Default every cause."},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"portfolio_id":{"type":"string"},"since":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"threshold_pct":{"type":"number"},"min_confidence":{"type":"number"},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"places_held":{"type":"integer","minimum":0,"maximum":9007199254740991},"areas_without_place":{"type":"integer","minimum":0,"maximum":9007199254740991},"entries":{"type":"array","items":{"type":"object","properties":{"cursor":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"place":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"areas":{"type":"array","items":{"type":"string"}},"signal_key":{"type":"string"},"category":{"type":"string"},"label":{"type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"type":"string"},"run":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"completed_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","source","completed_at"],"additionalProperties":false},"observed_period":{"type":"string"},"period":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]},"period_basis":{"anyOf":[{"type":"string","enum":["reference","load"]},{"type":"null"}]},"released_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"loaded_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"recorded_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"before":{"anyOf":[{"type":"object","properties":{"period":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}]},"band":{"anyOf":[{"type":"integer","minimum":1,"maximum":10},{"type":"null"}]}},"required":["period","value","confidence","band"],"additionalProperties":false},{"type":"null"}]},"after":{"type":"object","properties":{"period":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}]},"band":{"anyOf":[{"type":"integer","minimum":1,"maximum":10},{"type":"null"}]}},"required":["period","value","confidence","band"],"additionalProperties":false},"delta":{"anyOf":[{"type":"number"},{"type":"null"}]},"pct_change":{"anyOf":[{"type":"number"},{"type":"null"}]},"movement":{"type":"string","enum":["up","down","flat","first"]},"flags":{"type":"object","properties":{"value_moved":{"type":"boolean"},"confidence_dropped":{"type":"boolean"},"band_crossed":{"type":"boolean"}},"required":["value_moved","confidence_dropped","band_crossed"],"additionalProperties":false},"cause":{"type":"string","enum":["source","method","source_and_method"]},"method_releases":{"type":"array","items":{"type":"string"}},"engine_version_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"engine_version_to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["cursor","place","areas","signal_key","category","label","unit","direction","run","observed_period","recorded_at","before","after","delta","pct_change","movement","flags","cause","method_releases","engine_version_from","engine_version_to"],"additionalProperties":false}},"successions":{"type":"array","items":{"type":"object","properties":{"from":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"to":{"type":"object","properties":{"place_id":{"type":"string"},"place_type":{"type":"string","enum":["country","nation","region","district","group","neighbourhood"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"type":"string"},"nation":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["place_id","place_type","name","country","nation"],"additionalProperties":false},"areas":{"type":"array","items":{"type":"string"}},"change_kind":{"type":"string","enum":["split","merge","irregular"]},"share":{"anyOf":[{"type":"number"},{"type":"null"}]},"effective_on":{"anyOf":[{"type":"string"},{"type":"null"}]},"recorded_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["from","to","areas","change_kind","share","effective_on","recorded_at","source"],"additionalProperties":false}},"next_after":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"complete_through":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"notes":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","properties":{"engine_version":{"type":"string"},"generated_at":{"type":"string"}},"required":["engine_version","generated_at"],"additionalProperties":false}},"required":["portfolio_id","since","threshold_pct","min_confidence","causes","places_held","areas_without_place","entries","successions","next_after","complete_through","notes","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/score":{"post":{"summary":"Score an area","tags":["Scores"],"description":"Deterministic composite score for an area by preset or custom weights. Returns component dimensions + confidence.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["area"],"properties":{"area":{"type":"string","minLength":1,"description":"UK postcode or place name."},"preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","additionalProperties":{"type":"number","exclusiveMinimum":0},"description":"Custom dimension weights. Keys are the seven fixed categories: crime, deprivation, property, schools, amenities, transport, environment. Every preset accepts the same keys; intent is expressed through their relative size.","example":{"crime":20,"deprivation":10,"property":20,"schools":20,"amenities":10,"transport":15,"environment":5}},"preset_id":{"type":"string","description":"Org-saved preset ID. Mutually exclusive with preset/weights."},"explain":{"type":"boolean"},"bundle":{"type":"string","description":"Optional bundle ID to scope available signals."},"cohort":{"type":"string","minLength":1,"description":"Slug of one of your org's cohorts. Transport, schools and amenities then rank against the cohort's members instead of neighbourhoods of the same kind; the response's `reference` says which was used. A cohort needs at least 30 areas with stored signals."}},"example":{"area":"M1 1AE","preset":"business","weights":{"crime":5,"deprivation":15,"property":15,"schools":5,"amenities":25,"transport":20,"environment":15}}}}}},"parameters":[{"schema":{"type":"string"},"in":"query","name":"bundle","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"explain","required":false}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"area":{"type":"string"},"preset":{"type":"string"},"score":{"type":"number"},"area_type":{"anyOf":[{"type":"string","enum":["urban","suburban","rural"]},{"type":"null"}]},"rural_urban":{"anyOf":[{"type":"string"},{"type":"null"}]},"dimensions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"score":{"type":"number"},"weight":{"type":"number"},"confidence":{"type":"number","minimum":0,"maximum":1},"reasoning":{"type":"string"},"confidence_reason":{"type":"string"}},"required":["key","label","score","weight","confidence","reasoning","confidence_reason"],"additionalProperties":false}},"confidence":{"type":"number","minimum":0,"maximum":1},"weights_source":{"type":"string","enum":["preset","custom"]},"reference":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["band"]},"band":{"type":"string","enum":["urban","suburban","rural"]}},"required":["kind","band"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["cohort"]},"slug":{"type":"string"},"name":{"type":"string"},"areas":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","slug","name","areas"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["national"]},"scope":{"type":"string","enum":["GB"]},"reason":{"type":"string","enum":["area_type_unavailable"]}},"required":["kind","scope","reason"],"additionalProperties":false}]},"engine_version":{"type":"string"},"summary":{"type":"string"},"recommendations":{"type":"array","items":{"type":"string"}},"data_sources":{"type":"array","items":{"type":"string"}}},"required":["area","preset","score","area_type","rural_urban","dimensions","confidence","weights_source","reference","engine_version"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}}}}},"/v1/portfolios":{"post":{"summary":"Create portfolio","tags":["Portfolios"],"description":"Create a new portfolio to track a book of areas.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200,"description":"Required. Rejected by the handler when missing."}},"example":{"name":"London investments"}}}}},"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"area_count":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","name"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List portfolios","tags":["Portfolios"],"description":"List all portfolios for the authenticated user.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"portfolios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"area_count":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","name"],"additionalProperties":false}}},"required":["portfolios"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}":{"get":{"summary":"Get portfolio","tags":["Portfolios"],"description":"Get a portfolio with its tracked areas.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"area_count":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"areas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"area":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"place_id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","area","label"],"additionalProperties":false}}},"required":["id","name","areas"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete portfolio","tags":["Portfolios"],"description":"Delete a portfolio and its tracked areas.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Rename portfolio","tags":["Portfolios"],"description":"Rename an existing portfolio.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Required. Rejected by the handler when missing."}},"example":{"name":"Renamed portfolio"}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"area_count":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","name"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}/areas":{"post":{"summary":"Add areas to portfolio","tags":["Portfolios"],"description":"Add one or more areas to a portfolio.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["areas"],"properties":{"areas":{"type":"array","items":{"type":"object","required":["area"],"properties":{"area":{"type":"string","minLength":1},"label":{"type":"string","nullable":true}}},"minItems":1}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"number"},"portfolio":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"area_count":{"type":"number"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"areas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"area":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"place_id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","area","label"],"additionalProperties":false}}},"required":["id","name","areas"],"additionalProperties":false}},"required":["added","portfolio"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}/areas/{area}":{"delete":{"summary":"Remove area from portfolio","tags":["Portfolios"],"description":"Remove a single tracked area from a portfolio.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"area","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"boolean"}},"required":["removed"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}/enrich":{"post":{"summary":"Enrich portfolio","tags":["Portfolios"],"description":"Bulk-score every area in the portfolio.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"preset":{"type":"string","enum":["moving","business","investing","research"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"score":{"anyOf":[{"type":"object","properties":{"area":{"type":"string"},"preset":{"type":"string"},"score":{"type":"number"},"area_type":{"anyOf":[{"type":"string","enum":["urban","suburban","rural"]},{"type":"null"}]},"rural_urban":{"anyOf":[{"type":"string"},{"type":"null"}]},"dimensions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"score":{"type":"number"},"weight":{"type":"number"},"confidence":{"type":"number","minimum":0,"maximum":1},"reasoning":{"type":"string"},"confidence_reason":{"type":"string"}},"required":["key","label","score","weight","confidence","reasoning","confidence_reason"],"additionalProperties":false}},"confidence":{"type":"number","minimum":0,"maximum":1},"weights_source":{"type":"string","enum":["preset","custom"]},"reference":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["band"]},"band":{"type":"string","enum":["urban","suburban","rural"]}},"required":["kind","band"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["cohort"]},"slug":{"type":"string"},"name":{"type":"string"},"areas":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","slug","name","areas"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["national"]},"scope":{"type":"string","enum":["GB"]},"reason":{"type":"string","enum":["area_type_unavailable"]}},"required":["kind","scope","reason"],"additionalProperties":false}]},"engine_version":{"type":"string"},"summary":{"type":"string"},"recommendations":{"type":"array","items":{"type":"string"}},"data_sources":{"type":"array","items":{"type":"string"}}},"required":["area","preset","score","area_type","rural_urban","dimensions","confidence","weights_source","reference","engine_version"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["area","label","score","error"],"additionalProperties":false}}},"required":["count","results"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/portfolios/{id}/changes":{"post":{"summary":"Detect portfolio changes","tags":["Portfolios"],"description":"Detect material signal changes for tracked areas between periods.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"baseline":{"type":"string","enum":["previous","first"]},"threshold_pct":{"type":"number","minimum":0},"min_transactions":{"type":"number","minimum":0},"emit":{"type":"boolean"},"cause":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]},"description":"List only changes with these causes; webhooks fire for the listed changes only. Default every cause."}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"portfolio_id":{"type":"string"},"baseline":{"type":"string","enum":["previous","first"]},"threshold_pct":{"type":"number"},"min_transactions":{"type":"number"},"areas_checked":{"type":"number"},"material_count":{"type":"number"},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"changes":{"type":"array","items":{"type":"object","properties":{"signal_key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"area":{"type":"string"},"geo_code":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"value_from":{"anyOf":[{"type":"number"},{"type":"null"}]},"value_to":{"anyOf":[{"type":"number"},{"type":"null"}]},"delta":{"anyOf":[{"type":"number"},{"type":"null"}]},"pct_change":{"anyOf":[{"type":"number"},{"type":"null"}]},"direction":{"type":"string","enum":["up","down","flat"]},"material":{"type":"boolean"},"cause":{"type":"string","enum":["source","method","source_and_method"]},"method_releases":{"type":"array","items":{"type":"string"}},"engine_version_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"engine_version_to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["signal_key","label","area","geo_code","period_from","period_to","value_from","value_to","delta","pct_change","direction","material","cause","method_releases","engine_version_from","engine_version_to"],"additionalProperties":false}},"generated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["portfolio_id","baseline","threshold_pct","min_transactions","areas_checked","material_count","causes","changes","generated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"Probe portfolio changes (read-only)","tags":["Portfolios"],"description":"Read-only variant of POST /changes. Detects material signal changes for tracked areas without triggering webhooks. Use this for dashboards and previews; use POST when you want the side-effects.","parameters":[{"schema":{"type":"string"},"in":"query","name":"cause","required":false,"description":"List only changes with these causes, comma separated: source, method, source_and_method. Default every cause."},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"portfolio_id":{"type":"string"},"baseline":{"type":"string","enum":["previous","first"]},"threshold_pct":{"type":"number"},"min_transactions":{"type":"number"},"areas_checked":{"type":"number"},"material_count":{"type":"number"},"causes":{"type":"array","items":{"type":"string","enum":["source","method","source_and_method"]}},"changes":{"type":"array","items":{"type":"object","properties":{"signal_key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"area":{"type":"string"},"geo_code":{"type":"string"},"period_from":{"type":"string"},"period_to":{"type":"string"},"value_from":{"anyOf":[{"type":"number"},{"type":"null"}]},"value_to":{"anyOf":[{"type":"number"},{"type":"null"}]},"delta":{"anyOf":[{"type":"number"},{"type":"null"}]},"pct_change":{"anyOf":[{"type":"number"},{"type":"null"}]},"direction":{"type":"string","enum":["up","down","flat"]},"material":{"type":"boolean"},"cause":{"type":"string","enum":["source","method","source_and_method"]},"method_releases":{"type":"array","items":{"type":"string"}},"engine_version_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"engine_version_to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["signal_key","label","area","geo_code","period_from","period_to","value_from","value_to","delta","pct_change","direction","material","cause","method_releases","engine_version_from","engine_version_to"],"additionalProperties":false}},"generated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["portfolio_id","baseline","threshold_pct","min_transactions","areas_checked","material_count","causes","changes","generated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs":{"post":{"summary":"Create organization","tags":["Orgs"],"description":"Creates a new organization. The caller becomes the owner.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","slug","name","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List organizations","tags":["Orgs"],"description":"List organizations the caller is a member of, with their role.","security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"role":{"type":"string","enum":["owner","admin","member"]}},"required":["id","slug","name","created_at","updated_at","role"],"additionalProperties":false}}},"required":["orgs"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}":{"get":{"summary":"Get organization","tags":["Orgs"],"description":"Get organization details by ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","slug","name","created_at","updated_at"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete organization","tags":["Orgs"],"description":"Delete an organization and every row that references it (members, presets, bundles, cohorts, invitations). Owner-only. Personal orgs cannot be deleted.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update organization","tags":["Orgs"],"description":"Update organization name, slug, or white-label settings.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"display_name":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string","maxLength":500,"format":"uri"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string","maxLength":2000,"format":"uri"},{"type":"null"}]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","slug","name","created_at","updated_at"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/members":{"get":{"summary":"List members","tags":["Orgs"],"description":"List all members of an organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"org_id":{"type":"string","minLength":1},"user_id":{"type":"string","minLength":1},"role":{"type":"string","enum":["owner","admin","member"]},"joined_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["org_id","user_id","role","joined_at","email","name"],"additionalProperties":false}},"org_id":{"type":"string"},"caller_role":{"type":"string"}},"required":["members","org_id","caller_role"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"summary":"Add member","tags":["Orgs"],"description":"Add an existing user to the organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","minLength":1},"role":{"type":"string","enum":["owner","admin","member"]}},"required":["user_id"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/members/{userId}":{"patch":{"summary":"Update member role","tags":["Orgs"],"description":"Change a member's role in the organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member"]}},"required":["role"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Remove member","tags":["Orgs"],"description":"Remove a member from the organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"userId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/invitations":{"post":{"summary":"Create invitation","tags":["Invitations"],"description":"Create an invitation to join the organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"default":"member","type":"string","enum":["member","admin"]}},"required":["email","role"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"invitation":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"type":"string","enum":["member","admin"]},"invited_by_user_id":{"type":"string","minLength":1},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","email","role","invited_by_user_id","expires_at","created_at"],"additionalProperties":false}},"required":["invitation"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List invitations","tags":["Invitations"],"description":"List pending invitations for the organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"type":"string","enum":["member","admin"]},"invited_by_user_id":{"type":"string","minLength":1},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","email","role","invited_by_user_id","expires_at","created_at"],"additionalProperties":false}}},"required":["invitations"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/invitations/{invitationId}":{"delete":{"summary":"Revoke invitation","tags":["Invitations"],"description":"Revoke a pending invitation.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"invitationId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean","enum":[true]}},"required":["revoked"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/invitations/{token}/accept":{"post":{"summary":"Accept invitation","tags":["Invitations"],"description":"Accept an organization invitation by token.","parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"org_id":{"type":"string"},"org_slug":{"type":"string"},"org_name":{"type":"string"},"role":{"type":"string"}},"required":["org_id","org_slug","org_name","role"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/bundles":{"post":{"summary":"Create bundle","tags":["Bundles"],"description":"Create a signal bundle for an organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"signal_keys":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}},"required":["name","signal_keys"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"signal_keys":{"type":"array","items":{"type":"string","minLength":1}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","signal_keys","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List bundles","tags":["Bundles"],"description":"List signal bundles for an organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"signal_keys":{"type":"array","items":{"type":"string","minLength":1}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","signal_keys","created_at","updated_at"],"additionalProperties":false}},"org_id":{"type":"string"},"caller_role":{"type":"string"}},"required":["bundles","org_id","caller_role"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/bundles/{bundleId}":{"get":{"summary":"Get bundle","tags":["Bundles"],"description":"Get a signal bundle by ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"bundleId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"signal_keys":{"type":"array","items":{"type":"string","minLength":1}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","signal_keys","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update bundle","tags":["Bundles"],"description":"Update a signal bundle's name or signal keys.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"signal_keys":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"bundleId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"signal_keys":{"type":"array","items":{"type":"string","minLength":1}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","signal_keys","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete bundle","tags":["Bundles"],"description":"Delete a signal bundle.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"bundleId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/presets":{"post":{"summary":"Create preset","tags":["Presets"],"description":"Create a scoring preset for an organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}}},"required":["name","base_preset","weights"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","base_preset","weights","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List presets","tags":["Presets"],"description":"List scoring presets for an organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"presets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","base_preset","weights","created_at","updated_at"],"additionalProperties":false}},"org_id":{"type":"string"},"caller_role":{"type":"string"}},"required":["presets","org_id","caller_role"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/presets/{presetId}":{"get":{"summary":"Get preset","tags":["Presets"],"description":"Get a scoring preset by ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"presetId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","base_preset","weights","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update preset","tags":["Presets"],"description":"Update a scoring preset's name, base preset, or weights.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"presetId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"base_preset":{"type":"string","enum":["moving","business","investing","research"]},"weights":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"type":"number","exclusiveMinimum":0}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","base_preset","weights","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete preset","tags":["Presets"],"description":"Delete a scoring preset.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"presetId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/cohorts":{"post":{"summary":"Create cohort","tags":["Cohorts"],"description":"Create an area cohort for an organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"geo_codes":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"string","minLength":1,"maxLength":20}}},"required":["name","geo_codes"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"geo_codes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":20}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","geo_codes","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"rejected":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"reason":{"type":"string"}},"required":["input","reason"],"additionalProperties":false}}},"required":["error","code","rejected"],"additionalProperties":false},{"type":"object","properties":{"statusCode":{"type":"number"},"code":{"type":"string"},"error":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","code","error","message"],"additionalProperties":false}]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"get":{"summary":"List cohorts","tags":["Cohorts"],"description":"List area cohorts for an organization.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"cohorts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"geo_codes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":20}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","geo_codes","created_at","updated_at"],"additionalProperties":false}},"org_id":{"type":"string"},"caller_role":{"type":"string"}},"required":["cohorts","org_id","caller_role"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/orgs/{id}/cohorts/{cohortId}":{"get":{"summary":"Get cohort","tags":["Cohorts"],"description":"Get an area cohort by ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"cohortId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"geo_codes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":20}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","geo_codes","created_at","updated_at"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update cohort","tags":["Cohorts"],"description":"Update an area cohort.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9-]+$"},"geo_codes":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"string","minLength":1,"maxLength":20}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"cohortId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"org_id":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"geo_codes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":20}},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","org_id","slug","name","geo_codes","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"rejected":{"type":"array","items":{"type":"object","properties":{"input":{"type":"string"},"reason":{"type":"string"}},"required":["input","reason"],"additionalProperties":false}}},"required":["error","code","rejected"],"additionalProperties":false},{"type":"object","properties":{"statusCode":{"type":"number"},"code":{"type":"string"},"error":{"type":"string"},"message":{"type":"string"}},"required":["statusCode","code","error","message"],"additionalProperties":false}]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete cohort","tags":["Cohorts"],"description":"Delete an area cohort.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"cohortId","required":true}],"security":[{"bearerAuth":[]},{"bridgeToken":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","enum":[true]}},"required":["deleted"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/query":{"post":{"summary":"Query intelligence","tags":["Intelligence"],"description":"Run a query plan or natural-language question against the intelligence moat. Supports rank_areas, get_area, score_area, compare_areas, find_peers, find_insights, and find_forecast. A rank_areas plan on a deprivation signal must set `country` or `lad` (deciles and ranks are relative within a nation), otherwise it is rejected with 422, code `invalid_signal`. Callable without an API key at the anonymous tier's quota (AR-594, Plan 059.2). Natural-language queries on free tiers (anonymous, logged_in, basic) are processed by OpenCode and OpenRouter free models, which may retain prompts for model improvement. Paid tiers and programmatic plan queries do not use these providers.","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"question":{"type":"string","minLength":1}},"required":["question"],"description":"Natural language question.","example":{"question":"best areas for families in London"}},{"type":"object","properties":{"plan":{"type":"object"}},"required":["plan"],"description":"Programmatic plan object."}],"description":"Natural language question or a programmatic plan object."}}},"description":"Natural language question or a programmatic plan object."},"parameters":[{"schema":{"type":"string"},"in":"query","name":"bundle","required":false,"description":"Optional bundle ID to scope available signals."}],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"plan_source":{"type":"string","enum":["client","nl"]},"results":{"anyOf":[{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"meta":{"type":"object","properties":{"generated_at":{"type":"string"}},"required":["generated_at"],"additionalProperties":false}},"required":["plan","plan_source"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false},{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"raw":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}}},"required":["error","code"],"additionalProperties":false}]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["area_not_found","nation_not_covered","ambiguous_area","area_resolution_unavailable","signal_store_unavailable"]},"reason":{"type":"string","enum":["not_found","nation_not_covered","ambiguous","unavailable"]},"source":{"type":"string","enum":["area_resolution","signal_store"]},"candidates":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"postcode":{"type":"string"},"district":{"type":"string"},"country":{"type":"string"}},"required":["label","postcode","district","country"],"additionalProperties":false}},"terminated":{"type":"object","properties":{"year_terminated":{"type":"number"},"month_terminated":{"type":"number"}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error","code","reason","source"],"additionalProperties":false}}}}}}},"/v1/peers":{"post":{"summary":"Find peers","tags":["Intelligence"],"description":"Find k-nearest-neighbour peers for an area by normalized signal values. A retired postcode resolves to the neighbourhood it was in; target.postcode_status and meta.warnings say so.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["target"],"properties":{"target":{"type":"object","required":[],"properties":{"geo_code":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"area":{"type":"string","minLength":1}},"description":"Exactly one of geo_code, postcode, or area must be set."},"signals":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":20,"description":"Subset of signal dimensions to compare on."},"country":{"type":"string","enum":["England","Wales","Scotland"]},"lad":{"type":"string"},"k":{"type":"integer","exclusiveMinimum":0,"maximum":200},"min_signals":{"type":"integer","exclusiveMinimum":0,"maximum":20},"cohort":{"type":"string","minLength":1,"description":"Slug of one of your org's cohorts: candidates are limited to its members."},"cohort_id":{"type":"string","description":"The same, by cohort id. Use one of cohort or cohort_id."}},"example":{"target":{"postcode":"SW1A 1AA"},"k":10}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"object","properties":{"geo_code":{"type":"string"},"signals_used":{"type":"array","items":{"type":"string"}},"postcode_status":{"type":"string","enum":["live","terminated"]},"postcode_terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["geo_code","signals_used"],"additionalProperties":false},"peers":{"type":"array","items":{"type":"object","properties":{"geo_code":{"type":"string"},"distance":{"type":"number"},"n_dims_used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"admin_district":{"anyOf":[{"type":"string"},{"type":"null"}]},"region":{"anyOf":[{"type":"string"},{"type":"null"}]},"sample_postcode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["geo_code","distance","n_dims_used"],"additionalProperties":false}},"meta":{"type":"object","properties":{"generated_at":{"type":"string"},"scope":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["generated_at","scope"],"additionalProperties":false}},"required":["target","peers","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"terminated":{"type":"object","properties":{"year_terminated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"month_terminated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["year_terminated","month_terminated"],"additionalProperties":false},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/insights":{"post":{"summary":"Find insights","tags":["Intelligence"],"description":"Rank areas by anomaly (ABS peer-relative z-score) on a chosen signal.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["signal_key"],"properties":{"signal_key":{"type":"string","minLength":1,"description":"Peer-relative-z derived signal key (e.g. 'crime.total_12m_peer_relative_z')."},"country":{"type":"string","enum":["England","Wales","Scotland"]},"lad":{"type":"string"},"min_abs_z":{"type":"number","minimum":0},"k":{"type":"integer","exclusiveMinimum":0,"maximum":500}},"example":{"signal_key":"crime.total_12m_peer_relative_z","country":"England","k":20}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"signal_key":{"type":"string"},"insights":{"type":"array","items":{"type":"object","properties":{"geo_code":{"type":"string"},"peer_relative_z":{"type":"number"},"abs_z":{"type":"number"}},"required":["geo_code","peer_relative_z","abs_z"],"additionalProperties":false}},"meta":{"type":"object","properties":{"generated_at":{"type":"string"},"scope":{"type":"string"},"threshold":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["generated_at","scope","threshold"],"additionalProperties":false}},"required":["signal_key","insights","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/v1/forecast":{"post":{"summary":"Forecast signal","tags":["Intelligence"],"description":"Project a signal forward in time using linear regression over the trailing window of its monthly history (for example crime.monthly_count; a signal needs at least two months). Each point carries its month as dates. Counts, prices and rates are floored at zero. A retired postcode resolves to the neighbourhood it was in; target.postcode_status and meta.warnings say so.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["target"],"properties":{"target":{"type":"object","properties":{"geo_code":{"type":"string","minLength":1},"postcode":{"type":"string","minLength":1},"area":{"type":"string","minLength":1}},"description":"Exactly one of geo_code, postcode, or area must be set."},"signal_key":{"type":"string","minLength":1},"window_months":{"type":"integer","minimum":6,"maximum":120},"horizon_months":{"type":"integer","exclusiveMinimum":0,"maximum":60}},"example":{"target":{"postcode":"SW1A 1AA"},"signal_key":"crime.monthly_count","window_months":24,"horizon_months":12}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"object","properties":{"geo_code":{"type":"string"},"postcode_status":{"type":"string","enum":["live","terminated"]},"postcode_terminated_on":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["geo_code"],"additionalProperties":false},"signal_key":{"type":"string"},"points":{"type":"array","items":{"type":"object","properties":{"observed_period":{"type":"string"},"period":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},"projected_value":{"type":"number"},"lower_bound":{"type":"number"},"upper_bound":{"type":"number"}},"required":["observed_period","period","projected_value","lower_bound","upper_bound"],"additionalProperties":false}},"meta":{"type":"object","properties":{"warnings":{"type":"array","items":{"type":"string"}},"generated_at":{"type":"string"},"scope":{"type":"string"},"window_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"horizon_months":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"n_observations":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"r2":{"anyOf":[{"type":"number"},{"type":"null"}]},"slope_per_month":{"type":"number"},"intercept":{"type":"number"},"residual_stderr":{"anyOf":[{"type":"number"},{"type":"null"}]},"latest_observed_period":{"type":"string"},"latest_period":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false}},"required":["generated_at","scope","window_months","horizon_months","n_observations","r2","slope_per_month","intercept","residual_stderr","latest_observed_period","latest_period"],"additionalProperties":false}},"required":["target","signal_key","points","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"terminated":{"type":"object","properties":{"year_terminated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"month_terminated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["year_terminated","month_terminated"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}},"required":["error","code"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/contact":{"post":{"summary":"Submit contact form","tags":["Contact"],"description":"Send a contact enquiry. Public endpoint, no auth required.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","email","message"],"properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"role":{"type":"string"},"message":{"type":"string"},"website":{"type":"string"}}}}}},"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}},"servers":[{"url":"https://api.onegoodarea.com"}],"tags":[{"name":"Meta","description":"Health and version endpoints"},{"name":"Reports","description":"Generate and retrieve area reports"},{"name":"Signals","description":"Signal-first neighbourhood profiles and group or district aggregates"},{"name":"Places","description":"The place registry: resolve postcodes, codes and names to permanent place ids"},{"name":"Jobs","description":"Asynchronous work: submit, poll, read the result in pages"},{"name":"Scores","description":"Scoring engine"},{"name":"Portfolios","description":"Portfolio management"},{"name":"Orgs","description":"Organization and member management"},{"name":"Invitations","description":"Org invitations"},{"name":"Bundles","description":"Signal bundles"},{"name":"Presets","description":"Scoring presets"},{"name":"Cohorts","description":"Area cohorts"},{"name":"Intelligence","description":"Query, peers, insights, forecast"},{"name":"Webhooks","description":"Outbound webhook subscriptions"},{"name":"Usage","description":"Plan and quota endpoints"},{"name":"Keys","description":"API key management"},{"name":"Auth","description":"Authentication endpoints"},{"name":"Stripe","description":"Billing and subscriptions"},{"name":"Settings","description":"Account settings"},{"name":"Dashboard","description":"Dashboard composite data"},{"name":"Tracking","description":"Analytics and pageview tracking"},{"name":"Watchlist","description":"Saved areas watchlist"},{"name":"Admin","description":"Admin analytics (superuser only)"},{"name":"Cron","description":"Scheduled jobs"}]}