Txtpaper can be used to create text documents by extracting article content from web pages. (Entirely new text documents can also be created using the web "app" or API).
Documents can be created in the following formats:
- ePub
- mobi (Kindle)
- txt
- markdown
The API can also return extracted web page data as JSON.
GET requests are used to generate documents by extracting content from web pages (via URL).
POST requests are used to create new documents by providing HTML and other data.
Endpoint
https://txtpaper.com/api/v1/
GET
Usage
Syntax
https://txtpaper.com/api/v1/?url=[url]&format=[format]&email=[email]
Example
https://txtpaper.com/api/v1/?url=https://example.com&format=epub&email=bob@bobloblaw.com
Output (JSON)
When format is set to "json" a JSON string is returned.
Here is an example using the URL "http://example.com":
{"title":"Example Domain","url":"http:\/\/example.com\/","word_count":40,"format":"json","content":"<div class=\"page\" id=\"readability-page-1\"><div>\n \n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.<\/p>\n <p><a href=\"https:\/\/www.iana.org\/domains\/example\">More information...<\/a><\/p>\n<\/div><\/div>"}
Parameters
Name | Options | |
url | required | |
format | required | txt | md (Markdown) | epub | mobi | pdf |
columns | optional | Newspaper-style columns. Only used when format is "pdf". |
optional | Send to converted file/text to email recipient (as an attachment). Content will be embeded in email body when format is set to "txt" or "md". | |
title | optional | Set title of document, otherwise Txtpaper will create/extract title. |
POST
Parameters
Name | Options | |
title | optional | Set title of the document. |
byline | required | Set author of document; will be visible in document. |
url | optional | |
content | required | Set HTML used to create the document. |
format | required | txt | md (Markdown) | epub | mobi | pdf |
columns | optional | Newspaper-style columns. Only used when format is "pdf". |
optional | Send to converted file/text to email recipient. (Content will be embed in email body when format is set to "txt" or "md".) |