Check whether a Stytch B2B member is registered on Narrative
curl --request POST \
--url https://api-dev.narrative.io/authentication/b2b/registration-status \
--header 'Content-Type: application/json' \
--data '
{
"stytch_token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun",
"session_duration_minutes": 5
}
'import requests
url = "https://api-dev.narrative.io/authentication/b2b/registration-status"
payload = {
"stytch_token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun",
"session_duration_minutes": 5
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
stytch_token: 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun',
session_duration_minutes: 5
})
};
fetch('https://api-dev.narrative.io/authentication/b2b/registration-status', 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-dev.narrative.io/authentication/b2b/registration-status",
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([
'stytch_token' => 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun',
'session_duration_minutes' => 5
]),
CURLOPT_HTTPHEADER => [
"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-dev.narrative.io/authentication/b2b/registration-status"
payload := strings.NewReader("{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
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-dev.narrative.io/authentication/b2b/registration-status")
.header("Content-Type", "application/json")
.body("{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/authentication/b2b/registration-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}"
response = http.request(request)
puts response.read_body{
"status": "complete",
"email": "[email protected]",
"stytch_session_token": "example-stytch-session-token",
"stytch_session_jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImV4YW1wbGUta2V5In0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiYXVkIjpbImV4YW1wbGUtcHJvamVjdCJdLCJzdWIiOiJleGFtcGxlLXVzZXIiLCJpYXQiOjAsIm5iZiI6MCwiZXhwIjowfQ.ZXhhbXBsZS1zaWduYXR1cmUtbm90LXZhbGlk"
}{
"error": "bad_payload",
"error_description": "malformed JSON"
}{
"error": "forbidden",
"error_description": "The provided Stytch token is invalid."
}{}Authentication
Check whether a Stytch B2B member is registered on Narrative
Authenticates the Stytch B2B session token, and reports whether an active Narrative user is linked to the Stytch member. The response carries the session token that the B2B login and register APIs take.
POST
/
authentication
/
b2b
/
registration-status
Check whether a Stytch B2B member is registered on Narrative
curl --request POST \
--url https://api-dev.narrative.io/authentication/b2b/registration-status \
--header 'Content-Type: application/json' \
--data '
{
"stytch_token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun",
"session_duration_minutes": 5
}
'import requests
url = "https://api-dev.narrative.io/authentication/b2b/registration-status"
payload = {
"stytch_token": "cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun",
"session_duration_minutes": 5
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
stytch_token: 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun',
session_duration_minutes: 5
})
};
fetch('https://api-dev.narrative.io/authentication/b2b/registration-status', 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-dev.narrative.io/authentication/b2b/registration-status",
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([
'stytch_token' => 'cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun',
'session_duration_minutes' => 5
]),
CURLOPT_HTTPHEADER => [
"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-dev.narrative.io/authentication/b2b/registration-status"
payload := strings.NewReader("{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
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-dev.narrative.io/authentication/b2b/registration-status")
.header("Content-Type", "application/json")
.body("{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/authentication/b2b/registration-status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"stytch_token\": \"cykuz7f22h7rx5SPomBZUB359jj6GA-4NUBkuZDiduun\",\n \"session_duration_minutes\": 5\n}"
response = http.request(request)
puts response.read_body{
"status": "complete",
"email": "[email protected]",
"stytch_session_token": "example-stytch-session-token",
"stytch_session_jwt": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImV4YW1wbGUta2V5In0.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwiYXVkIjpbImV4YW1wbGUtcHJvamVjdCJdLCJzdWIiOiJleGFtcGxlLXVzZXIiLCJpYXQiOjAsIm5iZiI6MCwiZXhwIjowfQ.ZXhhbXBsZS1zaWduYXR1cmUtbm90LXZhbGlk"
}{
"error": "bad_payload",
"error_description": "malformed JSON"
}{
"error": "forbidden",
"error_description": "The provided Stytch token is invalid."
}{}Body
application/json
Response
OK
The example tokens are synthetic and cannot be used to authenticate.
complete when an active Narrative user is linked to the Stytch user or member, so the next call is login.
pending when there is none yet, so the next call is register.
Available options:
complete, pending The verified email address Stytch has for the user or member.
The Stytch session token to pass to login or register.
The same Stytch session, as a JWT.
Was this page helpful?

