Pinata Docs
Search…
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
cURL
Node.js
Python
Go
1
curl --location --request POST 'https://managed.mypinata.cloud/api/v1/auth/content/jwt' \
2
--header 'x-api-key: SUBMARINE KEY' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"timeoutSeconds": 3600,
6
"contentIds": ["95c904a0-4d61-4598-a4c8-fb5f0793c7ab"]
7
}'
Copied!
1
var axios = require('axios');
2
var data = JSON.stringify({
3
"timeoutSeconds": 3600,
4
"contentIds": [
5
"95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
6
]
7
});
8
9
var config = {
10
method: 'post',
11
url: 'https://managed.mypinata.cloud/api/v1/auth/content/jwt',
12
headers: {
13
'x-api-key': 'SUBMARINE KEY',
14
'Content-Type': 'application/json'
15
},
16
data: data
17
};
18
19
const res = await axios(config);
20
21
console.log(res.data);
Copied!
1
import requests
2
import json
3
4
url = "https://managed.mypinata.cloud/api/v1/auth/content/jwt"
5
6
payload = json.dumps({
7
"timeoutSeconds": 3600,
8
"contentIds": [
9
"95c904a0-4d61-4598-a4c8-fb5f0793c7ab"
10
]
11
})
12
headers = {
13
'x-api-key': 'SUBMARINE KEY',
14
'Content-Type': 'application/json'
15
}
16
17
response = requests.request("POST", url, headers=headers, data=payload)
18
19
print(response.text)
20
Copied!
1
package main
2
3
import (
4
"fmt"
5
"strings"
6
"net/http"
7
"io/ioutil"
8
)
9
10
func main() {
11
12
url := "https://managed.mypinata.cloud/api/v1/auth/content/jwt"
13
method := "POST"
14
15
payload := strings.NewReader(`{
16
"timeoutSeconds": 3600,
17
"contentIds": ["95c904a0-4d61-4598-a4c8-fb5f0793c7ab"]
18
}`)
19
20
client := &http.Client {
21
}
22
req, err := http.NewRequest(method, url, payload)
23
24
if err != nil {
25
fmt.Println(err)
26
return
27
}
28
req.Header.Add("x-api-key", "SUBMARINE KEY")
29
req.Header.Add("Content-Type", "application/json")
30
31
res, err := client.Do(req)
32
if err != nil {
33
fmt.Println(err)
34
return
35
}
36
defer res.Body.Close()
37
38
body, err := ioutil.ReadAll(res.Body)
39
if err != nil {
40
fmt.Println(err)
41
return
42
}
43
fmt.Println(string(body))
44
}
Copied!
Last modified 30d ago