{"openapi":"3.1.0","info":{"title":"url2text API","version":"1.0.0","description":"Read the main article text of a public web page as Markdown or plain text, WeChat articles and SEC filings included, whole or in parts. Free, no key."},"servers":[{"url":"https://url2text.netlify.app"}],"externalDocs":{"url":"https://url2text.netlify.app/docs/api"},"paths":{"/api/extract":{"get":{"operationId":"extractArticle","summary":"Extract a page's main article text","parameters":[{"name":"url","in":"query","required":true,"description":"The http or https address of the page.","schema":{"type":"string","format":"uri"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["markdown","text"],"description":"markdown or text answers with just the article as text/markdown or text/plain; leave out for JSON."}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"With format: answer in parts of about 20,000 tokens from this character of the article; each part ends with the next offset."}},{"name":"max_chars","in":"query","required":false,"schema":{"type":"integer","minimum":1000,"description":"With format: the most characters in a part."}}],"responses":{"200":{"description":"The article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Extraction"}},"text/markdown":{"schema":{"type":"string"}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"The link can't be read (not http or https, a private address, a bad address)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"413":{"description":"The page is over 16 MB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"415":{"description":"The link is a file, not a web page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"The page is missing, has no readable article, needs a login or refuses reading tools, or its site doesn't exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"429":{"description":"More than 30 pages in a minute from one address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"500":{"description":"url2text itself failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"502":{"description":"The site failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"504":{"description":"The site took longer than 9 seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}}}},"post":{"operationId":"extractArticlePost","summary":"Extract a page's main article text (JSON body)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"format":{"type":"string","enum":["markdown","text"],"description":"markdown or text answers with just the article as text/markdown or text/plain; leave out for JSON."},"offset":{"type":"integer","minimum":0,"description":"With format: answer in parts of about 20,000 tokens from this character of the article; each part ends with the next offset."},"max_chars":{"type":"integer","minimum":1000,"description":"With format: the most characters in a part."}},"required":["url"]}}}},"responses":{"200":{"description":"The article","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Extraction"}},"text/markdown":{"schema":{"type":"string"}},"text/plain":{"schema":{"type":"string"}}}},"4XX":{"description":"The link can't be read; see GET for the statuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}},"5XX":{"description":"The site failed or was too slow, or url2text failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}},"text/plain":{"schema":{"type":"string"}}}}}}},"/api/version":{"get":{"operationId":"version","summary":"Health check: the deployed commit","responses":{"200":{"description":"The service is up","content":{"application/json":{"schema":{"type":"object","properties":{"sha":{"type":"string"}}}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"Extraction":{"type":"object","properties":{"url":{"type":"string","description":"The page address after redirects"},"title":{"type":"string"},"byline":{"type":["string","null"]},"siteName":{"type":"string","description":"The site's host name, without www."},"excerpt":{"type":["string","null"]},"lang":{"type":["string","null"],"description":"The language the page declares"},"words":{"type":"integer"},"unit":{"type":"string","enum":["words","characters"]},"markdown":{"type":"string","description":"The article as Markdown"},"text":{"type":"string","description":"The article as plain paragraphs"},"headings":{"type":"array","items":{"type":"string"},"description":"Display only"},"tables":{"type":"array","description":"Display only"},"tableSpans":{"type":"array","description":"Display only"},"images":{"type":"array","description":"Display only: pictures, each with `at`, the paragraph of `text` it comes before"}},"required":["url","title","words","unit","markdown","text"]}}}}