I am uploading NFT-metadata files to the IPFS using Pinata-API and axios:

var metadata = {
        "title": "Asset Metadata",
        "type": "object",
        "properties": {
            "name": {
                "type": "string",
                "description": nameInput.current.value
            "symbol": {
              "type": "string",
              "description": symbolInput.current.value
            "decimals": {
             "type": "integer",
            "description": 0
            "description": {
                "type": "string",
                "description": descriptionInput.current.value
            "image": {
                "type": "string",
                "description": "ipfs://"+file.data.IpfsHash
    var metadataUploaded = await axios.post("https://api.pinata.cloud/pinning/pinJSONToIPFS", metadata, 
        'pinata_api_key': "xxx",
        'pinata_secret_api_key': "xxx",
        'path': "metadata.json"
    }).then(function (response) {
      return response;
    }).catch(function (error) {

I was expecting the Metadata file would look like a JSON. Calling it from a gateway, it looks like plain text: Preview of the metadata on a public gateway

The given path in the header doesnt seem to change anything. Looking into the pinmanager of Pinata, also no name is assigned:

Preview of Pinata, showing that no name was set

I know that technically it makes little to no difference if it is saved as json or not. But I think you have a better usability and user experience, when youre able to read the metadata formatted. Thanks for any help.

1 Answer 1


You have to send them like so:

    pinataMetadata: {
        name: 'ItemStatus', //i only used this
        keyvalues: {
            // but add_here_if_you_want_more_meta_data
    pinataContent: {
        //put your real JSON object that you want to upload here


I sent mine like so:

const pinataMetadata = {
  name: 'changeFilename-'+ new Date().toLocaleString()
nft_json_meta_data = { pinataMetadata: pinataMetadata, pinataContent: nft_json_meta_data };

const resFile = await axios({
    method: "post",
    url: "https://api.pinata.cloud/pinning/pinJSONToIPFS",
    data: nft_json_meta_data,
    headers: {
        'pinata_api_key': environment.PINATA_API_KEY,
        'pinata_secret_api_key': environment.PINATA_API_SECRET,
        "Content-Type": "application/json"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.