Create workspace session
curl --request POST \
--url https://{defaultHost}/v1/workspaces/{id}/sessions \
--header 'Authorization: Bearer <token>' \
--header 'X-Authorization: <api-key>'import requests
url = "https://{defaultHost}/v1/workspaces/{id}/sessions"
headers = {
"Authorization": "Bearer <token>",
"X-Authorization": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'X-Authorization': '<api-key>'}
};
fetch('https://{defaultHost}/v1/workspaces/{id}/sessions', 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://{defaultHost}/v1/workspaces/{id}/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/workspaces/{id}/sessions"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/workspaces/{id}/sessions")
.header("Authorization", "Bearer <token>")
.header("X-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/workspaces/{id}/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"access": "<string>",
"user_id": "<string>",
"app_id": "<string>",
"refresh": "<string>",
"csrf": "<string>",
"access_expires_at": "<string>",
"refresh_expires_at": "<string>",
"key_id": "<string>"
}{
"error": "Workspace API key required",
"error_code": "workspace_api_key_required"
}{
"error": "Workspace access denied",
"error_code": "workspace_access_denied"
}{
"error": "App not found in workspace",
"error_code": "app_not_in_workspace"
}Workspace Sessions
Create workspace session
Create a user session from any app within a workspace using workspace API key
POST
/
v1
/
workspaces
/
{id}
/
sessions
Create workspace session
curl --request POST \
--url https://{defaultHost}/v1/workspaces/{id}/sessions \
--header 'Authorization: Bearer <token>' \
--header 'X-Authorization: <api-key>'import requests
url = "https://{defaultHost}/v1/workspaces/{id}/sessions"
headers = {
"Authorization": "Bearer <token>",
"X-Authorization": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'X-Authorization': '<api-key>'}
};
fetch('https://{defaultHost}/v1/workspaces/{id}/sessions', 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://{defaultHost}/v1/workspaces/{id}/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"X-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/v1/workspaces/{id}/sessions"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("X-Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/workspaces/{id}/sessions")
.header("Authorization", "Bearer <token>")
.header("X-Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/workspaces/{id}/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["X-Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"access": "<string>",
"user_id": "<string>",
"app_id": "<string>",
"refresh": "<string>",
"csrf": "<string>",
"access_expires_at": "<string>",
"refresh_expires_at": "<string>",
"key_id": "<string>"
}{
"error": "Workspace API key required",
"error_code": "workspace_api_key_required"
}{
"error": "Workspace access denied",
"error_code": "workspace_access_denied"
}{
"error": "App not found in workspace",
"error_code": "app_not_in_workspace"
}Authorizations
API Secret token
User Access token
Path Parameters
Workspace ID
Response
successful
JWT access token
App user ID
App ID that the session was created for
JWT refresh token
CSRF token
Access token expiration
Refresh token expiration
Workspace key ID for verification
Was this page helpful?
⌘I