# Collections

## Create Collection

Launch an NFT collection on Solana mainnet. We currently support two types:

* **Static passes:** All NFTs in a static pass collection have the same image.
* **Numbered passes:** Like static passes, numbered passes all share the same image, but NFTs are distinguishable by a number at the bottom of the image. NFTs are minted in order, where the first NFT minted says "#1" at the bottom.

After calling this endpoint, Comet will automatically start deploying the collection on Solana mainnet. This usually takes 30-60 seconds. To monitor the progress of the deployment, use the `GET /collection` endpoint below.

{% hint style="info" %}
Note: This endpoint requires an image upload, so the request should be in the form of `multipart/form-data`.
{% endhint %}

## Create a new NFT collection on Solana mainnet.

<mark style="color:green;">`POST`</mark> `https://api.withcomet.com/v1/collection`

This endpoint requires an image upload, so the request should be in the form of `multipart/form-data`.

#### Headers

| Name                                            | Type   | Description                          |
| ----------------------------------------------- | ------ | ------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token with your Comet API key |

#### Request Body

| Name                                               | Type    | Description                                                                                                                                                                                                                          |
| -------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| name<mark style="color:red;">\*</mark>             | String  | The name of the collection.                                                                                                                                                                                                          |
| symbol<mark style="color:red;">\*</mark>           | String  | The symbol of the collection.                                                                                                                                                                                                        |
| description<mark style="color:red;">\*</mark>      | String  | The description of the collection.                                                                                                                                                                                                   |
| subtype                                            | String  | <p><code>numbered\_pass</code> (default): the edition number will be displayed at the bottom of the NFT image.</p><p></p><p><code>static\_pass</code>: the edition number will not be shown on the NFT, only the uploaded image.</p> |
| pricingModel                                       | String  | <p><code>pay\_once</code> (default): This NFT requires a one-time payment to be minted by a user.</p><p></p><p><code>free</code>: This NFT is free to mint for anyone.</p>                                                           |
| price                                              | Float   | If `pricingModel` is `pay_once`, the price that users will need to pay to mint this NFT, in $USD.                                                                                                                                    |
| infiniteSupply                                     | Boolean | <p>If <code>true</code>, this collection has an infinite number of tokens.</p><p></p><p>If <code>false</code> (default), the <code>maxSupply</code> parameter must be supplied.</p>                                                  |
| maxSupply                                          | Integer | If `infiniteSupply` is `false`, the maximum number of tokens that can be minted from this collection.                                                                                                                                |
| backgroundUpload<mark style="color:red;">\*</mark> | File    | Uploaded via `multipart/form-data` request. An image file (JPG, or PNG) that will be displayed on all NFTs in the collection.                                                                                                        |

{% tabs %}
{% tab title="200: OK Successful operation" %}

```json
{
  "id": "6c2715377717",
  "name": "my test collection",
  "symbol": "TEST",
  "type": "milky_way_nft",
  "chainType": "solana",
  "chainId": 101,
  "subtype": "numbered_pass",
  "description": "whats good",
  "infiniteSupply": false,
  "maxSupply": 100,
  "price": 10,
  "pricingModel": "pay_once",
  "deployed": false,
  "isCometToken": true,
  "backgroundUpload": "OxnAlTCm9se8sMlnu0CeExmawJ0YVFGd4WcVgUCs3ZCfPbNm7NT9ewIfNKRfCgj7"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid payload" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Get Launched Collections

## Get a list of collections you've launched.

<mark style="color:blue;">`GET`</mark> `https://api.withcomet.com/v1/collection`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK Successful operation" %}

```json
{
  "collections": [
    {
      "id": "0c658cfcb4fb",
      "name": "apitest",
      "symbol": "API",
      "type": "milky_way_nft",
      "chainType": "solana",
      "chainId": 101,
      "subtype": "numbered_pass",
      "description": "hello folks",
      "infiniteSupply": false,
      "maxSupply": 100,
      "price": 10,
      "pricingModel": "pay_once",
      "deployed": true,
      "isCometToken": true,
      "backgroundUpload": "ZoYxhPO9miNsTq2wUcfTYT0Y2JbYdNUxwaunnW8CnIeAs9A4gDELT9C3xUM4zsJZ"
    }
  ]
}
```

{% endtab %}

