Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Hub API Endpoints","local":"hub-api-endpoints","sections":[{"title":"The Hub API Playground","local":"the-hub-api-playground","sections":[],"depth":2},{"title":"Repo listing API","local":"repo-listing-api","sections":[{"title":"GET /api/models","local":"get-apimodels","sections":[],"depth":3},{"title":"GET /api/models/{repo_id} or /api/models/{repo_id}/revision/{revision}","local":"get-apimodelsrepoid-or-apimodelsrepoidrevisionrevision","sections":[],"depth":3},{"title":"GET /api/models-tags-by-type","local":"get-apimodels-tags-by-type","sections":[],"depth":3},{"title":"GET /api/datasets","local":"get-apidatasets","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id} or /api/datasets/{repo_id}/revision/{revision}","local":"get-apidatasetsrepoid-or-apidatasetsrepoidrevisionrevision","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/parquet","local":"get-apidatasetsrepoidparquet","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/parquet/{subset}/{split}/{n}.parquet","local":"get-apidatasetsrepoidparquetsubsetsplitnparquet","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/croissant","local":"get-apidatasetsrepoidcroissant","sections":[],"depth":3},{"title":"GET /api/datasets-tags-by-type","local":"get-apidatasets-tags-by-type","sections":[],"depth":3},{"title":"GET /api/spaces","local":"get-apispaces","sections":[],"depth":3},{"title":"GET /api/spaces/{repo_id} or /api/spaces/{repo_id}/revision/{revision}","local":"get-apispacesrepoid-or-apispacesrepoidrevisionrevision","sections":[],"depth":3}],"depth":2},{"title":"Repo API","local":"repo-api","sections":[{"title":"POST /api/repos/create","local":"post-apireposcreate","sections":[],"depth":3},{"title":"DELETE /api/repos/delete","local":"delete-apireposdelete","sections":[],"depth":3},{"title":"PUT /api/repos/{repo_type}/{repo_id}/settings","local":"put-apireposrepotyperepoidsettings","sections":[],"depth":3},{"title":"POST /api/repos/move","local":"post-apireposmove","sections":[],"depth":3}],"depth":2},{"title":"User API","local":"user-api","sections":[{"title":"GET /api/whoami-v2","local":"get-apiwhoami-v2","sections":[],"depth":3}],"depth":2},{"title":"Organization API","local":"organization-api","sections":[{"title":"GET /api/organizations/{organization_name}/members","local":"get-apiorganizationsorganizationnamemembers","sections":[],"depth":3}],"depth":2},{"title":"Paper Pages API","local":"paper-pages-api","sections":[{"title":"GET /api/arxiv/{arxiv_id}/repos","local":"get-apiarxivarxividrepos","sections":[],"depth":3},{"title":"GET /api/daily_papers","local":"get-apidailypapers","sections":[],"depth":3}],"depth":2},{"title":"Collections API","local":"collections-api","sections":[{"title":"POST /api/collections","local":"post-apicollections","sections":[],"depth":3},{"title":"GET /api/collections/{namespace}/{slug}-{id}","local":"get-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"GET /api/collections","local":"get-apicollections","sections":[],"depth":3},{"title":"PATCH /api/collections/{namespace}/{slug}-{id}","local":"patch-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"DELETE /api/collections/{namespace}/{slug}-{id}","local":"delete-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"POST /api/collections/{namespace}/{slug}-{id}/item","local":"post-apicollectionsnamespaceslug-iditem","sections":[],"depth":3},{"title":"PATCH /api/collections/{namespace}/{slug}-{id}/items/{item_id}","local":"patch-apicollectionsnamespaceslug-iditemsitemid","sections":[],"depth":3},{"title":"DELETE /api/collections/{namespace}/{slug}-{id}/items/{item_id}","local":"delete-apicollectionsnamespaceslug-iditemsitemid","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/hub/main/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/entry/start.d0cd5065.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/scheduler.d6170356.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/singletons.d032f1eb.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/paths.752f1c6b.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/entry/app.b6abe3c1.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/index.fcd4cc08.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/nodes/0.f045427f.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/nodes/5.3b0f4bed.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/Tip.b09c67cf.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/CodeBlock.7b16bdef.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/EditOnGithub.da2b595c.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Hub API Endpoints","local":"hub-api-endpoints","sections":[{"title":"The Hub API Playground","local":"the-hub-api-playground","sections":[],"depth":2},{"title":"Repo listing API","local":"repo-listing-api","sections":[{"title":"GET /api/models","local":"get-apimodels","sections":[],"depth":3},{"title":"GET /api/models/{repo_id} or /api/models/{repo_id}/revision/{revision}","local":"get-apimodelsrepoid-or-apimodelsrepoidrevisionrevision","sections":[],"depth":3},{"title":"GET /api/models-tags-by-type","local":"get-apimodels-tags-by-type","sections":[],"depth":3},{"title":"GET /api/datasets","local":"get-apidatasets","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id} or /api/datasets/{repo_id}/revision/{revision}","local":"get-apidatasetsrepoid-or-apidatasetsrepoidrevisionrevision","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/parquet","local":"get-apidatasetsrepoidparquet","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/parquet/{subset}/{split}/{n}.parquet","local":"get-apidatasetsrepoidparquetsubsetsplitnparquet","sections":[],"depth":3},{"title":"GET /api/datasets/{repo_id}/croissant","local":"get-apidatasetsrepoidcroissant","sections":[],"depth":3},{"title":"GET /api/datasets-tags-by-type","local":"get-apidatasets-tags-by-type","sections":[],"depth":3},{"title":"GET /api/spaces","local":"get-apispaces","sections":[],"depth":3},{"title":"GET /api/spaces/{repo_id} or /api/spaces/{repo_id}/revision/{revision}","local":"get-apispacesrepoid-or-apispacesrepoidrevisionrevision","sections":[],"depth":3}],"depth":2},{"title":"Repo API","local":"repo-api","sections":[{"title":"POST /api/repos/create","local":"post-apireposcreate","sections":[],"depth":3},{"title":"DELETE /api/repos/delete","local":"delete-apireposdelete","sections":[],"depth":3},{"title":"PUT /api/repos/{repo_type}/{repo_id}/settings","local":"put-apireposrepotyperepoidsettings","sections":[],"depth":3},{"title":"POST /api/repos/move","local":"post-apireposmove","sections":[],"depth":3}],"depth":2},{"title":"User API","local":"user-api","sections":[{"title":"GET /api/whoami-v2","local":"get-apiwhoami-v2","sections":[],"depth":3}],"depth":2},{"title":"Organization API","local":"organization-api","sections":[{"title":"GET /api/organizations/{organization_name}/members","local":"get-apiorganizationsorganizationnamemembers","sections":[],"depth":3}],"depth":2},{"title":"Paper Pages API","local":"paper-pages-api","sections":[{"title":"GET /api/arxiv/{arxiv_id}/repos","local":"get-apiarxivarxividrepos","sections":[],"depth":3},{"title":"GET /api/daily_papers","local":"get-apidailypapers","sections":[],"depth":3}],"depth":2},{"title":"Collections API","local":"collections-api","sections":[{"title":"POST /api/collections","local":"post-apicollections","sections":[],"depth":3},{"title":"GET /api/collections/{namespace}/{slug}-{id}","local":"get-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"GET /api/collections","local":"get-apicollections","sections":[],"depth":3},{"title":"PATCH /api/collections/{namespace}/{slug}-{id}","local":"patch-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"DELETE /api/collections/{namespace}/{slug}-{id}","local":"delete-apicollectionsnamespaceslug-id","sections":[],"depth":3},{"title":"POST /api/collections/{namespace}/{slug}-{id}/item","local":"post-apicollectionsnamespaceslug-iditem","sections":[],"depth":3},{"title":"PATCH /api/collections/{namespace}/{slug}-{id}/items/{item_id}","local":"patch-apicollectionsnamespaceslug-iditemsitemid","sections":[],"depth":3},{"title":"DELETE /api/collections/{namespace}/{slug}-{id}/items/{item_id}","local":"delete-apicollectionsnamespaceslug-iditemsitemid","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="hub-api-endpoints" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#hub-api-endpoints"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Hub API Endpoints</span></h1> <p data-svelte-h="svelte-1carg1c">We have open endpoints that you can use to retrieve information from the Hub as well as perform certain actions such as creating model, dataset or Space repos. We offer a wrapper Python library, <a href="https://github.com/huggingface/huggingface_hub" rel="nofollow"><code>huggingface_hub</code></a>, that allows easy access to these endpoints. We also provide <a href="./webhooks">webhooks</a> to receive real-time incremental info about repos. Enjoy!</p> <p data-svelte-h="svelte-c2bk6n">The base URL for those endpoints below is <code>https://huggingface.co</code>. For example, to construct the <code>/api/models</code> call below, one can call the URL <a href="https://huggingface.co/api/models" rel="nofollow">https://huggingface.co/api/models</a></p> <h2 class="relative group"><a id="the-hub-api-playground" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#the-hub-api-playground"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>The Hub API Playground</span></h2> <p data-svelte-h="svelte-ag615g">Want to try out our API? | |
| Try it out now on our <a href="https://huggingface.co/spaces/enzostvs/hub-api-playground" rel="nofollow">Playground</a>!</p> <div class="flex justify-center" data-svelte-h="svelte-25z24s"><a href="https://huggingface.co/spaces/enzostvs/hub-api-playground" target="_blank"><img class="w-full object-contain" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/hub-api-playground.png"></a></div> <h2 class="relative group"><a id="repo-listing-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#repo-listing-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Repo listing API</span></h2> <p data-svelte-h="svelte-oukbsk">The following endpoints help get information about models, datasets, Spaces, and metrics stored on the Hub.</p> <div class="course-tip bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">When making API calls to retrieve information about repositories, the <code data-svelte-h="svelte-1lly2l1">createdAt</code> attribute indicates the time when the respective repository was created. It's important to note that there is a unique value, <code data-svelte-h="svelte-17k3afp">2022-03-02T23:29:04.000Z</code> assigned to all repositories that were created before we began storing creation dates.</div> <h3 class="relative group"><a id="get-apimodels" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apimodels"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/models</span></h3> <p data-svelte-h="svelte-1ggcmi">Get information from all models in the Hub. The response is paginated, use the <a href="https://docs.github.com/en/rest/guides/using-pagination-in-the-rest-api?apiVersion=2022-11-28#link-header" rel="nofollow"><code>Link</code> header</a> to get the next pages. You can specify additional parameters to have more specific results.</p> <ul data-svelte-h="svelte-pjpp2w"><li><code>search</code>: Filter based on substrings for repos and their usernames, such as <code>resnet</code> or <code>microsoft</code></li> <li><code>author</code>: Filter models by an author or organization, such as <code>huggingface</code> or <code>microsoft</code></li> <li><code>filter</code>: Filter based on tags, such as <code>text-classification</code> or <code>spacy</code>.</li> <li><code>sort</code>: Property to use when sorting, such as <code>downloads</code> or <code>author</code>.</li> <li><code>direction</code>: Direction in which to sort, such as <code>-1</code> for descending, and anything else for ascending.</li> <li><code>limit</code>: Limit the number of models fetched.</li> <li><code>full</code>: Whether to fetch most model data, such as all tags, the files, etc.</li> <li><code>config</code>: Whether to also fetch the repo config.</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->params = { | |
| <span class="hljs-string">"search"</span>:<span class="hljs-string">"search"</span>, | |
| <span class="hljs-string">"author"</span>:<span class="hljs-string">"author"</span>, | |
| <span class="hljs-string">"filter"</span>:<span class="hljs-string">"filter"</span>, | |
| <span class="hljs-string">"sort"</span>:<span class="hljs-string">"sort"</span>, | |
| <span class="hljs-string">"direction"</span>:<span class="hljs-string">"direction"</span>, | |
| <span class="hljs-string">"limit"</span>:<span class="hljs-string">"limit"</span>, | |
| <span class="hljs-string">"full"</span>:<span class="hljs-string">"full"</span>, | |
| <span class="hljs-string">"config"</span>:<span class="hljs-string">"config"</span> | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-18czug6">This is equivalent to <code>huggingface_hub.list_models()</code>.</p> <h3 class="relative group"><a id="get-apimodelsrepoid-or-apimodelsrepoidrevisionrevision" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apimodelsrepoid-or-apimodelsrepoidrevisionrevision"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/models/{repo_id} or /api/models/{repo_id}/revision/{revision}</span></h3> <p data-svelte-h="svelte-1amgfxc">Get all information for a specific model.</p> <p data-svelte-h="svelte-11a6q7k">This is equivalent to <code>huggingface_hub.model_info(repo_id, revision)</code>.</p> <h3 class="relative group"><a id="get-apimodels-tags-by-type" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apimodels-tags-by-type"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/models-tags-by-type</span></h3> <p data-svelte-h="svelte-f44s2k">Gets all the available model tags hosted in the Hub.</p> <p data-svelte-h="svelte-snkr6p">This is equivalent to <code>huggingface_hub.get_model_tags()</code>.</p> <h3 class="relative group"><a id="get-apidatasets" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasets"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets</span></h3> <p data-svelte-h="svelte-10tqhmd">Get information from all datasets in the Hub. The response is paginated, use the <a href="https://docs.github.com/en/rest/guides/using-pagination-in-the-rest-api?apiVersion=2022-11-28#link-header" rel="nofollow"><code>Link</code> header</a> to get the next pages. You can specify additional parameters to have more specific results.</p> <ul data-svelte-h="svelte-pwodq4"><li><code>search</code>: Filter based on substrings for repos and their usernames, such as <code>pets</code> or <code>microsoft</code></li> <li><code>author</code>: Filter datasets by an author or organization, such as <code>huggingface</code> or <code>microsoft</code></li> <li><code>filter</code>: Filter based on tags, such as <code>task_categories:text-classification</code> or <code>languages:en</code>.</li> <li><code>sort</code>: Property to use when sorting, such as <code>downloads</code> or <code>author</code>.</li> <li><code>direction</code>: Direction in which to sort, such as <code>-1</code> for descending, and anything else for ascending.</li> <li><code>limit</code>: Limit the number of datasets fetched.</li> <li><code>full</code>: Whether to fetch most dataset data, such as all tags, the files, etc.</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->params = { | |
| <span class="hljs-string">"search"</span>:<span class="hljs-string">"search"</span>, | |
| <span class="hljs-string">"author"</span>:<span class="hljs-string">"author"</span>, | |
| <span class="hljs-string">"filter"</span>:<span class="hljs-string">"filter"</span>, | |
| <span class="hljs-string">"sort"</span>:<span class="hljs-string">"sort"</span>, | |
| <span class="hljs-string">"direction"</span>:<span class="hljs-string">"direction"</span>, | |
| <span class="hljs-string">"limit"</span>:<span class="hljs-string">"limit"</span>, | |
| <span class="hljs-string">"full"</span>:<span class="hljs-string">"full"</span>, | |
| <span class="hljs-string">"config"</span>:<span class="hljs-string">"config"</span> | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1tc7dap">This is equivalent to <code>huggingface_hub.list_datasets()</code>.</p> <h3 class="relative group"><a id="get-apidatasetsrepoid-or-apidatasetsrepoidrevisionrevision" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasetsrepoid-or-apidatasetsrepoidrevisionrevision"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets/{repo_id} or /api/datasets/{repo_id}/revision/{revision}</span></h3> <p data-svelte-h="svelte-1gv3tob">Get all information for a specific dataset.</p> <ul data-svelte-h="svelte-1uhwjpf"><li><code>full</code>: Whether to fetch most dataset data, such as all tags, the files, etc.</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->params = {<span class="hljs-string">"full"</span>: <span class="hljs-string">"full"</span>}<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-i3hq8t">This is equivalent to <code>huggingface_hub.dataset_info(repo_id, revision)</code>.</p> <h3 class="relative group"><a id="get-apidatasetsrepoidparquet" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasetsrepoidparquet"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets/{repo_id}/parquet</span></h3> <p data-svelte-h="svelte-l27zrd">Get the list of auto-converted parquet files.</p> <p data-svelte-h="svelte-nxq415">Append the subset and the split to the URL to get the list of files for a specific subset and split:</p> <ul data-svelte-h="svelte-8xpuv1"><li><code>GET /api/datasets/{repo_id}/parquet/{subset}</code></li> <li><code>GET /api/datasets/{repo_id}/parquet/{subset}/{split}</code></li></ul> <h3 class="relative group"><a id="get-apidatasetsrepoidparquetsubsetsplitnparquet" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasetsrepoidparquetsubsetsplitnparquet"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets/{repo_id}/parquet/{subset}/{split}/{n}.parquet</span></h3> <p data-svelte-h="svelte-qm1285">Get the nth shard of the auto-converted parquet files, for a specific subset (also called “config”) and split.</p> <h3 class="relative group"><a id="get-apidatasetsrepoidcroissant" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasetsrepoidcroissant"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets/{repo_id}/croissant</span></h3> <p data-svelte-h="svelte-1j3q23">Get the Croissant metadata. More details at <a href="https://huggingface.co/docs/datasets-server/croissant" rel="nofollow">https://huggingface.co/docs/datasets-server/croissant</a>.</p> <h3 class="relative group"><a id="get-apidatasets-tags-by-type" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidatasets-tags-by-type"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/datasets-tags-by-type</span></h3> <p data-svelte-h="svelte-tb64tz">Gets all the available dataset tags hosted in the Hub.</p> <p data-svelte-h="svelte-jio84s">This is equivalent to <code>huggingface_hub.get_dataset_tags()</code>.</p> <h3 class="relative group"><a id="get-apispaces" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apispaces"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/spaces</span></h3> <p data-svelte-h="svelte-1aig25b">Get information from all Spaces in the Hub. The response is paginated, use the <a href="https://docs.github.com/en/rest/guides/using-pagination-in-the-rest-api?apiVersion=2022-11-28#link-header" rel="nofollow"><code>Link</code> header</a> to get the next pages. You can specify additional parameters to have more specific results.</p> <ul data-svelte-h="svelte-1137zwa"><li><code>search</code>: Filter based on substrings for repos and their usernames, such as <code>resnet</code> or <code>microsoft</code></li> <li><code>author</code>: Filter models by an author or organization, such as <code>huggingface</code> or <code>microsoft</code></li> <li><code>filter</code>: Filter based on tags, such as <code>text-classification</code> or <code>spacy</code>.</li> <li><code>sort</code>: Property to use when sorting, such as <code>downloads</code> or <code>author</code>.</li> <li><code>direction</code>: Direction in which to sort, such as <code>-1</code> for descending, and anything else for ascending.</li> <li><code>limit</code>: Limit the number of models fetched.</li> <li><code>full</code>: Whether to fetch most model data, such as all tags, the files, etc.</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->params = { | |
| <span class="hljs-string">"search"</span>:<span class="hljs-string">"search"</span>, | |
| <span class="hljs-string">"author"</span>:<span class="hljs-string">"author"</span>, | |
| <span class="hljs-string">"filter"</span>:<span class="hljs-string">"filter"</span>, | |
| <span class="hljs-string">"sort"</span>:<span class="hljs-string">"sort"</span>, | |
| <span class="hljs-string">"direction"</span>:<span class="hljs-string">"direction"</span>, | |
| <span class="hljs-string">"limit"</span>:<span class="hljs-string">"limit"</span>, | |
| <span class="hljs-string">"full"</span>:<span class="hljs-string">"full"</span>, | |
| <span class="hljs-string">"config"</span>:<span class="hljs-string">"config"</span> | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-126zrpj">This is equivalent to <code>huggingface_hub.list_spaces()</code>.</p> <h3 class="relative group"><a id="get-apispacesrepoid-or-apispacesrepoidrevisionrevision" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apispacesrepoid-or-apispacesrepoidrevisionrevision"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/spaces/{repo_id} or /api/spaces/{repo_id}/revision/{revision}</span></h3> <p data-svelte-h="svelte-1amgfxc">Get all information for a specific model.</p> <p data-svelte-h="svelte-1ae6h8n">This is equivalent to <code>huggingface_hub.space_info(repo_id, revision)</code>.</p> <h2 class="relative group"><a id="repo-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#repo-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Repo API</span></h2> <p data-svelte-h="svelte-1fkinu4">The following endpoints manage repository settings like creating and deleting a repository.</p> <h3 class="relative group"><a id="post-apireposcreate" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#post-apireposcreate"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>POST /api/repos/create</span></h3> <p data-svelte-h="svelte-181hrr6">Create a repository. It’s a model repo by default.</p> <p data-svelte-h="svelte-eo06dy">Parameters:</p> <ul data-svelte-h="svelte-z1cr0o"><li><code>type</code>: Type of repo (dataset or space; model by default).</li> <li><code>name</code>: Name of repo.</li> <li><code>organization</code>: Name of organization (optional).</li> <li><code>private</code>: Whether the repo is private.</li> <li><code>sdk</code>: When the type is <code>space</code> (streamlit, gradio, docker or static)</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"type"</span>:<span class="hljs-string">"model"</span>, | |
| <span class="hljs-string">"name"</span>:<span class="hljs-string">"name"</span>, | |
| <span class="hljs-string">"organization"</span>: <span class="hljs-string">"organization"</span>, | |
| <span class="hljs-string">"private"</span>:<span class="hljs-string">"private"</span>, | |
| <span class="hljs-string">"sdk"</span>: <span class="hljs-string">"sdk"</span> | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-12pivso">This is equivalent to <code>huggingface_hub.create_repo()</code>.</p> <h3 class="relative group"><a id="delete-apireposdelete" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#delete-apireposdelete"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>DELETE /api/repos/delete</span></h3> <p data-svelte-h="svelte-1l13wpb">Delete a repository. It’s a model repo by default.</p> <p data-svelte-h="svelte-eo06dy">Parameters:</p> <ul data-svelte-h="svelte-170i3il"><li><code>type</code>: Type of repo (dataset or space; model by default).</li> <li><code>name</code>: Name of repo.</li> <li><code>organization</code>: Name of organization (optional).</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"model"</span>, | |
| <span class="hljs-string">"name"</span>: <span class="hljs-string">"name"</span>, | |
| <span class="hljs-string">"organization"</span>: <span class="hljs-string">"organization"</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-fnfk3p">This is equivalent to <code>huggingface_hub.delete_repo()</code>.</p> <h3 class="relative group"><a id="put-apireposrepotyperepoidsettings" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#put-apireposrepotyperepoidsettings"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>PUT /api/repos/{repo_type}/{repo_id}/settings</span></h3> <p data-svelte-h="svelte-10gupyx">Update repo visibility.</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"private"</span>: <span class="hljs-string">"private"</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1rtytiu">This is equivalent to <code>huggingface_hub.update_repo_visibility()</code>.</p> <h3 class="relative group"><a id="post-apireposmove" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#post-apireposmove"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>POST /api/repos/move</span></h3> <p data-svelte-h="svelte-g52a9">Move a repository (rename within the same namespace or transfer from user to organization).</p> <p data-svelte-h="svelte-eo06dy">Parameters:</p> <ul data-svelte-h="svelte-ejb5b4"><li><code>fromRepo</code>: repo to rename.</li> <li><code>toRepo</code>: new name of the repo.</li> <li><code>type</code>: Type of repo (dataset or space; model by default).</li></ul> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"fromRepo"</span> : <span class="hljs-string">"namespace/repo_name"</span>, | |
| <span class="hljs-string">"toRepo"</span> : <span class="hljs-string">"namespace2/repo_name2"</span>, | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"model"</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1sr4057">This is equivalent to <code>huggingface_hub.move_repo()</code>.</p> <h2 class="relative group"><a id="user-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#user-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>User API</span></h2> <p data-svelte-h="svelte-1w6agcl">The following endpoint gets information about a user.</p> <h3 class="relative group"><a id="get-apiwhoami-v2" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apiwhoami-v2"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/whoami-v2</span></h3> <p data-svelte-h="svelte-13o32co">Get username and organizations the user belongs to.</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->headers = { <span class="hljs-string">"authorization"</span> : <span class="hljs-string">"Bearer $token"</span> }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-sg7fz8">This is equivalent to <code>huggingface_hub.whoami()</code>.</p> <h2 class="relative group"><a id="organization-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#organization-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Organization API</span></h2> <p data-svelte-h="svelte-1dib0r5">The following endpoint gets a list of the Organization members.</p> <h3 class="relative group"><a id="get-apiorganizationsorganizationnamemembers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apiorganizationsorganizationnamemembers"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/organizations/{organization_name}/members</span></h3> <p data-svelte-h="svelte-1g3rw69">Get the organization members.</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->headers = { <span class="hljs-string">"authorization"</span> : <span class="hljs-string">"Bearer $token"</span> }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-10rc2zv">This is equivalent to <code>huggingface_hub.list_organization_members()</code>.</p> <h2 class="relative group"><a id="paper-pages-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#paper-pages-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Paper Pages API</span></h2> <p data-svelte-h="svelte-1opruqm">The following endpoint gets information about a paper.</p> <h3 class="relative group"><a id="get-apiarxivarxividrepos" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apiarxivarxividrepos"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/arxiv/{arxiv_id}/repos</span></h3> <p data-svelte-h="svelte-74oi0s">Get all the models, datasets, and Spaces that refer to a paper.</p> <h3 class="relative group"><a id="get-apidailypapers" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apidailypapers"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/daily_papers</span></h3> <p data-svelte-h="svelte-1t6q9m7">Get the daily papers curated by AK and the community. It’s the equivalent of <a href="https://huggingface.co/papers" rel="nofollow">https://huggingface.co/papers</a>.</p> <h2 class="relative group"><a id="collections-api" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#collections-api"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>Collections API</span></h2> <p data-svelte-h="svelte-r7uovh">Use Collections to group repositories from the Hub (Models, Datasets, Spaces and Papers) on a dedicated page.</p> <p data-svelte-h="svelte-vf27tv">You can learn more about it in the Collections <a href="./collections">guide</a>. Collections can also be managed using the Python client (see <a href="https://huggingface.co/docs/huggingface_hub/main/en/guides/collections" rel="nofollow">guide</a>).</p> <h3 class="relative group"><a id="post-apicollections" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#post-apicollections"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>POST /api/collections</span></h3> <p data-svelte-h="svelte-18xkxrt">Create a new collection on the Hub with a title, a description (optional) and a first item (optional). An item is defined by a type (<code>model</code>, <code>dataset</code>, <code>space</code> or <code>paper</code>) and an id (repo_id or paper_id on the Hub).</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"title"</span>: <span class="hljs-string">"My cool models"</span>, | |
| <span class="hljs-string">"namespace"</span>: <span class="hljs-string">"username_or_org"</span>, | |
| <span class="hljs-string">"description"</span>: <span class="hljs-string">"Here is a shortlist of models I've trained."</span>, | |
| <span class="hljs-string">"item"</span> : { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"model"</span>, | |
| <span class="hljs-string">"id"</span>: <span class="hljs-string">"username/cool-model"</span>, | |
| } | |
| <span class="hljs-string">"private"</span>: <span class="hljs-literal">false</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-ddwgao">This is equivalent to <code>huggingface_hub.create_collection()</code>.</p> <h3 class="relative group"><a id="get-apicollectionsnamespaceslug-id" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apicollectionsnamespaceslug-id"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/collections/{namespace}/{slug}-{id}</span></h3> <p data-svelte-h="svelte-hj5b20">Return information about a collection.</p> <p data-svelte-h="svelte-224ygk">This is equivalent to <code>huggingface_hub.get_collection()</code>.</p> <h3 class="relative group"><a id="get-apicollections" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#get-apicollections"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>GET /api/collections</span></h3> <p data-svelte-h="svelte-1jusaev">List collections from the Hub, based on some criteria. The supported parameters are:</p> <ul data-svelte-h="svelte-lzybjq"><li><code>owner</code> (string): filter collections created by a specific user or organization.</li> <li><code>item</code> (string): filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: <code>"models/teknium/OpenHermes-2.5-Mistral-7B"</code>, <code>"datasets/rajpurkar/squad"</code> or <code>"papers/2311.12983"</code>.</li> <li><code>sort</code> (string): sort the returned collections. Supported values are <code>"lastModified"</code>, <code>"trending"</code> (default) and <code>"upvotes"</code>.</li> <li><code>limit</code> (int): maximum number (100) of collections per page.</li> <li><code>q</code> (string): filter based on substrings for titles & descriptions.</li></ul> <p data-svelte-h="svelte-t1vsxu">If no parameter is set, all collections are returned.</p> <p data-svelte-h="svelte-10sk6ox">The response is paginated. To get all collections, you must follow the <a href="https://docs.github.com/en/rest/guides/using-pagination-in-the-rest-api?apiVersion=2022-11-28#link-header" rel="nofollow"><code>Link</code> header</a>.</p> <div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"><p data-svelte-h="svelte-85odl7">When listing collections, the item list per collection is truncated to 4 items maximum. To retrieve all items from a collection, you need to make an additional call using its collection slug.</p></div> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->params = { | |
| <span class="hljs-string">"owner"</span>: <span class="hljs-string">"TheBloke"</span>, | |
| <span class="hljs-string">"item"</span>: <span class="hljs-string">"models/teknium/OpenHermes-2.5-Mistral-7B"</span>, | |
| <span class="hljs-string">"sort"</span>: <span class="hljs-string">"lastModified"</span>, | |
| <span class="hljs-string">"limit"</span> : <span class="hljs-number">1</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-imecil">This is equivalent to <code>huggingface_hub.list_collections()</code>.</p> <h3 class="relative group"><a id="patch-apicollectionsnamespaceslug-id" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#patch-apicollectionsnamespaceslug-id"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>PATCH /api/collections/{namespace}/{slug}-{id}</span></h3> <p data-svelte-h="svelte-1n7t4ym">Update the metadata of a collection on the Hub. You can’t add or modify the items of the collection with this method. All fields of the payload are optional.</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"title"</span>: <span class="hljs-string">"My cool models"</span>, | |
| <span class="hljs-string">"description"</span>: <span class="hljs-string">"Here is a shortlist of models I've trained."</span>, | |
| <span class="hljs-string">"private"</span>: <span class="hljs-literal">false</span>, | |
| <span class="hljs-string">"position"</span>: <span class="hljs-number">0</span>, <span class="hljs-comment">// position of the collection on your profile</span> | |
| <span class="hljs-string">"theme"</span>: <span class="hljs-string">"green"</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1x9ml85">This is equivalent to <code>huggingface_hub.update_collection_metadata()</code>.</p> <h3 class="relative group"><a id="delete-apicollectionsnamespaceslug-id" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#delete-apicollectionsnamespaceslug-id"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>DELETE /api/collections/{namespace}/{slug}-{id}</span></h3> <p data-svelte-h="svelte-1rb0k3l">Return a collection. This is a non-revertible operation. A deleted collection cannot be restored.</p> <p data-svelte-h="svelte-k6p5a5">This is equivalent to <code>huggingface_hub.delete_collection()</code>.</p> <h3 class="relative group"><a id="post-apicollectionsnamespaceslug-iditem" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#post-apicollectionsnamespaceslug-iditem"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>POST /api/collections/{namespace}/{slug}-{id}/item</span></h3> <p data-svelte-h="svelte-1mfx2c8">Add an item to a collection. An item is defined by a type (<code>model</code>, <code>dataset</code>, <code>space</code> or <code>paper</code>) and an id (repo_id or paper_id on the Hub). A note can also be attached to the item (optional).</p> <p data-svelte-h="svelte-9v02e8">Payload:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"item"</span> : { | |
| <span class="hljs-string">"type"</span>: <span class="hljs-string">"model"</span>, | |
| <span class="hljs-string">"id"</span>: <span class="hljs-string">"username/cool-model"</span>, | |
| } | |
| <span class="hljs-string">"note"</span>: <span class="hljs-string">"Here is the model I trained on ..."</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-wjjomf">This is equivalent to <code>huggingface_hub.add_collection_item()</code>.</p> <h3 class="relative group"><a id="patch-apicollectionsnamespaceslug-iditemsitemid" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#patch-apicollectionsnamespaceslug-iditemsitemid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>PATCH /api/collections/{namespace}/{slug}-{id}/items/{item_id}</span></h3> <p data-svelte-h="svelte-1olv11o">Update an item in a collection. You must know the item object id which is different from the repo_id/paper_id provided when adding the item to the collection. The <code>item_id</code> can be retrieved by fetching the collection.</p> <p data-svelte-h="svelte-1w1fo8u">You can update the note attached to the item or the position of the item in the collection. Both fields are optional.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START -->payload = { | |
| <span class="hljs-string">"position"</span>: <span class="hljs-number">0</span>, | |
| <span class="hljs-string">"note"</span>: <span class="hljs-string">"Here is the model I trained on ..."</span>, | |
| }<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1tuquv3">This is equivalent to <code>huggingface_hub.update_collection_item()</code>.</p> <h3 class="relative group"><a id="delete-apicollectionsnamespaceslug-iditemsitemid" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#delete-apicollectionsnamespaceslug-iditemsitemid"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>DELETE /api/collections/{namespace}/{slug}-{id}/items/{item_id}</span></h3> <p data-svelte-h="svelte-1v2xomk">Remove an item from a collection. You must know the item object id which is different from the repo_id/paper_id provided when adding the item to the collection. The <code>item_id</code> can be retrieved by fetching the collection.</p> <p data-svelte-h="svelte-1yuqykx">This is equivalent to <code>huggingface_hub.delete_collection_item()</code>.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/hub-docs/blob/main/docs/hub/api.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1vatp3t = { | |
| assets: "/docs/hub/main/en", | |
| base: "/docs/hub/main/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/hub/main/en/_app/immutable/entry/start.d0cd5065.js"), | |
| import("/docs/hub/main/en/_app/immutable/entry/app.b6abe3c1.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 5], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 94.3 kB
- Xet hash:
- d37c6fac4f53f942cc8e2c1da7e2f4a5237b5b7bcc2b1d9dacfd9f297021d3a3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.