{"openapi":"3.1.0","info":{"title":"SharpWrite content API","version":"1.0.0","summary":"Read published content from a SharpWrite site.","description":"A small, read-only JSON API that is identical on SharpWrite Cloud and Self-host. Authenticate with an API key as a bearer token. A key belongs to one site and can read only that site. There is no endpoint to create, change, publish or delete content over REST: content is written in the app, or saved as drafts over the MCP endpoint (`/api/mcp`). Each key may make 120 requests a minute. Documentation: https://sharpwritecms.com/docs/api. Reference for AI assistants: https://sharpwritecms.com/docs/ai-reference.md","contact":{"name":"SharpWrite support","email":"hello@sharpwritecms.com","url":"https://sharpwritecms.com"}},"servers":[{"url":"{baseUrl}","description":"SharpWrite Cloud, or the address of your own Self-host install.","variables":{"baseUrl":{"default":"https://app.sharpwritecms.com","description":"No trailing slash."}}}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Content","description":"Published entries and pages."}],"paths":{"/api/public/v1/{type}":{"get":{"tags":["Content"],"operationId":"listEntries","summary":"List entries of a content type","description":"Published entries, newest first. With a valid preview token, drafts are included too, most recently changed first, and each entry has a `status`.","parameters":[{"name":"type","in":"path","required":true,"description":"The API id of the content type, for example `posts`. Pages built with the page builder use `site-pages`.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"How many entries to return, 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"offset","in":"query","required":false,"description":"How many entries to skip, 0 to 100000. Request again with `offset += limit` until `pagination.count` is less than `limit`.","schema":{"type":"integer","minimum":0,"maximum":100000,"default":0}},{"name":"X-Preview-Token","in":"header","required":false,"description":"A preview token (`sw_prev_...`). With a valid API key it makes drafts visible as well as published entries. Never use it in browser code.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of entries.","headers":{"Cache-Control":{"description":"Published responses: `public, s-maxage=30, stale-while-revalidate=300`. Preview responses: `private, no-store`.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntryList"}}}},"400":{"description":"Invalid query: `limit` must be 1 to 100 and `offset` 0 or more.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, invalid or revoked API key, or a wrong or expired preview token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown content type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. The `Retry-After` header says when to try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/v1/{type}/{slug}":{"get":{"tags":["Content"],"operationId":"getEntry","summary":"Get one entry by slug","description":"A published entry. A draft or unknown slug answers 404, unless a valid preview token is sent.","parameters":[{"name":"type","in":"path","required":true,"description":"The API id of the content type, for example `posts`. Pages built with the page builder use `site-pages`.","schema":{"type":"string"}},{"name":"slug","in":"path","required":true,"description":"The entry's slug, for example `hello-world`.","schema":{"type":"string"}},{"name":"X-Preview-Token","in":"header","required":false,"description":"A preview token (`sw_prev_...`). With a valid API key it makes drafts visible as well as published entries. Never use it in browser code.","schema":{"type":"string"}}],"responses":{"200":{"description":"The entry.","headers":{"Cache-Control":{"description":"Published responses: `public, s-maxage=30, stale-while-revalidate=300`. Preview responses: `private, no-store`.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntryResponse"}}}},"401":{"description":"Missing, invalid or revoked API key, or a wrong or expired preview token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown content type, or an unknown or unpublished entry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests. The `Retry-After` header says when to try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An API key from the app (under MCP), for example `sw_live_...`. Keep it on your server."}},"schemas":{"Entry":{"type":"object","required":["id","slug","publishedAt","updatedAt","data"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"publishedAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["draft","published"],"description":"Only present in preview responses."},"data":{"type":"object","description":"The entry's fields, keyed by field API id. Short and long text and choice lists are strings, numbers are numbers, yes/no is a boolean, dates are `YYYY-MM-DD` strings and rich text is a sanitised HTML string. Only fields that exist on the type are returned, and an optional field that was never filled in may be missing. For `site-pages`, `data` holds `title`, `description`, `isHome` and `blocks` (the page's widgets).","additionalProperties":true}}},"EntryResponse":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Entry"}}},"EntryList":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Entry"}},"pagination":{"type":"object","required":["limit","offset","count"],"properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"count":{"type":"integer","description":"How many entries are in this response."}}}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["message"],"properties":{"message":{"type":"string"}}}}}}}}