{% tab title="404: Not Found Definition does not exist" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

## Get Collection by ID

## Retrieve a collection given its ID.

<mark style="color:blue;">`GET`</mark> `https://api.withcomet.com/v1/collection/:id`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "id": "0c658cfcb4fb",
  "name": "apitest",
  "symbol": "API",
  "type": "milky_way_nft",
  "chainType": "solana",
  "chainId": 101,
  "subtype": "numbered_pass",
  "description": "hello folks",
  "infiniteSupply": false,
  "maxSupply": 100,
  "price": 10,
  "pricingModel": "pay_once",
  "deployed": true,
  "isCometToken": true,
  "backgroundUpload": "ZoYxhPO9miNsTq2wUcfTYT0Y2JbYdNUxwaunnW8CnIeAs9A4gDELT9C3xUM4zsJZ"
}
```

{% endtab %}
{% endtabs %}

## Get Collection Holders

For a given collection, return a list of the Comet users and/or addresses who hold tokens in that collection.

## Gets a collection's holders.

<mark style="color:blue;">`GET`</mark> `https://api.withcomet.com/rest/v1/collection/:id/holders`

#### Path Parameters

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| collectionId | String | id of collection |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK Successful operation" %}

```javascript
{
    "holders": [
        {
            "address": {
                "chainType": "solana",
                "chainId": 103,
                "address": "EjLfGufWW47Rfc4mUxpwabGaoDCdqpSPsD3jVACxNSRE",
                "primary": true,
                "createdAt": "2022-06-18T03:11:11.873Z",
                "id": "481f11ba98c8"
            },
            "user": {
                "id": "efd61df49255",
                "username": "alexander",
                "addresses": [],
                "profile": {
                    "profilePictureKey": "xCnzCVFlJORryrZCreFsmtZuUxxNcSJGVKmWva7ffkNmSb7rGyWOVTy3478kNNEw"
                }
            }
        },
        {
            "address": {
                "chainType": "solana",
                "chainId": 103,
                "address": "AXkcPCWrWYGuayYgKp7y6LhugKzq5f3pqeKnrSod9ufy",
                "primary": true,
                "createdAt": "2022-08-17T20:24:26.627Z",
                "id": "1a6f2b51ad80"
            },
            "user": {
                "id": "da792fee8f1c",
                "username": "sabina",
                "addresses": [],
                "profile": {
                    "profilePictureKey": "AbWZwbpnaHBWBIs85cpF6zekYDGeD0SsiqHoEPwM2OTqeUZk9ydjvKM1JXeSIeJt"
                }
            }
        },
        {
            "address": {
                "chainType": "solana",
                "chainId": 103,
                "address": "2yAEzsC4GPCT3kGq39K5KLAqPFo4xzvNShDZHqCWo4Gx",
                "primary": true,
                "createdAt": "2022-06-20T16:39:41.138Z",
                "id": "04e421417221"
            },
            "user": {
                "id": "c4367732ab0c",
                "username": "ani",
                "addresses": [],
                "profile": {
                    "profilePictureKey": "B0XXqROJDwzTVm8LR1qHqVdJn3QD5grceudHLbV7cuVoWrdUnYPr8OwsnYgL2ch2"
                }
            }
        },
        {
            "address": {
                "chainType": "solana",
                "chainId": 103,
                "address": "2yAEzsC4GPCT3kGq39K5KLAqPFo4xzvNShDZHqCWo4Gx",
                "primary": true,
                "createdAt": "2022-06-20T16:39:41.138Z",
                "id": "04e421417221"
            },
            "user": {
                "id": "c4367732ab0c",
                "username": "ani",
                "addresses": [],
                "profile": {
                    "profilePictureKey": "B0XXqROJDwzTVm8LR1qHqVdJn3QD5grceudHLbV7cuVoWrdUnYPr8OwsnYgL2ch2"
                }
            }
        },
        {
            "address": {
                "chainType": "solana",
                "chainId": 103,
                "address": "AXkcPCWrWYGuayYgKp7y6LhugKzq5f3pqeKnrSod9ufy",
                "primary": true,
                "createdAt": "2022-08-17T20:24:26.627Z",
                "id": "1a6f2b51ad80"
            },
            "user": {
                "id": "da792fee8f1c",
                "username": "sabina",
                "addresses": [],
                "profile": {
                    "profilePictureKey": "AbWZwbpnaHBWBIs85cpF6zekYDGeD0SsiqHoEPwM2OTqeUZk9ydjvKM1JXeSIeJt"
                }
            }
        }
    ]
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}
