curl --request POST \
--url https://gateway.molpha.io/v1/session \
--header 'Content-Type: application/json' \
--header 'SIGN-IN-WITH-X: <sign-in-with-x>' \
--data '
{
"ttlSeconds": 900
}
'const options = {
method: 'POST',
headers: {'SIGN-IN-WITH-X': '<sign-in-with-x>', 'Content-Type': 'application/json'},
body: JSON.stringify({ttlSeconds: 900})
};
fetch('https://gateway.molpha.io/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://gateway.molpha.io/v1/session"
payload = { "ttlSeconds": 900 }
headers = {
"SIGN-IN-WITH-X": "<sign-in-with-x>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.molpha.io/v1/session"
payload := strings.NewReader("{\n \"ttlSeconds\": 900\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("SIGN-IN-WITH-X", "<sign-in-with-x>")
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))
}{
"status": "ok",
"data": {
"token": "molpha_sess_2tq1m0Yk3fJmJ1m9c0vX8q7Wb5sZr4nH6uL2pD9aE0g",
"tokenType": "Bearer",
"sessionId": "9f2c4e6a8b0d1f3a5c7e9b1d3f5a7c9e",
"authority": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"owner": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"role": "delegate",
"gatewayPda": "4Nd1mYQzS5mQd9a8o3Yw2fGzLZk1h9dJ7R2sZb6xT3Vk",
"programId": "MoLPhaXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"issuedAt": 1791374400,
"expiresAt": 1791376200
}
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}Sign in
Exchanges a signed sign-in message for a session token.
curl --request POST \
--url https://gateway.molpha.io/v1/session \
--header 'Content-Type: application/json' \
--header 'SIGN-IN-WITH-X: <sign-in-with-x>' \
--data '
{
"ttlSeconds": 900
}
'const options = {
method: 'POST',
headers: {'SIGN-IN-WITH-X': '<sign-in-with-x>', 'Content-Type': 'application/json'},
body: JSON.stringify({ttlSeconds: 900})
};
fetch('https://gateway.molpha.io/v1/session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://gateway.molpha.io/v1/session"
payload = { "ttlSeconds": 900 }
headers = {
"SIGN-IN-WITH-X": "<sign-in-with-x>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.molpha.io/v1/session"
payload := strings.NewReader("{\n \"ttlSeconds\": 900\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("SIGN-IN-WITH-X", "<sign-in-with-x>")
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))
}{
"status": "ok",
"data": {
"token": "molpha_sess_2tq1m0Yk3fJmJ1m9c0vX8q7Wb5sZr4nH6uL2pD9aE0g",
"tokenType": "Bearer",
"sessionId": "9f2c4e6a8b0d1f3a5c7e9b1d3f5a7c9e",
"authority": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"owner": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"role": "delegate",
"gatewayPda": "4Nd1mYQzS5mQd9a8o3Yw2fGzLZk1h9dJ7R2sZb6xT3Vk",
"programId": "MoLPhaXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX",
"issuedAt": 1791374400,
"expiresAt": 1791376200
}
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}{
"error": "validation failed"
}Headers
Base64 JSON sign-in payload
Body
Optional shorter lifetime
Optional body of POST /v1/session.
Asks for a shorter session than the default; at most sessionMaxTtlSeconds from GET /v1/info. Omit it for the default lifetime.
900
Response
Session opened
"ok"
A new session. The token is returned once and is not recoverable.
Hide child attributes
Hide child attributes
Sent as Authorization: Bearer <token> on POST /v1/round/execute.
"molpha_sess_2tq1m0Yk3fJmJ1m9c0vX8q7Wb5sZr4nH6uL2pD9aE0g"
"Bearer"
Identifies the session in the gateway's records; it is not a credential.
"9f2c4e6a8b0d1f3a5c7e9b1d3f5a7c9e"
The key that signed in.
"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
The subscription owner the session acts under.
"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
owner or delegate.
"delegate"
"4Nd1mYQzS5mQd9a8o3Yw2fGzLZk1h9dJ7R2sZb6xT3Vk"
"MoLPhaXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX"
Unix seconds.
1791374400
Unix seconds.
1791376200