Pinata Docs
Search
⌃K

Generate Access Token

/auth/content/jwt
This endpoint allows you to create an access token that will be used for viewing Submarined content through a Dedicated Gateway. The token is time-limited, and you control the time through this endpoint.

Generating an Access Token

post
https://managed.mypinata.cloud/api/v2
/auth/content/jwt
Parameters
Header
x-api-key*
SUBMARINE KEY
Body
timeoutSeconds*
Number of seconds the access token should be valid for
contentIds*
Stringified array of IDs (not CIDs) for files
Responses
200: OK
cURL
Node.js
Python
Go
curl --location --request POST 'https://managed.mypinata.cloud/api/v1/auth/content/jwt' \
--header 'x-api-key: SUBMARINE KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"timeoutSeconds": 3600,
"contentIds": ["95c904a0-4d61-4598-a4c8-fb5f0793c7ab"]
}'
var axios = require('axios');
var data = JSON.stringify({
"timeoutSeconds": 3600,
"contentIds": [
"95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
]
});
var config = {
method: 'post',
url: 'https://managed.mypinata.cloud/api/v1/auth/content/jwt',
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/auth/content/jwt"
payload = json.dumps({
"timeoutSeconds": 3600,
"contentIds": [
"95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
]
})
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/auth/content/jwt"
method := "POST"
payload := strings.NewReader(`{
"timeoutSeconds": 3600,
"contentIds": ["95c904a0-4d61-4598-a4c8-fb5f0793c7ab"]
}`)
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))
}
Last modified 1mo ago