Sessions
Create a session
Open a session for one logged-in customer, on the per-user door. Hand the token to the page’s init({ session }), which expires 15 minutes later: see Session renewal. Take the partition values from your own session, never from the request. On Node, call sessions.create.
POST
/
api
/
v1
/
embed
/
sessions
Create a session
curl --request POST \
--url https://app.concatflow.com/api/v1/embed/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "YOUR_ASSISTANT_ID",
"partitions": {
"customer_id": "4712"
}
}
'import requests
url = "https://app.concatflow.com/api/v1/embed/sessions"
payload = {
"assistant_id": "YOUR_ASSISTANT_ID",
"partitions": { "customer_id": "4712" }
}
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({assistant_id: 'YOUR_ASSISTANT_ID', partitions: {customer_id: '4712'}})
};
fetch('https://app.concatflow.com/api/v1/embed/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.concatflow.com/api/v1/embed/sessions"
payload := strings.NewReader("{\n \"assistant_id\": \"YOUR_ASSISTANT_ID\",\n \"partitions\": {\n \"customer_id\": \"4712\"\n }\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))
}require 'uri'
require 'net/http'
url = URI("https://app.concatflow.com/api/v1/embed/sessions")
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 \"assistant_id\": \"YOUR_ASSISTANT_ID\",\n \"partitions\": {\n \"customer_id\": \"4712\"\n }\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.concatflow.com/api/v1/embed/sessions",
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([
'assistant_id' => 'YOUR_ASSISTANT_ID',
'partitions' => [
'customer_id' => '4712'
]
]),
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;
}{
"token": "Qm8x…",
"expires_at": "2026-10-23T14:37:12.204000+00:00"
}{
"error": "invalid_body"
}{
"error": "invalid_api_key"
}{
"detail": {
"code": "partition_keys_mismatch",
"expected": [
"customer_id"
]
}
}{
"detail": "<unknown>"
}{
"detail": {
"code": "door_closed"
}
}{
"detail": "<array>"
}{
"error": "backend_unreachable"
}Authorizations
Your secret API key, lyra_sk_…, from Settings → Developers → API keys.
Body
application/json
⌘I
Create a session
curl --request POST \
--url https://app.concatflow.com/api/v1/embed/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "YOUR_ASSISTANT_ID",
"partitions": {
"customer_id": "4712"
}
}
'import requests
url = "https://app.concatflow.com/api/v1/embed/sessions"
payload = {
"assistant_id": "YOUR_ASSISTANT_ID",
"partitions": { "customer_id": "4712" }
}
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({assistant_id: 'YOUR_ASSISTANT_ID', partitions: {customer_id: '4712'}})
};
fetch('https://app.concatflow.com/api/v1/embed/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.concatflow.com/api/v1/embed/sessions"
payload := strings.NewReader("{\n \"assistant_id\": \"YOUR_ASSISTANT_ID\",\n \"partitions\": {\n \"customer_id\": \"4712\"\n }\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))
}require 'uri'
require 'net/http'
url = URI("https://app.concatflow.com/api/v1/embed/sessions")
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 \"assistant_id\": \"YOUR_ASSISTANT_ID\",\n \"partitions\": {\n \"customer_id\": \"4712\"\n }\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.concatflow.com/api/v1/embed/sessions",
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([
'assistant_id' => 'YOUR_ASSISTANT_ID',
'partitions' => [
'customer_id' => '4712'
]
]),
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;
}{
"token": "Qm8x…",
"expires_at": "2026-10-23T14:37:12.204000+00:00"
}{
"error": "invalid_body"
}{
"error": "invalid_api_key"
}{
"detail": {
"code": "partition_keys_mismatch",
"expected": [
"customer_id"
]
}
}{
"detail": "<unknown>"
}{
"detail": {
"code": "door_closed"
}
}{
"detail": "<array>"
}{
"error": "backend_unreachable"
}