curl --request POST \
--url https://api.deck.co/v2/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workflow_id": "wflo_AbC123xYz456",
"task_id": "task_AbC123xYz456",
"credential_id": "cred_AbC123xYz456",
"credential_ids": [
"<string>"
],
"task_run_id": "trun_AbC123xYz456",
"workflow_run_id": "wrun_AbC123xYz456",
"session_id": "sess_AbC123xYz456"
}
'import requests
url = "https://api.deck.co/v2/token"
payload = {
"workflow_id": "wflo_AbC123xYz456",
"task_id": "task_AbC123xYz456",
"credential_id": "cred_AbC123xYz456",
"credential_ids": ["<string>"],
"task_run_id": "trun_AbC123xYz456",
"workflow_run_id": "wrun_AbC123xYz456",
"session_id": "sess_AbC123xYz456"
}
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({
workflow_id: 'wflo_AbC123xYz456',
task_id: 'task_AbC123xYz456',
credential_id: 'cred_AbC123xYz456',
credential_ids: ['<string>'],
task_run_id: 'trun_AbC123xYz456',
workflow_run_id: 'wrun_AbC123xYz456',
session_id: 'sess_AbC123xYz456'
})
};
fetch('https://api.deck.co/v2/token', 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.deck.co/v2/token",
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([
'workflow_id' => 'wflo_AbC123xYz456',
'task_id' => 'task_AbC123xYz456',
'credential_id' => 'cred_AbC123xYz456',
'credential_ids' => [
'<string>'
],
'task_run_id' => 'trun_AbC123xYz456',
'workflow_run_id' => 'wrun_AbC123xYz456',
'session_id' => 'sess_AbC123xYz456'
]),
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.deck.co/v2/token"
payload := strings.NewReader("{\n \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\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.deck.co/v2/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deck.co/v2/token")
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 \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\n}"
response = http.request(request)
puts response.read_body{
"id": "tok_AbC123xYz456",
"object": "<string>",
"token": "<string>",
"expires_at": "2026-08-24T12:00:00Z",
"created_at": "2026-08-24T12:00:00Z",
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}Create a session token
Creates a short-lived session token for the Auth Component and the Live View Component. Expiry slides 30 minutes on each request, capped at 24 hours from creation, so expires_at is the expiry if the token is never used.
Bind the IDs you pass the component, and the token reaches only those objects and the ones it creates. A token without bindings can reach any object in the organization it’s given an ID for. Any other object in the organization returns 404 to it. Each ID must exist in the organization, or the request fails with 404 (resource_not_found) and no token is created.
curl --request POST \
--url https://api.deck.co/v2/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workflow_id": "wflo_AbC123xYz456",
"task_id": "task_AbC123xYz456",
"credential_id": "cred_AbC123xYz456",
"credential_ids": [
"<string>"
],
"task_run_id": "trun_AbC123xYz456",
"workflow_run_id": "wrun_AbC123xYz456",
"session_id": "sess_AbC123xYz456"
}
'import requests
url = "https://api.deck.co/v2/token"
payload = {
"workflow_id": "wflo_AbC123xYz456",
"task_id": "task_AbC123xYz456",
"credential_id": "cred_AbC123xYz456",
"credential_ids": ["<string>"],
"task_run_id": "trun_AbC123xYz456",
"workflow_run_id": "wrun_AbC123xYz456",
"session_id": "sess_AbC123xYz456"
}
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({
workflow_id: 'wflo_AbC123xYz456',
task_id: 'task_AbC123xYz456',
credential_id: 'cred_AbC123xYz456',
credential_ids: ['<string>'],
task_run_id: 'trun_AbC123xYz456',
workflow_run_id: 'wrun_AbC123xYz456',
session_id: 'sess_AbC123xYz456'
})
};
fetch('https://api.deck.co/v2/token', 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.deck.co/v2/token",
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([
'workflow_id' => 'wflo_AbC123xYz456',
'task_id' => 'task_AbC123xYz456',
'credential_id' => 'cred_AbC123xYz456',
'credential_ids' => [
'<string>'
],
'task_run_id' => 'trun_AbC123xYz456',
'workflow_run_id' => 'wrun_AbC123xYz456',
'session_id' => 'sess_AbC123xYz456'
]),
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.deck.co/v2/token"
payload := strings.NewReader("{\n \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\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.deck.co/v2/token")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deck.co/v2/token")
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 \"workflow_id\": \"wflo_AbC123xYz456\",\n \"task_id\": \"task_AbC123xYz456\",\n \"credential_id\": \"cred_AbC123xYz456\",\n \"credential_ids\": [\n \"<string>\"\n ],\n \"task_run_id\": \"trun_AbC123xYz456\",\n \"workflow_run_id\": \"wrun_AbC123xYz456\",\n \"session_id\": \"sess_AbC123xYz456\"\n}"
response = http.request(request)
puts response.read_body{
"id": "tok_AbC123xYz456",
"object": "<string>",
"token": "<string>",
"expires_at": "2026-08-24T12:00:00Z",
"created_at": "2026-08-24T12:00:00Z",
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}{
"errors": [
{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"field": "<string>",
"policy": {
"type": "payment",
"amount_max": 1
}
}
],
"request_id": "<string>"
}Body
IDs to bind the token to. Bind the IDs you pass the component.
Response
Created
A session token for the Auth Component. Expires 30 minutes after its last use, and no later than 24 hours after creation. Scoped to a single component session.
Was this page helpful?