{"openapi":"3.1.0","info":{"title":"AI Business Data - Public API","version":"1.0.0","description":"Read-only public API over the AI Business Data registry. Every response contains ONLY owner-published, owner-confirmed public data. Unpublished businesses and private fields never appear and never influence search matches. Rate limited to 30 requests per minute per client IP across all modes."},"servers":[{"url":"https://lxkcndzzcucamklnghhx.supabase.co/functions/v1/public-business-api"}],"paths":{"/":{"get":{"summary":"Query the ABD public API","description":"Exactly one mode per request: a business id, or action=search | taxonomy | docs. Search requires at least one filter (category, capability, city, area, or attributes); an unfiltered search returns an empty result by design — this does not mean the database contains no businesses. Search results are paginated with limit (default 20, max 50) and offset (0-9000); has_more indicates more pages.","parameters":[{"name":"id","in":"query","required":false,"description":"Business UUID. Returns one record; {\"published\": false} when not published or unknown.","schema":{"type":"string","format":"uuid"}},{"name":"action","in":"query","required":false,"description":"Alternative mode: search | taxonomy | docs.","schema":{"type":"string","enum":["search","taxonomy","docs"]}},{"name":"category","in":"query","required":false,"description":"Category code (see action=taxonomy). Case-insensitive exact match. Example: category=CAT-HVAC.","schema":{"type":"string","maxLength":80}},{"name":"capability","in":"query","required":false,"description":"Capability code. Only capabilities the owner marked offered ('yes') and confirmed public ever match.","schema":{"type":"string","maxLength":80}},{"name":"city","in":"query","required":false,"description":"Public location city. Case-insensitive exact match.","schema":{"type":"string","maxLength":80}},{"name":"area","in":"query","required":false,"description":"Public service-area name. Case-insensitive exact match.","schema":{"type":"string","maxLength":80}},{"name":"attributes","in":"query","required":false,"description":"JSON object of approved-attribute filters, e.g. {\"dbs_certified\":true}. Max 5 entries. Only owner-confirmed public attributes ever match.","content":{"application/json":{"schema":{"type":"object","maxProperties":5,"additionalProperties":{"type":["string","number","boolean"]}}}}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":20}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":9000,"default":0}}],"responses":{"200":{"description":"Successful response; shape depends on the mode (see components.schemas)."},"400":{"description":"Invalid input. Common causes: bad UUID; a category or capability code not matching [a-z0-9_-]{1,80} (codes are case-insensitive, e.g. CAT-AIR-CON); city or area longer than 80 characters; attributes not a JSON object of at most 5 code:scalar pairs; limit outside 1-50; offset outside 0-9000; unknown action."},"405":{"description":"Method not allowed (GET only)."},"429":{"description":"Rate limit exceeded (30 requests/minute per client). Retry after the number of seconds in the Retry-After header."},"500":{"description":"Lookup failed."},"503":{"description":"Rate limiting is temporarily unavailable; the request was not processed. Retry after the Retry-After period."}}}}},"components":{"schemas":{"RecordResponse":{"type":"object","properties":{"published":{"type":"boolean"},"record":{"type":"object","description":"Present only when published. Every block is additionally gated by the owner's visibility switches and per-row public flags; taxonomy and attributes must also be owner-confirmed; capabilities must be owner-marked offered.","properties":{"business_id":{"type":"string","format":"uuid"},"business":{"type":["object","null"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"website":{"type":"string"}}},"service_areas":{"type":"array","items":{"type":"object","properties":{"area_type":{"type":"string"},"area_name":{"type":"string"},"radius_km":{"type":["number","null"]}}}},"locations":{"type":"array","description":"Coarse locations only: never addresses, postcodes or coordinates.","items":{"type":"object","properties":{"location_type":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"country_code":{"type":"string"}}}},"contacts":{"type":"array","items":{"type":"object","properties":{"contact_type":{"type":"string"},"value":{"type":"string"},"preferred":{"type":"boolean"}}}},"categories":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}}},"capabilities":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}}},"attributes":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"value_type":{"type":"string","enum":["boolean","number","text","date"]},"value":{}}}}}}}},"SearchResponse":{"type":"object","description":"Filters combine with AND. At least one search filter is required: category, capability, city, area, or attributes. An unfiltered search returns an empty result by design. This does not mean the database contains no businesses. results is empty (count 0) when no published business matches the filters.","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/RecordResponse/properties/record"}},"has_more":{"type":"boolean","description":"True when more results exist beyond this page; pass offset=offset+limit."},"count":{"type":"integer","description":"Number of records on this page (1-50)."}}},"TaxonomyResponse":{"type":"object","description":"The shared, active vocabulary. Contains no business-specific data.","properties":{"categories":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}}},"capabilities":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"}}}},"attributes":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"value_type":{"type":"string","enum":["boolean","number","text","date"]}}}}}}}}}