Hugging Face README Search API
Search the words inside repository files, mostly READMEs, with a matched snippet and the repository it came from.
GET /v1/hugging-face/search/readmes1 credit Failed requests are free
About this endpoint
GET /v1/hugging-face/search/readmes takes a required query, an optional type (model, dataset or space), limit up to 100 and a page number from 1. It returns estimatedTotalHits, hits and a page block.
Each hit has repoId, type, url, fileName, isReadme, likes, updatedAt, tags, snippet and line. The snippet holds about 300 characters either side of the first match, with the match wrapped in **. The deepest page starts after 500 skipped hits because the platform slows down for each one.
Hugging Face README Search API FAQ
Why does the search stop after 500 skipped hits?
The platform takes longer for every hit it skips and gives up after about 12 seconds. A page that would start past hit 500 is refused with a 400 instead of waiting for that failure.
How do I get the next page?
Pass page.nextPage as page while page.hasMore is true. page.nextOffset reports the hit the next page starts at.
What does the snippet show?
About 300 characters either side of the first match, with the match in double asterisks and an ellipsis where the file continues.
How much does a README search cost?
Pricing is documented on the operation in the API registry (shown on this page). Confirm on every response with meta.creditsCharged: that field is the billing source of truth. Each paginated page is a separate billed request.
Other Hugging Face endpoints
- Search modelsGET /v1/hugging-face/models
- Get modelGET /v1/hugging-face/models/{owner}/{name}
- Search datasetsGET /v1/hugging-face/datasets
- Get datasetGET /v1/hugging-face/datasets/{owner}/{name}
- Search SpacesGET /v1/hugging-face/spaces
- Get SpaceGET /v1/hugging-face/spaces/{owner}/{name}
- READMEGET /v1/hugging-face/repos/{repoType}/{owner}/{name}/readme
- FilesGET /v1/hugging-face/repos/{repoType}/{owner}/{name}/files