{"openapi":"3.1.0","info":{"title":"PageHub Content API","version":"1.0.0","description":"Read a site's collections as JSON for any external app. Public collections need no auth; private ones require a `ph_` API key (Bearer) whose user can access the site."},"servers":[{"url":"/"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A `ph_` API key."}},"schemas":{"NormalizedItem":{"type":"object","description":"A collection row mapped to the canonical item shape. Non-reserved fields ALSO appear under `metadata.<key>` and flat at `item.<key>`; use the /schema endpoint to learn each field's path.","properties":{"id":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"image":{"type":"string","description":"First image field, if any."},"images":{"type":"array","items":{"type":"string"}},"price":{"type":"object","properties":{"amount":{"type":"number","description":"Minor units (e.g. cents)."},"currency":{"type":"string"},"formatted":{"type":"string"}}},"metadata":{"type":"object","additionalProperties":true,"description":"Every non-reserved field, keyed by its field key."}},"required":["id","title","metadata"],"additionalProperties":true},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"ListMeta":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"count":{"type":"integer"},"totalCount":{"type":"integer"},"totalPages":{"type":"integer"},"hasMore":{"type":"boolean"}},"required":["page","limit","count","totalCount","totalPages","hasMore"]},"FieldDescriptor":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"},"responsePath":{"type":"string","description":"Where the field reads in an item, e.g. \"title\", \"price.amount\", \"metadata.color\"."},"flatAlias":{"type":"boolean","description":"Also available at item.<key>."}},"required":["key","label","type","required","responsePath","flatAlias"]}}},"paths":{"/api/v1/content/{site}/{collection}":{"get":{"summary":"List collection items","operationId":"listContentItems","security":[{},{"bearerAuth":[]}],"parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"},"description":"Page id."},{"name":"collection","in":"path","required":true,"schema":{"type":"string"},"description":"Collection slug."},{"name":"q","in":"query","schema":{"type":"string"},"description":"Full-text search."},{"name":"category","in":"query","schema":{"type":"string"}},{"name":"sort","in":"query","schema":{"type":"string"},"description":"e.g. price-asc, newest."},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"minPrice","in":"query","schema":{"type":"integer"}},{"name":"maxPrice","in":"query","schema":{"type":"integer"}},{"name":"filter","in":"query","schema":{"type":"string"},"description":"JSON object of equality constraints, e.g. {\"brand\":\"acme\"}."},{"name":"facet.<key>","in":"query","schema":{"type":"string"},"description":"Comma-separated facet values, e.g. ?facet.color=red,blue."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NormalizedItem"}},"meta":{"$ref":"#/components/schemas/ListMeta"}},"required":["data","meta"]}}}},"400":{"description":"Missing site or collection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Auth required (private collection)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not authorized for this site","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"Upstream fetch failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/content/{site}/{collection}/schema":{"get":{"summary":"Describe a collection's fields + response shape","operationId":"getContentSchema","security":[{},{"bearerAuth":[]}],"parameters":[{"name":"site","in":"path","required":true,"schema":{"type":"string"}},{"name":"collection","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"collection":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"isPublic":{"type":"boolean"}}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/FieldDescriptor"}}}}},"required":["data"]}}}},"401":{"description":"Auth required (private collection)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Not authorized for this site","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}