/api/v1/ai/pages/{slug}/transformRewrite a selection
Rewrites text from a page you can edit: improves, shortens or fixes it, changes its tone, translates it, or turns it into a checklist, a table or an explanation. Streams the result as server-sent events: delta events with text as it's written, then done (or limit when a limit stops it). Nothing changes on the page: the result is a suggestion.
Guide: AI in pages
Code samples and Try itPath parameters
#slugstringRequiredThe document's address: the part after
markdrop.in/.
Headers
#X-Edit-SecretstringThe document's edit secret (
sk_…), for a document published without an account. See Edit key.
Request body
#application/json, required
actionstringRequiredimprove,shorten,fix,tone,translate,checklist,tableorexplain. Up to 20 characters.textstringRequiredThe selected text. Up to 14,000 characters.
tonestringFor
tone:professional,friendlyorconcise. Up to 20 characters.langstringFor
translate: the language, in English, likeSpanish. Up to 40 characters.beforestringText just before the selection, for context. Up to 2,000 characters.
afterstringText just after the selection, for context. Up to 2,000 characters.
Responses
#200OK.401No token, or the token is revoked or mistyped.422The request didn't validate.detaillists each problem, with where it is (loc) and why (msg).429Too many requests from your IP address. Wait the seconds inRetry-After.