---
title: "Create Collection"
method: POST
path: "/library/{libraryId}/collections"
tags: ["Manage Collections"]
---

# Create Collection

`POST /library/{libraryId}/collections`

## Request

- Base URL: `https://video.bunnycdn.com`
- URL: `https://video.bunnycdn.com/library/{libraryId}/collections`
- Auth: API key in header `AccessKey`
- TypeScript: <https://skmtc.dev/bunny/apis/stream-api/docs/library/:libraryId/collections/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `libraryId` integer, required

## Request body

- UpdateCollectionModel
  - `name` string, nullable: The name to assign to the collection. Required, up to 255 characters.

## Response `200`

The collection was successfully created

- CollectionModel
  - `videoLibraryId` integer: The video library ID that contains the collection
  - `guid` string, nullable: The unique ID of the collection
  - `name` string, nullable: The name of the collection
  - `videoCount` integer: The number of on-demand videos in the collection. Live streams in the collection are not included in this count.
  - `liveStreamCount` integer: The number of live streams in the collection. On-demand videos are not included in this count.
  - `totalSize` integer: The total storage size of all videos in the collection, in bytes.
  - `previewVideoIds` string, nullable: Comma-separated list of video GUIDs used as preview thumbnails for the collection.
  - `previewImageUrls` string[], nullable: The URLs of preview images of videos in the collection

## Other responses

- `400`: The collection name was missing or longer than 255 characters
- `401`: The request authentication failed
- `403`: The request authorization failed
- `500`: Internal Server Error

## Changes

- **2026-11-12** `83116184952f`: 4 info
  - added the media type `application/json` for the response with the status `401`
  - added the media type `application/json` for the response with the status `403`
  - added the non-success response with the status `400`
  - added the optional property `liveStreamCount` to the response with the `200` status

[Operation history](https://skmtc.dev/bunny/apis/stream-api/changes/library/:libraryId/collections/post.md)

---

[API](https://skmtc.dev/bunny/apis/stream-api.md) - [All operations](https://skmtc.dev/bunny/apis/stream-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bunny/apis/stream-api/revisions/83116184952f?raw)
