# NFTport API 使用手册

By [XiaoShin](https://paragraph.com/@xiaoshin) · 2022-04-18

---

写了个测试脚本，利用nftport API ，使用脚本mint NFT，完成后可在opensea等平台查看。

在 [官网](https://www.nftport.xyz/sign-up) 获取api\_key。

![avatar](https://storage.googleapis.com/papyrus_images/13aa9d57295e7abce5a0374d3ae0aa3925d8d94f28a908e080c11343ae11b6a0.jpg)

avatar

Mint NFT
--------

1、**Deploy your own contract with** [**Deploy a contract for NFT products**](https://docs.nftport.xyz/docs/nftport/b3A6MjE0MDYzNzU-deploy-an-nft-contract)

**Send**
--------

    curl --request POST \
      --url https://api.nftport.xyz/v0/contracts \
      --header 'Authorization: ...' \
      --header 'Content-Type: application/json' \
      --data '{
      "chain": "polygon",
      "name": "...",
      "symbol": "C",
      "owner_address": "...",
      "metadata_updatable": false,
      "type": "erc721"
    }'
    

Response
--------

    {
      "response": "OK",
      "chain": "polygon",
      "transaction_hash": "...",
      "transaction_external_url": "https://polygonscan.com/tx/...",
      "owner_address": "...",
      "name": "...",
      "symbol": "C"
    }
    

2 、**Get the** [**Contract\_address**](https://docs.nftport.xyz/docs/nftport/b3A6MjE2NjM4OTk-retrieve-a-deployed-contract) **_After a real long time_**

**Send**
--------

    curl --request GET \
      --url 'https://api.nftport.xyz/v0/contracts/...?chain=polygon' \
      --header 'Authorization: ...' \
      --header 'Content-Type: application/json'
    

Response
--------

    {
      "response": "OK",
      "chain": "polygon",
      "contract_address": "...",
      "transaction_hash": "...",
      "error": null
    }
    

3、**Upload your file to IPFS with** [**Upload a file to IPFS**](https://docs.nftport.xyz/docs/nftport/b3A6MjE0MDYzNzY-upload-a-file-to-ipfs)

**Send**
--------

    curl --request POST \
      --url https://api.nftport.xyz/v0/files \
      --header 'Authorization: ...' \
      --header 'Content-Type: multipart/form-data' \
      --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
      --form file=picture_path
    

Response
--------

    {
      "response": "OK",
      "ipfs_url": "https://ipfs.io/ipfs/...",
      "file_name": "...",
      "content_type": "image/png",
      "file_size": 64856,
      "file_size_mb": 0.0619,
      "error": null
    }
    

4、**Create and upload your NFT metadata file with** [**Upload metadata to IPFS**](https://docs.nftport.xyz/docs/nftport/b3A6MjE0MDYzNzc-upload-metadata-to-ipfs)

**Send**
--------

    curl --request POST \
      --url https://api.nftport.xyz/v0/metadata \
      --header 'Authorization: ...' \
      --header 'Content-Type: application/json' \
      --data '{
      "name": "...",
      "description": "...",
      "file_url": "https://ipfs.io/ipfs/..."
    }'
    

Response
--------

    {
      "response": "OK",
      "metadata_uri": "ipfs://...",
      "name": "...",
      "description": "...",
      "file_url": "https://ipfs.io/ipfs/...",
      "external_url": null,
      "animation_url": null,
      "custom_fields": null,
      "attributes": null,
      "error": null
    }
    

5、**Mint NFTs to your contract with** [**Customizable minting**](https://docs.nftport.xyz/docs/nftport/b3A6MjE2NjM5MDI-customizable-minting)

**Send**
--------

    curl --request POST \
      --url https://api.nftport.xyz/v0/mints/customizable \
      --header 'Authorization: ...' \
      --header 'Content-Type: application/json' \
      --data '{
      "chain": "polygon",
      "contract_address": "...",
      "metadata_uri": "ipfs://...",
      "mint_to_address": "..."
    }'
    

Response
--------

    {
      "response": "OK",
      "chain": "polygon",
      "contract_address": "...",
      "transaction_hash": "...",
      "error": null
    }
    

**Python code on Github：**

[https://github.com/WoKough/nftport-api-demo](https://github.com/WoKough/nftport-api-demo)

---

*Originally published on [XiaoShin](https://paragraph.com/@xiaoshin/nftport-api)*
