# API

The [front-end for inscribe.news](https://inscribe.news) is powered by Cloudflare Pages, and contains not only the website but also a powerful API and indexer to interact *with any inscription and it's content*.

The following API endpoints are available and [documented at the root of the API](https://inscribe.news/api), where **ID** is either the inscription ID or the inscription number.

<table><thead><tr><th width="231">URL</th><th>Description</th></tr></thead><tbody><tr><td>/api/info/ID</td><td>Returns on-chain inscription information as JSON </td></tr><tr><td>/api/content/ID</td><td>Returns on-chain inscription content, based on mime type</td></tr><tr><td>/api/news/ID</td><td>Returns HTML by parsing the inscription body <em>(news only)</em></td></tr><tr><td>/api/data/ID</td><td>Returns the inscription info and content above in one call as JSON <em>(news only)</em></td></tr><tr><td>/api/data/ord-news</td><td>Returns all indexed and valid news inscriptions</td></tr><tr><td>/api/data/ord-list</td><td>Returns all indexed inscriptions</td></tr></tbody></table>

This API creates a cached layer of inscription data, and everything is returned from the edge when available. If not, the data is fetched then stored from the [Hiro Ordinals API](https://docs.hiro.so/ordinals) for future reads.

The API code exists in the [/functions directory of the project](https://github.com/OrdinalNews/client/tree/main/functions/api), and Typescript types are available [in this helper file](https://github.com/OrdinalNews/client/blob/main/lib/api-types.ts).

{% hint style="info" %}
This API is free to use for any website, if you find it useful or run into any errors, please [file an issue on GitHub](https://github.com/ordinalnews/client/issues)!
{% endhint %}

### Fetching all Data

The `/api/data/ord-news` and `/api/data/ord-list` endpoints return a list of keys found in the KV namespace, and supports the following query parameters:

<table><thead><tr><th width="237">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>cursor</td><td>If <code>list_complete</code> is false, this value can be used to call again to get the next batch.</td></tr><tr><td>prefix</td><td>Return a list of keys starting with a particular prefix.</td></tr><tr><td>limit</td><td>Modify the number of results returned, default/max 1,000.</td></tr></tbody></table>
