curl --request POST \
--url https://api.stackone.com/connect_sessions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"categories": [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
],
"provider": "<string>",
"provider_version": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"expires_in": 1800,
"metadata": {},
"multiple": false,
"label": "<string>",
"type": [
"PRODUCTION",
"TEST"
],
"integration_id": "<string>",
"connector_profile_id": "<string>"
}
'import requests
url = "https://api.stackone.com/connect_sessions"
payload = {
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"categories": ["ats", "hris", "hrisLegacy", "crm", "iam", "marketing", "lms", "stackOne", "documents", "ticketing", "screening", "messaging", "accounting", "scheduling"],
"provider": "<string>",
"provider_version": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"expires_in": 1800,
"metadata": {},
"multiple": False,
"label": "<string>",
"type": ["PRODUCTION", "TEST"],
"integration_id": "<string>",
"connector_profile_id": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
origin_owner_id: '<string>',
origin_owner_name: '<string>',
categories: [
'ats',
'hris',
'hrisLegacy',
'crm',
'iam',
'marketing',
'lms',
'stackOne',
'documents',
'ticketing',
'screening',
'messaging',
'accounting',
'scheduling'
],
provider: '<string>',
provider_version: '<string>',
origin_username: '<string>',
account_id: '<string>',
expires_in: 1800,
metadata: {},
multiple: false,
label: '<string>',
type: ['PRODUCTION', 'TEST'],
integration_id: '<string>',
connector_profile_id: '<string>'
})
};
fetch('https://api.stackone.com/connect_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://api.stackone.com/connect_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([
'origin_owner_id' => '<string>',
'origin_owner_name' => '<string>',
'categories' => [
'ats',
'hris',
'hrisLegacy',
'crm',
'iam',
'marketing',
'lms',
'stackOne',
'documents',
'ticketing',
'screening',
'messaging',
'accounting',
'scheduling'
],
'provider' => '<string>',
'provider_version' => '<string>',
'origin_username' => '<string>',
'account_id' => '<string>',
'expires_in' => 1800,
'metadata' => [
],
'multiple' => false,
'label' => '<string>',
'type' => [
'PRODUCTION',
'TEST'
],
'integration_id' => '<string>',
'connector_profile_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.stackone.com/connect_sessions"
payload := strings.NewReader("{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.stackone.com/connect_sessions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/connect_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"organization_id": "<string>",
"project_id": "<string>",
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"token": "<string>",
"auth_link_url": "<string>",
"categories": [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
],
"provider": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"label": "<string>",
"metadata": {},
"external_trigger_token": "f0bc3d88-2178-5423-8c81-b81d6c9da824",
"type": [
"PRODUCTION",
"TEST"
],
"integration_id": "<string>",
"connector_profile_id": "<string>",
"latest_connection_attempt": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"status": "pending",
"account_secure_id": "<string>",
"oauth_error_code": "<string>",
"oauth_error_description": "<string>"
}
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Create Connect Session
Creates a short-lived connect session and returns the token and auth link that open the account-linking flow for one end-user.
curl --request POST \
--url https://api.stackone.com/connect_sessions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"categories": [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
],
"provider": "<string>",
"provider_version": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"expires_in": 1800,
"metadata": {},
"multiple": false,
"label": "<string>",
"type": [
"PRODUCTION",
"TEST"
],
"integration_id": "<string>",
"connector_profile_id": "<string>"
}
'import requests
url = "https://api.stackone.com/connect_sessions"
payload = {
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"categories": ["ats", "hris", "hrisLegacy", "crm", "iam", "marketing", "lms", "stackOne", "documents", "ticketing", "screening", "messaging", "accounting", "scheduling"],
"provider": "<string>",
"provider_version": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"expires_in": 1800,
"metadata": {},
"multiple": False,
"label": "<string>",
"type": ["PRODUCTION", "TEST"],
"integration_id": "<string>",
"connector_profile_id": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
origin_owner_id: '<string>',
origin_owner_name: '<string>',
categories: [
'ats',
'hris',
'hrisLegacy',
'crm',
'iam',
'marketing',
'lms',
'stackOne',
'documents',
'ticketing',
'screening',
'messaging',
'accounting',
'scheduling'
],
provider: '<string>',
provider_version: '<string>',
origin_username: '<string>',
account_id: '<string>',
expires_in: 1800,
metadata: {},
multiple: false,
label: '<string>',
type: ['PRODUCTION', 'TEST'],
integration_id: '<string>',
connector_profile_id: '<string>'
})
};
fetch('https://api.stackone.com/connect_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://api.stackone.com/connect_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([
'origin_owner_id' => '<string>',
'origin_owner_name' => '<string>',
'categories' => [
'ats',
'hris',
'hrisLegacy',
'crm',
'iam',
'marketing',
'lms',
'stackOne',
'documents',
'ticketing',
'screening',
'messaging',
'accounting',
'scheduling'
],
'provider' => '<string>',
'provider_version' => '<string>',
'origin_username' => '<string>',
'account_id' => '<string>',
'expires_in' => 1800,
'metadata' => [
],
'multiple' => false,
'label' => '<string>',
'type' => [
'PRODUCTION',
'TEST'
],
'integration_id' => '<string>',
'connector_profile_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.stackone.com/connect_sessions"
payload := strings.NewReader("{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.stackone.com/connect_sessions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.stackone.com/connect_sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"origin_owner_id\": \"<string>\",\n \"origin_owner_name\": \"<string>\",\n \"categories\": [\n \"ats\",\n \"hris\",\n \"hrisLegacy\",\n \"crm\",\n \"iam\",\n \"marketing\",\n \"lms\",\n \"stackOne\",\n \"documents\",\n \"ticketing\",\n \"screening\",\n \"messaging\",\n \"accounting\",\n \"scheduling\"\n ],\n \"provider\": \"<string>\",\n \"provider_version\": \"<string>\",\n \"origin_username\": \"<string>\",\n \"account_id\": \"<string>\",\n \"expires_in\": 1800,\n \"metadata\": {},\n \"multiple\": false,\n \"label\": \"<string>\",\n \"type\": [\n \"PRODUCTION\",\n \"TEST\"\n ],\n \"integration_id\": \"<string>\",\n \"connector_profile_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"organization_id": "<string>",
"project_id": "<string>",
"origin_owner_id": "<string>",
"origin_owner_name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"token": "<string>",
"auth_link_url": "<string>",
"categories": [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
],
"provider": "<string>",
"origin_username": "<string>",
"account_id": "<string>",
"label": "<string>",
"metadata": {},
"external_trigger_token": "f0bc3d88-2178-5423-8c81-b81d6c9da824",
"type": [
"PRODUCTION",
"TEST"
],
"integration_id": "<string>",
"connector_profile_id": "<string>",
"latest_connection_attempt": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"status": "pending",
"account_secure_id": "<string>",
"oauth_error_code": "<string>",
"oauth_error_description": "<string>"
}
}{
"statusCode": 400,
"message": "Bad Request",
"timestamp": "2023-05-30T00:00:00.000Z",
"data": {
"statusCode": 400,
"message": "Bad Request",
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
},
"provider_errors": [
{
"status": 400,
"url": "https://api.provider.com/v1/resource",
"raw": {
"message": "Invalid input parameters"
},
"headers": {
"content-type": "application/json",
"x-request-id": "5678c28b211dace4e0a0f9171e6b88c5"
}
}
]
}{
"statusCode": 401,
"message": "Unauthorized",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 403,
"message": "Forbidden resource",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 404,
"message": "Not Found",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 408,
"message": "Request timed out",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 409,
"message": "Conflict",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 422,
"message": "Unprocessable Entity",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 429,
"message": "Too many requests",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 500,
"message": "Internal server error",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 501,
"message": "Not Implemented",
"timestamp": "2023-05-30T00:00:00.000Z"
}{
"statusCode": 502,
"message": "Bad Gateway",
"timestamp": "2023-05-30T00:00:00.000Z"
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
The unique identifier for the organization in your system (e.g. your customer's org ID). Combined with origin_owner_name and provider, this determines whether a new linked account is created or an existing one is updated.
A human-readable name for the organization. Stored against the linked account in StackOne for identification purposes.
The categories of the provider to connect to
ats, hris, hris-legacy, crm, iam, marketing, lms, stackone, documents, ticketing, screening, messaging, accounting, scheduling, null [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
]
The provider key to connect to (e.g. "salesforce", "bamboohr"). When provided, the hub opens directly at the credential entry step for this provider. The session binds to the project default connector profile when the caller may use it, otherwise to another connector profile for the provider that the caller may use; if none is usable the request is refused. Omit to show the full provider selection screen. To target a specific connector profile, use connector_profile_id instead.
Deprecated. When supplied, provider_version restricts binding to connector profiles of that version, so a version with no usable profile causes session creation to fail. Omit it to bind the default connector profile (or another the caller may use). To target a specific connector profile, use connector_profile_id.
The origin username
The unique identifier for the account associated with this connect session. When this field is present, the hub will launch in edit mode using the retrieved token.
How long the session should be valid for in seconds
The metadata for the connection
If set, this connect session will allow creation of multiple accounts with the same origin owner id and provider. Has no effect if account_id is set.
The label to be applied to the account associated with this connect session.
The connect session account type
production, test, null ["PRODUCTION", "TEST"]
Deprecated: use connector_profile_id instead (this is an alias for it). The ID of the connector profile to use for this connect session. Use this to route to a non-default connector profile — for example when you have multiple profiles for the same provider, or when migrating end users to a new connector major version. Retrieve the ID from GET /connector_profiles. When omitted, the session binds to the project default connector profile when the caller may use it, otherwise to another connector profile for the provider that the caller may use.
The ID of the connector profile to use for this connect session. Use this to route to a non-default connector profile — for example when you have multiple profiles for the same provider, or when migrating end users to a new connector major version. Retrieve the ID from GET /connector_profiles. When omitted, the session binds to the project default connector profile when the caller may use it, otherwise to another connector profile for the provider that the caller may use.
Response
The details of the connect session created with token and auth link
ats, hris, hris-legacy, crm, iam, marketing, lms, stackone, documents, ticketing, screening, messaging, accounting, scheduling, null [
"ats",
"hris",
"hrisLegacy",
"crm",
"iam",
"marketing",
"lms",
"stackOne",
"documents",
"ticketing",
"screening",
"messaging",
"accounting",
"scheduling"
]
Arbitrary set of key and values defined during the session token creation. This can be used to tag an account (eg. based on their pricing plan)
External trigger token to be used to trigger actions on the account
"f0bc3d88-2178-5423-8c81-b81d6c9da824"
The connect session account type
production, test, unmapped_value, null ["PRODUCTION", "TEST"]
Deprecated: use connector_profile_id instead. The integration ID (UUID) associated with this connect session.
The connector profile ID associated with this connect session
The most recent connection attempt initiated against this session, if any. Use this to poll for OAuth completion: when status is "authenticated", the resulting account is at account_secure_id.
Show child attributes
Show child attributes
Was this page helpful?