Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 2.58 KB

api.md

File metadata and controls

33 lines (23 loc) · 2.58 KB

API

The front-end for 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, where ID is either the inscription ID or the inscription number.

URL Description
/api/info/ID Returns on-chain inscription information as JSON
/api/content/ID Returns on-chain inscription content, based on mime type
/api/news/ID Returns HTML by parsing the inscription body (news only)
/api/data/ID Returns the inscription info and content above in one call as JSON (news only)
/api/data/ord-news Returns all indexed and valid news inscriptions
/api/data/ord-list Returns all indexed inscriptions

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 for future reads.

The API code exists in the /functions directory of the project, and Typescript types are available in this helper file.

{% 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! {% 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:

Parameter Description
cursor If list_complete is false, this value can be used to call again to get the next batch.
prefix Return a list of keys starting with a particular prefix.
limit Modify the number of results returned, default/max 1,000.