Sign Testing JWT
curl --request POST \
--url https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"privateKey": "<string>",
"payload": {}
}
'import requests
url = "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt"
payload = {
"privateKey": "<string>",
"payload": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({privateKey: '<string>', payload: {}})
};
fetch('https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'privateKey' => '<string>',
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt"
payload := strings.NewReader("{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_bodyCrypto
Sign Testing JWT
Generate a signed RS256 JWT for development and testing
Sign Testing JWT
curl --request POST \
--url https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"privateKey": "<string>",
"payload": {}
}
'import requests
url = "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt"
payload = {
"privateKey": "<string>",
"payload": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({privateKey: '<string>', payload: {}})
};
fetch('https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'privateKey' => '<string>',
'payload' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt"
payload := strings.NewReader("{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/crypto/sign-testing-jwt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"privateKey\": \"<string>\",\n \"payload\": {}\n}"
response = http.request(request)
puts response.read_bodySigns a short-lived JWT (5 minutes) using your project’s RSA private key. Use this during development to generate tokens for testing external auth without needing to implement JWT signing in your test environment.
The project is the one in the URL path (
The JWT is signed with
Returned when
Returned when the request sends
Returned when the
Never use this endpoint in production. It requires your RSA private key in the request body, which must be kept secret. Use it only in local development or CI environments.
Body Parameters
string
required
Your RSA private key encoded as a Base64 string. This is the private key associated with the public key configured in your project’s external auth settings.
object
required
The JWT payload. Must include at least an
id field (the user’s ID in your system). All fields are included in the userData claim.{
"id": "user-123",
"email": "alice@example.com",
"name": "Alice"
}
/v8/:projectId/...); the token’s iss is set from it. Don’t send projectId in the body or the query string: either returns 400 project/wrong-location.
Response
Returns the signed JWT as a plain text string (not JSON):eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
RS256, expires in 5 minutes, and includes:
sub— the user’sidfrom the payloadiss— the project ID from the URL pathaud—"sublay.io"userData— the full payload object
Error Responses
Missing Parameters — 400
Missing Parameters — 400
Missing params in request body
privateKey or payload is missing.Project ID in the Wrong Place — 400
Project ID in the Wrong Place — 400
{
"error": "`projectId` is read from the URL path only (`/v8/:projectId/...`).",
"code": "project/wrong-location",
"param": "projectId"
}
projectId in the body or the query string, or sends an x-sublay-project-id header.Missing User ID — 400
Missing User ID — 400
{ "error": "Missing user id in payload.", "code": "crypto/missing-params" }
payload object does not include an id field.
