# Collections

## Create

**post** `/collections`

Create a new collection

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `name: string`

  The name of the collection.

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "name": "name"
        }'
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Delete

**delete** `/collections/{collectionId}`

Delete a collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID \
    -X DELETE \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

```json
{}
```

## List

**get** `/collections`

List collections of a team

### Query Parameters

- `pageSize: optional number`

  The number of items to return in the response. The default value is 10, maximum value is 100, minimum value is 1

- `paginationToken: optional string`

  A token you received in a previous request to query the next page of items

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Returns

- `collections: array of object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

- `nextPaginationToken: optional string`

  A token to query the next page of collections

### Example

```http
curl https://api.cloud.scenario.com/v1/collections \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

```json
{
  "collections": [
    {
      "id": "id",
      "assetCount": 0,
      "createdAt": "createdAt",
      "itemCount": 0,
      "modelCount": 0,
      "name": "name",
      "ownerId": "ownerId",
      "updatedAt": "updatedAt",
      "thumbnail": {
        "assetId": "assetId",
        "url": "url"
      }
    }
  ],
  "nextPaginationToken": "nextPaginationToken"
}
```

## Retrieve

**get** `/collections/{collectionId}`

Get the details of a collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Update

**put** `/collections/{collectionId}`

Update the name and/or thumbnail of a Collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `name: optional string`

  The new name for the Collection

- `thumbnail: optional string`

  The AssetId of the image you want to use as a thumbnail for the collection. Set to null to unset the thumbnail.

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{}'
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Domain Types

### Collection Create Response

- `CollectionCreateResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

### Collection Delete Response

- `CollectionDeleteResponse = unknown`

### Collection List Response

- `CollectionListResponse object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Collection Retrieve Response

- `CollectionRetrieveResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

### Collection Update Response

- `CollectionUpdateResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

# Assets

## Add

**put** `/collections/{collectionId}/assets`

Add assets to a specific collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `assetIds: array of string`

  The ids of the assets to add to the collection. (Max 49 at once)

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID/assets \
    -X PUT \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "assetIds": [
            "string"
          ]
        }'
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Remove

**delete** `/collections/{collectionId}/assets`

Remove assets from a specific collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `assetIds: array of string`

  The ids of the assets to remove from the collection. (Max 49 at once)

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID/assets \
    -X DELETE \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Domain Types

### Asset Add Response

- `AssetAddResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

### Asset Remove Response

- `AssetRemoveResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

# Models

## Add

**put** `/collections/{collectionId}/models`

Add models to a specific collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `modelIds: array of string`

  The ids of the models to add to the collection. (Max 49 at once)

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID/models \
    -X PUT \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "modelIds": [
            "string"
          ]
        }'
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Remove

**delete** `/collections/{collectionId}/models`

Remove models from a specific collection

### Path Parameters

- `collectionId: string`

### Query Parameters

- `projectId: optional string`

  The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

### Body Parameters

- `modelIds: array of string`

  The ids of the models to remove from the collection. (Max 49 at once)

### Returns

- `collection: object { id, assetCount, createdAt, 6 more }`

  - `id: string`

    The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

  - `assetCount: number`

  - `createdAt: string`

    The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `itemCount: number`

  - `modelCount: number`

  - `name: string`

    The collection name

  - `ownerId: string`

    The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

  - `updatedAt: string`

    The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

  - `thumbnail: optional object { assetId, url }`

    The thumbnail for the collection (if any)

    - `assetId: string`

    - `url: string`

### Example

```http
curl https://api.cloud.scenario.com/v1/collections/$COLLECTION_ID/models \
    -X DELETE \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET"
```

#### Response

```json
{
  "collection": {
    "id": "id",
    "assetCount": 0,
    "createdAt": "createdAt",
    "itemCount": 0,
    "modelCount": 0,
    "name": "name",
    "ownerId": "ownerId",
    "updatedAt": "updatedAt",
    "thumbnail": {
      "assetId": "assetId",
      "url": "url"
    }
  }
}
```

## Domain Types

### Model Add Response

- `ModelAddResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`

### Model Remove Response

- `ModelRemoveResponse object { collection }`

  - `collection: object { id, assetCount, createdAt, 6 more }`

    - `id: string`

      The collection ID (example: "asset_GTrL3mq4SXWyMxkOHRxlpw")

    - `assetCount: number`

    - `createdAt: string`

      The collection creation date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `itemCount: number`

    - `modelCount: number`

    - `name: string`

      The collection name

    - `ownerId: string`

      The owner ID (example: "dcf121faaa1a0a0bbbd9ca1b73d62aea")

    - `updatedAt: string`

      The collection last update date as an ISO string (example: "2023-02-03T11:19:41.579Z")

    - `thumbnail: optional object { assetId, url }`

      The thumbnail for the collection (if any)

      - `assetId: string`

      - `url: string`
