Hugging Face Files API
Walk a repository tree with file sizes, git ids, large-file details and optional last commits.
GET /v1/hugging-face/repos/{repoType}/{owner}/{name}/files1 credit Failed requests are free
About this endpoint
GET /v1/hugging-face/repos/{repoType}/{owner}/{name}/files returns repo, reason, a page of files and a page block. Each entry has path, type (file or directory), sizeBytes, blobId, lfs (large-file details or null) and lastCommit.
Use path to list below a folder and recursive=true to walk everything. includeLastCommit=true adds the commit that touched each file, and pages are then limited to 100 entries. revision, limit up to 1000 and cursor control the listing. When nothing is found, reason says whether the repository or only the folder is missing; repo is still present when the repository exists.
Hugging Face Files API FAQ
Why is my limit refused when includeLastCommit=true?
The platform refuses a page of more than 100 files with their last commits, so the request is refused with a 400. Use 100 or less.
Does lfs tell me whether a file is too large to read?
lfs is present when the file is stored in large-file storage. It carries sha256, sizeBytes and pointerSize.
Why is repo present when nothing was found?
reason=path_not_found means the repository exists and the requested folder does not. reason=repo_not_found means the repository does not exist or is private, and repo is null.
Can I list one folder?
Yes. Pass path as the folder from the repository root. Add recursive=true to include everything below it.
How much does a file listing 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
- CommitsGET /v1/hugging-face/repos/{repoType}/{owner}/{name}/commits