Pinata Docs
Search…
Submarine JSON
/content/json
This endpoint allows you to add and Submarine any JSON object you wish. This endpoint is specifically optimized to only handle JSON content. Once the server receives the JSON, it is converted into a JSON file and Submarined.

Submarining JSON

​
Each upload can optionally include additional information beyond just the file. Metadata in the form of a JSON object can be included. The metadata must be in the form of keyvalue pairs. Nesting of keyvalue pairs is not possible at this time.
post
https://managed.mypinata.cloud/api/v1
/content/json
cURL
Node.js
Python
Go
curl --location --request POST 'https://managed.mypinata.cloud/api/v1/content/json' \
--header 'x-api-key: Submarine Key' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": {
"example": "content",
"more": "examples"
},
"name": "My JSON",
"metadata": {
"keyvalues": {
"one": "two"
}
}
}'
var axios = require('axios');
var data = JSON.stringify({
"content": {
"example": "content",
"more": "examples"
},
"name": "My JSON",
"metadata": {
"keyvalues": {
"one": "two"
}
}
});
​
var config = {
method: 'post',
url: 'https://managed.mypinata.cloud/api/v1/content/json',
headers: {
'x-api-key': 'Submarine Key',
'Content-Type': 'application/json'
},
data : data
};
​
const res = await axios(config);
​
console.log(res.data);
import requests
import json
​
url = "https://managed.mypinata.cloud/api/v1/content/json"
​
payload = json.dumps({
"content": {
"example": "content",
"more": "examples"
},
"name": "My JSON",
"metadata": {
"keyvalues": {
"one": "two"
}
}
})
headers = {
'x-api-key': 'Submarine Key',
'Content-Type': 'application/json'
}
​
response = requests.request("POST", url, headers=headers, data=payload)
​
print(response.text)
​
package main
​
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
​
func main() {
​
url := "https://managed.mypinata.cloud/api/v1/content/json"
method := "POST"
​
payload := strings.NewReader(`{
"content": {
"example": "content",
"more": "examples"
},
"name": "My JSON",
"metadata": {
"keyvalues": {
"one": "two"
}
}
}`)
​
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
​
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-api-key", "Submarine Key")
req.Header.Add("Content-Type", "application/json")
​
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
​
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Copy link