# Deploy an NFT Contract

After generating a contract for the NFT collection, you need to deploy the contract.&#x20;

You will send a POST request to `/nft/<nft_collection_name>` endpoint, calling the `:deploy` method, to deploy the NFT collection smart contract.

## Deploy the NFT contract.

<mark style="color:green;">`POST`</mark> `https://api.playfix.io/nft/<nft_collection_name>:deploy`

#### Path Parameters

| Name                                                 | Type   | Description                                                                         |
| ---------------------------------------------------- | ------ | ----------------------------------------------------------------------------------- |
| nft\_collect\_name<mark style="color:red;">\*</mark> | String | The name of the NFT. This will start with a prefix of "`nfts/`" followed by a ULID. |

#### Headers

| Name                                            | Type   | Description                               |
| ----------------------------------------------- | ------ | ----------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<your\_acces&#x73;_\__&#x74;oken> |

#### Request Body

| Name                                                 | Type   | Description                                                                        |
| ---------------------------------------------------- | ------ | ---------------------------------------------------------------------------------- |
| clientSide<mark style="color:red;">\*</mark>         | Object | Client side configuration for deploying the NFT contract.                          |
| clientSide.address<mark style="color:red;">\*</mark> | String | The smart contract address; automatically generated by MetaMask.                   |
| clientSide.network<mark style="color:red;">\*</mark> | String | The network where the collection will be deployed.                                 |
| clientSide.txHash<mark style="color:red;">\*</mark>  | String | The smart contract creation transaction hash, automatically generated by MetaMask. |

{% tabs %}
{% tab title="200: OK Successfully deployed the NFT contract." %}


```json
{
  "nft": {
    "name":"nfts/01gg71g4h2ycjyagxcfcvgadg3",
    "project":"projects/01gfv5g90rd26redcnygvj9q3a",
    "standard":"NFT_STANDARD_UNSPECIFIED",
    "title":"Carz",
    "description":"",
    "itemCount":"1",
    "imageCoverUrl":"https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "imageCoverCid":"QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "config":{
      "name":"Carz",
      "symbol":"CRS",
      "itemPrice":0.01,
      "baseUri":"ipfs://bafybeidbvgkfvkf5jsjy23szl2by5klbdai6zvdk6ybg5sjkasf4cuokdy/",
      "burnable":false,
      "pausable":false,
      "ownerAddress":"0x7c992EF85B5F10013a7D4A07cB6c30A75708D516"
      },
    "network":"NETWORK_POLYGON_MUMBAI",
    "contractAddress":"0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
    "deployTxHash":""
   }
}
```
{% endtab %}
{% endtabs %}

**Example Curl API Call**

```shell
curl --request POST \
  --url https://api.playfix.io/nft/<nft_collection_name>:deploy \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <your_access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "clientSide": {
      "network": "NETWORK_POLYGON",
      "address": "0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
      "txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    }'
```

**Example Python API Call**

```python
import requests
import json

nft = "<nft_collection_name>"
payload = {
    "clientSide": {
        "network": "NETWORK_POLYGON",
        "address": "0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
        "txHash":"0x0000000000000000000000000000000000000000000000000000000000000000"
        }
    }

r = requests.post(
    "https://api.playfix.io/nft/" + nft + ":deploy",
    headers = {
        "Authorization": "Bearer <your_access_token>",
        "Accept": "application/json",
        "Content-Type": "application/json"
    },
    data = json.dumps(payload)
)

print(r.text)
```

{% hint style="info" %}
You must connect to MetaMask to run this process.
{% endhint %}

#### **Request Body**

* `clientSide`: An object containing the configurations for deploying the NFT collection smart contract using MetaMask.
  * `network`: The network where the collection will be deployed.
  * `address`: The smart contract address. This is automatically generated by MetaMask.
  * `txHash`: The smart contract creation transaction hash, automatically generated by MetaMask.

**Response**

```json
{
  "nft": {
    "name":"nfts/01gg71g4h2ycjyagxcfcvgadg3",
    "project":"projects/01gfv5g90rd26redcnygvj9q3a",
    "standard":"NFT_STANDARD_UNSPECIFIED",
    "title":"Carz",
    "description":"",
    "itemCount":"1",
    "imageCoverUrl":"https://ipfs-gateway.playfix.io/ipfs/QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "imageCoverCid":"QmbAVZQhTmRwy57pr4NWuDMhxAC9yzU21GtaGP1f6bay8W",
    "config":{
      "name":"Carz",
      "symbol":"CRS",
      "itemPrice":0.01,
      "baseUri":"ipfs://bafybeidbvgkfvkf5jsjy23szl2by5klbdai6zvdk6ybg5sjkasf4cuokdy/",
      "burnable":false,
      "pausable":false,
      "ownerAddress":"0x7c992EF85B5F10013a7D4A07cB6c30A75708D516"
      },
    "network":"NETWORK_POLYGON_MUMBAI",
    "contractAddress":"0xFFe996EE4846409Ec9e7069Ba6358D6F3F5620d0",
    "deployTxHash":""
   }
}
```

{% hint style="info" %}
Once you deploy the NFT collection contract, you can no longer modify or delete an NFT item in the collection, the NFT collection or the collection contract.
{% endhint %}
