Web API
Any public web page: read it as Markdown with the Web Reader, or send your own HTTP request and get the site's answer back with the Web Unlocker.
The Web API works on public web pages that no other apinoa API covers. It has two products:
- Web Reader reads a page. You pass its address and get its main content as Markdown, its title and metadata (description, author, publication date, site name, language, lead image, favicon) and every schema.org JSON-LD block on it.
- Web Unlocker sends your own HTTP request (the method, headers and body you choose) and returns the site's answer as it arrived: its status, its headers and its body.
curl -G "https://gateway.apinoa.com/v1/reader/page" --data-urlencode "url=https://stephango.com/saw" \
-H "x-api-key: $APINOA_API_KEY"curl -X POST "https://gateway.apinoa.com/v1/unlocker/request" \
-H "x-api-key: $APINOA_API_KEY" -H "Content-Type: application/json" \
-d '{"url": "https://httpbin.org/anything?q=shoes", "method": "POST", "headers": {"content-type": "application/json"}, "body": "{\"q\":\"shoes\"}"}'Operations
| Operation | Endpoint | Returns | What It Does |
|---|---|---|---|
reader/page | GET | POST /v1/reader/page | ReaderPage | Reads a page at url as Markdown, with its metadata and JSON-LD |
unlocker/request | POST /v1/unlocker/request | UnlockResult | Sends your request to url and returns the site's status, headers and body |
Which One to Use
| You Want | Use |
|---|---|
| The text of an article, a docs page, a blog post or a product page, ready for a model or a search index | Web Reader |
| A page's title, author, date and schema.org JSON-LD | Web Reader |
| To call an API with your own key, post a form, or fetch JSON, XML or a file | Web Unlocker |
| The site's exact answer: its status, every header, its cookies, its body byte for byte | Web Unlocker |
| Data from a platform apinoa has its own API for (Amazon, Walmart, Google, YouTube, Reddit, TikTok, Instagram, …) | That platform's API. It returns structured data, and the Web Unlocker refuses those sites, naming the API to call |
The Web Reader also returns the page's HTML on request (include=html), so a page you want both as Markdown and as
HTML is one call.
What Is the Same Everywhere
- Sent as a real browser. Every request goes out with a real browser's identity, and a request a site blocks is
retried automatically. A page that is still behind a bot check is an error,
UPSTREAM_UNAVAILABLE, and is not billed: a bot-check page is never returned as if it were the site's answer. - The site's status is the site's. A
404page, a500or a plain403is what the site answered. It is returned with its status instatus, and billed. Checkstatusbefore you use the content. - Redirects are followed. The address that finally answered is in
finalUrl(Reader) orurl(Unlocker). - Public sites only. Private and internal addresses (
localhost,10.0.0.0/8,192.168.0.0/16and the like) are refused withINVALID_PARAMS. - Certificates are checked. A site whose TLS certificate is not valid is not reached: the call fails with
UPSTREAM_UNAVAILABLE. - No JavaScript is run. Both return what the site's server sends. A page that builds its content in the browser with JavaScript comes back with little or no text; call the JSON endpoint it loads its data from instead, with the Web Unlocker.
- Country. Requests are sent from the US (
country=US, the only value).
Billing
- Web Reader: 1 credit a page, up to 5 MiB.
- Web Unlocker: 1 credit per started MiB of the answer's body: up to 1 MiB costs 1 credit, 1.2 MiB costs 2 credits, and the largest answer, 10 MiB, costs 10 credits.
- A site's own error page is an answer, and is billed. A call that fails with an error is not.
Errors
The same envelope and codes as the rest of the API. See Errors.
| Status | Code | When |
|---|---|---|
| 400 | INVALID_PARAMS | A parameter is missing or out of range; the address is private or internal; (Reader) the address is not a web page, such as a PDF or an image, and the message names its content type; (Unlocker) the site is one the Unlocker does not send to, and the message names the API to call instead |
| 400 | UPSTREAM_TOO_LARGE | The answer is larger than the limit: 5 MiB for the Reader, 10 MiB for the Unlocker |
| 503 | UPSTREAM_UNAVAILABLE | The site stayed behind a bot check, or could not be reached (no such host, connection refused, invalid certificate). Retry later |
Failed calls are not billed.
Reference
- Response Schema: every field of
ReaderPageandUnlockResult - Errors: every error code