> For the complete documentation index, see [llms.txt](https://docs.shyft.to/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shyft.to/solana-apis/storage.md).

# 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.shyft.to/solana-apis/storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
