> Portal Navigation:
>
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt
# CreateCollection
# Package: portfolio
# Namespace: CollectionsService
# Method link: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/create-collection.md
## Permission Scopes:
Manage Portfolio: SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
## Introduction
Creates a collection.
---
## REST API
### Schema
```
Method: createCollection
Description: Creates a collection.
URL: https://www.wixapis.com/portfolio/collections/api/v1/portfolio/collections
Method: POST
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: collection
Method parameters:
param name: collection | type: Collection | required: true
- name: title | type: string | description: Collection title.
- name: description | type: string | description: Collection description.
- name: slug | type: string | description: Collection slug.
- name: coverImage | type: Image | description: Collection cover image.
- name: imageInfo | type: Image | description: Information about the Wix Media image.
- name: id | type: string | description: WixMedia image GUID. Required.
- name: height | type: integer | description: Original image height. Required.
- name: width | type: integer | description: Original image width. Required.
- name: altText | type: string | description: Image alt text.
- name: filename | type: string | description: Image filename.
- name: focalPoint | type: Point | description: Focal point of the image.
- name: x | type: number | description: X-coordinate of the focal point.
- name: y | type: number | description: Y-coordinate of the focal point.
- name: hidden | type: boolean | description: Whether the collection is hidden from the portfolio. Default: `false`
- name: sortOrder | type: number | description: Index that determines which position a collection is displayed in the portfolio.
Default: [Epoch](https://www.epoch101.com/) timestamp.
- name: seoData | type: SeoSchema | description: Collection SEO data.
- name: tags | type: array | description: SEO tag information.
- name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`.
- name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`.
- name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`.
- name: children | type: string | description: SEO tag inner content. For example, ` inner content `.
- name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages).
- name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines.
- name: settings | type: Settings | description: SEO general settings.
- name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled).
- name: keywords | type: array | description: User-selected keyword terms for a specific page.
- name: term | type: string | description: Keyword value.
- name: isMain | type: boolean | description: Whether the keyword is the main focus keyword.
- name: origin | type: string | description: The source that added the keyword terms to the SEO settings.
Return type: CreateCollectionResponse
- name: collection | type: Collection | description: Created collection.
- name: id | type: string | description: Collection GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the collection is updated. To prevent conflicting changes, the existing revision must be passed when updating the collection object.
- name: title | type: string | description: Collection title.
- name: description | type: string | description: Collection description.
- name: slug | type: string | description: Collection slug.
- name: coverImage | type: Image | description: Collection cover image.
- name: imageInfo | type: Image | description: Information about the Wix Media image.
- name: id | type: string | description: WixMedia image GUID. Required.
- name: url | type: string | description: Image URL.
- name: height | type: integer | description: Original image height. Required.
- name: width | type: integer | description: Original image width. Required.
- name: altText | type: string | description: Image alt text.
- name: filename | type: string | description: Image filename.
- name: focalPoint | type: Point | description: Focal point of the image.
- name: x | type: number | description: X-coordinate of the focal point.
- name: y | type: number | description: Y-coordinate of the focal point.
- name: hidden | type: boolean | description: Whether the collection is hidden from the portfolio. Default: `false`
- name: sortOrder | type: number | description: Index that determines which position a collection is displayed in the portfolio.
Default: [Epoch](https://www.epoch101.com/) timestamp.
- name: createdDate | type: string | description: Date and time the collection was created.
- name: updatedDate | type: string | description: Date and time the collection was updated.
- name: url | type: PageUrlV2 | description: Collection page URL and relative path. Returned when `includePageUrl` is `true` in the request.
- name: relativePath | type: string | description: The relative path for the page within the site. For example, `/product-page/a-product`.
- name: url | type: string | description: The page's full URL. For example, `https://mysite.com/product-page/a-product`.
- name: seoData | type: SeoSchema | description: Collection SEO data.
- name: tags | type: array | description: SEO tag information.
- name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`.
- name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`.
- name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`.
- name: children | type: string | description: SEO tag inner content. For example, ` inner content `.
- name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages).
- name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines.
- name: settings | type: Settings | description: SEO general settings.
- name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled).
- name: keywords | type: array | description: User-selected keyword terms for a specific page.
- name: term | type: string | description: Keyword value.
- name: isMain | type: boolean | description: Whether the keyword is the main focus keyword.
- name: origin | type: string | description: The source that added the keyword terms to the SEO settings.
```
### Examples
### Create Collection
```curl
curl -X POST \
'https://www.wixapis.com/portfolio/v1/collections' \
-H 'Authorization: ' \
-H 'Content-Type: application/json' \
-d '{
"collection": {
"title": "New Collection Title",
"description": "This is a new collection description.",
"slug": "new-collection-title",
"coverImage": {
"imageInfo": {
"id": "8c074c67-2926-4518-92ef-c79d7810b3a4"
}
},
"hidden": false,
"sortOrder": 1.0,
"seoData": {
"settings": {
"keywords": [
{
"isMain": true,
"origin": "marketing-persona",
"term": "investment management"
}
],
"preventAutoRedirect": false
},
"tags": [
{
"children": "Investment Experts Share Growth Strategies",
"custom": false,
"disabled": false,
"type": "title"
},
{
"children": "",
"custom": false,
"disabled": false,
"props": {
"content": "Investment strategies explained by investment experts. Investment experts offer valuable insights for growth.",
"name": "description"
},
"type": "meta"
}
]
}
}
}'
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.portfolio.CollectionsService.createCollection(collection)
Description: Creates a collection.
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: collection
Method parameters:
param name: collection | type: Collection | required: true
- name: title | type: string | description: Collection title.
- name: description | type: string | description: Collection description.
- name: slug | type: string | description: Collection slug.
- name: coverImage | type: Image | description: Collection cover image.
- name: imageInfo | type: string | description: Information about the Wix Media image.
- name: focalPoint | type: Point | description: Focal point of the image.
- name: x | type: number | description: X-coordinate of the focal point.
- name: y | type: number | description: Y-coordinate of the focal point.
- name: hidden | type: boolean | description: Whether the collection is hidden from the portfolio. Default: `false`
- name: sortOrder | type: number | description: Index that determines which position a collection is displayed in the portfolio.
Default: [Epoch](https://www.epoch101.com/) timestamp.
- name: seoData | type: SeoSchema | description: Collection SEO data.
- name: tags | type: array | description: SEO tag information.
- name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`.
- name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`.
- name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`.
- name: children | type: string | description: SEO tag inner content. For example, ` inner content `.
- name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages).
- name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines.
- name: settings | type: Settings | description: SEO general settings.
- name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled).
- name: keywords | type: array | description: User-selected keyword terms for a specific page.
- name: term | type: string | description: Keyword value.
- name: isMain | type: boolean | description: Whether the keyword is the main focus keyword.
- name: origin | type: string | description: The source that added the keyword terms to the SEO settings.
Return type: PROMISE
- name: _id | type: string | description: Collection GUID.
- name: revision | type: string | description: Revision number, which increments by 1 each time the collection is updated. To prevent conflicting changes, the existing revision must be passed when updating the collection object.
- name: title | type: string | description: Collection title.
- name: description | type: string | description: Collection description.
- name: slug | type: string | description: Collection slug.
- name: coverImage | type: Image | description: Collection cover image.
- name: imageInfo | type: string | description: Information about the Wix Media image.
- name: focalPoint | type: Point | description: Focal point of the image.
- name: x | type: number | description: X-coordinate of the focal point.
- name: y | type: number | description: Y-coordinate of the focal point.
- name: hidden | type: boolean | description: Whether the collection is hidden from the portfolio. Default: `false`
- name: sortOrder | type: number | description: Index that determines which position a collection is displayed in the portfolio.
Default: [Epoch](https://www.epoch101.com/) timestamp.
- name: _createdDate | type: Date | description: Date and time the collection was created.
- name: _updatedDate | type: Date | description: Date and time the collection was updated.
- name: url | type: string | description: Collection page URL and relative path. Returned when `includePageUrl` is `true` in the request.
- name: seoData | type: SeoSchema | description: Collection SEO data.
- name: tags | type: array | description: SEO tag information.
- name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`.
- name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`.
- name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`.
- name: children | type: string | description: SEO tag inner content. For example, ` inner content `.
- name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages).
- name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines.
- name: settings | type: Settings | description: SEO general settings.
- name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled).
- name: keywords | type: array | description: User-selected keyword terms for a specific page.
- name: term | type: string | description: Keyword value.
- name: isMain | type: boolean | description: Whether the keyword is the main focus keyword.
- name: origin | type: string | description: The source that added the keyword terms to the SEO settings.
```
### Examples
### createCollection
```javascript
import { collections } from '@wix/portfolio';
async function createCollection(collection) {
const response = await collections.createCollection(collection);
};
```
### createCollection (with elevated permissions)
```javascript
import { collections } from '@wix/portfolio';
import { auth } from '@wix/essentials';
async function myCreateCollectionMethod(collection) {
const elevatedCreateCollection = auth.elevate(collections.createCollection);
const response = await elevatedCreateCollection(collection);
}
```
### createCollection (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).
```javascript
import { createClient } from '@wix/sdk';
import { collections } from '@wix/portfolio';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { collections },
// Include the auth strategy and host as relevant
});
async function createCollection(collection) {
const response = await myWixClient.collections.createCollection(collection);
};
```
---