# Storage

## Upload

Upload anything to decentralized storage. Call the API with **file: anything** as form-data.&#x20;

> Note: For IPFS, you will get the same id on uploading same content.

### <mark style="color:blue;">**POST**</mark> `https://api.shyft.to/sol/v1/storage/upload`

{% tabs %}
{% tab title="JS" %}
{% code overflow="wrap" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");

var formdata = new FormData();
formdata.append("file", fileInput.files[0], "cb.jpeg");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/storage/upload", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endcode %}
{% endtab %}

{% tab title="Response" %}

```javascript
{ 
    cid: "bafkreig7amamflgtsovczf2el7jt7kuwf274jeaeofjy7iaa34r7exydzm",    //content identifier
    uri: "https://ipfs.io/ipfs/bafkreig7amamflgtsovczf2el7jt7kuwf274jeaeofjy7iaa34r7exydzm"
}
```

{% endtab %}
{% endtabs %}

## Create Nft Metadata

This API endpoint lets you create an NFT metadata JSON file on decentralized storage *(IPFS).*

### <mark style="color:blue;">POST</mark> <https://api.shyft.to/sol/v1/metadata/create>

#### Body Params

* **name**: NFT Name
* **symbol:** NFT Symbol
* **description**: NFT description
* **attributes:** attributes associated to this NFT. (Stringify it)
* **share:** NFT share
* **image**: URI of the NFT image.
* **creator**: public onchain address of the creator
* **royalty:** (optional) 0 by default.
* **external\_url:** (optional) any url to associate with the NFT
* **files:** (optional) additional files that are to be linked to the metadata of the NFT

{% tabs %}
{% tab title="JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", <YOUR-API-KEY>);
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "name": "SHYFT",
  "symbol": "SHY",
  "description": "A web3 development platform that gets you wings",
  "image": "https://ipfs.io/ipfs/bafkreigx7c3s267vty55xutwjkdmllugvwu2mhoowlcvx2nnhjl6k5kjaq",
  "attributes": [
    {
      "trait_type": "fast",
      "value": "80"
    },
    {
      "trait_type": "efficient",
      "value": 100
    }
  ],
  "royalty": 5,
  "creator": "BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx",
  "share": 100,
  "external_url": "https://www.example.com",
  "files": [
    {
      "uri": "https://nftstorage.link/ipfs/bafybeia4ml3aaj3tqln5z6qxqvi2ygfouw4ppt7t3qp3wrsoiccslexomm",
      "type": "image/png"
    },
    {
      "uri": "https://nftstorage.link/ipfs/bafybeigvojjdy5ofaeu7semfvdjugnbutda37r35xjpsvmm5vzblill6k4",
      "type": "image/png"
    }
  ]
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/metadata/create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="response" %}

```json
{
    "success": true,
    "message": "Metadata created successfully",
    "result": {
        "cid": "bafkreif4trtqaezozeuddwawn5zzepjruxzzna3zaopkm54fbn27heamre",
        "uri": "https://nftstorage.link/ipfs/bafkreif4trtqaezozeuddwawn5zzepjruxzzna3zaopkm54fbn27heamre"
    }
}
```

{% endtab %}
{% endtabs %}
