Skip to content

Commit 0d446c3

Browse files
authored
docs: add Resource Groups API documentation (#1548)
1 parent 5c26ed3 commit 0d446c3

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

docs/hub/api.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,139 @@ headers = { "authorization" : "Bearer $token" }
280280

281281
This is equivalent to `huggingface_hub.list_organization_members()`.
282282

283+
284+
## Resource Groups API
285+
286+
The following endpoints manage resource groups. Resource groups is an Enterprise feature.
287+
288+
### GET /api/organizations/{name}/resource-groups
289+
290+
Get all resource groups in an organization that the authenticated user has access to view.
291+
292+
293+
### GET /api/organizations/{name}/resource-groups/{resourceGroupId}
294+
295+
Get detailed information about a specific resource group.
296+
297+
298+
### POST /api/organizations/{name}/resource-groups
299+
300+
Create a new resource group in the organization.
301+
302+
Parameters:
303+
- `name`: Name of the resource group (required)
304+
- `description`: Description of the resource group (optional)
305+
- `users`: List of users and their roles in the resource group (optional)
306+
- `repos`: List of repositories (optional)
307+
- `autoJoin`: Settings for automatic user joining (optional)
308+
309+
Payload:
310+
```js
311+
payload = {
312+
"name": "name",
313+
"description": "description",
314+
"users": [
315+
{
316+
"user": "username",
317+
"role": "admin" // or "write" or "read"
318+
}
319+
],
320+
"repos": [
321+
{
322+
"type": "dataset",
323+
"name": "huggingface/repo"
324+
}
325+
]
326+
}
327+
```
328+
329+
330+
### PATCH /api/organizations/{name}/resource-groups/{resourceGroupId}
331+
332+
Update a resource group's metadata.
333+
334+
Parameters:
335+
- `name`: New name for the resource group (optional)
336+
- `description`: New description for the resource group (optional)
337+
338+
Payload:
339+
```js
340+
payload = {
341+
"name": "name",
342+
"description": "description"
343+
}
344+
```
345+
346+
347+
### POST /api/organizations/{name}/resource-groups/{resourceGroupId}/settings
348+
349+
Update a resource group's settings.
350+
351+
Payload:
352+
```js
353+
payload = {
354+
"autoJoin": {
355+
"enabled": true,
356+
"role": "read" // or "write" or "admin"
357+
}
358+
}
359+
```
360+
361+
362+
### DELETE /api/organizations/{name}/resource-groups/{resourceGroupId}
363+
364+
Delete a resource group.
365+
366+
367+
### POST /api/organizations/{name}/resource-groups/{resourceGroupId}/users
368+
369+
Add users to a resource group.
370+
371+
Payload:
372+
```js
373+
payload = {
374+
"users": [
375+
{
376+
"user": "username",
377+
"role": "admin" // or "write" or "read"
378+
}
379+
]
380+
}
381+
```
382+
383+
384+
### DELETE /api/organizations/{name}/resource-groups/{resourceGroupId}/users/{username}
385+
386+
Remove a user from a resource group.
387+
388+
389+
### PATCH /api/organizations/{name}/resource-groups/{resourceGroupId}/users/{username}
390+
391+
Update a user's role in a resource group.
392+
393+
Payload:
394+
```js
395+
payload = {
396+
"role": "admin" // or "write" or "read"
397+
}
398+
```
399+
400+
### POST /api/(models|spaces|datasets)/{namespace}/{repo}/resource-group
401+
402+
Update resource group's repository.
403+
404+
Payload:
405+
```js
406+
payload = {
407+
"resourceGroupId": "6771d4700000000000000000" // (allow `null` for removing the repo's resource group)
408+
}
409+
```
410+
411+
### GET /api/(models|spaces|datasets)/{namespace}/{repo}/resource-group
412+
413+
Get detailed repository's resource group
414+
415+
283416
## Paper Pages API
284417

285418
The following endpoint gets information about a paper.

0 commit comments

Comments
 (0)