# Collections

## Managing collections

Check out the [HfApi](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi) documentation page for the reference of methods to manage your Space on the Hub.

* Get collection content: [get\_collection()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.get_collection)
* Create new collection: [create\_collection()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.create_collection)
* Update a collection: [update\_collection\_metadata()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.update_collection_metadata)
* Delete a collection: [delete\_collection()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.delete_collection)
* Add an item to a collection: [add\_collection\_item()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.add_collection_item)
* Update an item in a collection: [update\_collection\_item()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.update_collection_item)
* Remove an item from a collection: [delete\_collection\_item()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.delete_collection_item)

#### Collection

#### class huggingface\_hub.Collection

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/hf_api.py#L647)

( data: Dictendpoint: Optional\[str] = None )

Parameters

* **slug** (`str`) — Slug of the collection. E.g. `"TheBloke/recent-models-64f9a55bb3115b4f513ec026"`.
* **title** (`str`) — Title of the collection. E.g. `"Recent models"`.
* **owner** (`str`) — Owner of the collection. E.g. `"TheBloke"`.
* **description** (`str`, _optional_) — Description of the collection, as plain text.
* **items** (`List[CollectionItem]`) — List of items in the collection.
* **last\_updated** (`datetime`) — Date of the last update of the collection.
* **position** (`int`) — Position of the collection in the list of collections of the owner.
* **private** (`bool`) — Whether the collection is private or not.
* **theme** (`str`) — Theme of the collection. E.g. `"green"`.
* **url** (`str`) — URL for the collection on the Hub.

Contains information about a Collection on the Hub.

#### CollectionItem

#### class huggingface\_hub.CollectionItem

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/hf_api.py#L614)

( \_id: strid: strtype: CollectionItemType\_Tposition: intnote: Optional\[Dict] = None\*\*kwargs )

Parameters

* **item\_object\_id** (`str`) — Unique ID of the item in the collection.
* **item\_id** (`str`) — ID of the underlying object on the Hub. Can be either a repo\_id or a paper id e.g. `"jbilcke-hf/ai-comic-factory"`, `"2307.09288"`.
* **item\_type** (`str`) — Type of the underlying object. Can be one of `"model"`, `"dataset"`, `"space"` or `"paper"`.
* **position** (`int`) — Position of the item in the collection.
* **note** (`str`, _optional_) — Note associated with the item, as plain text.
* **kwargs** (`Dict`, _optional_) — Any other attribute returned by the server. Those attributes depend on the `item_type`: “author”, “private”, “lastModified”, “gated”, “title”, “likes”, “upvotes”, etc.

Contains information about an item of a Collection (model, dataset, Space or paper).
