Create a connection session
curl --request POST \
--url https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"customer_id": "cust_8f2a1c",
"requested_purposes": [
"personalization",
"analytics"
],
"redirect_uri": "https://partner.example.com/swapnice/callback"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_id: 'cust_8f2a1c',
requested_purposes: ['personalization', 'analytics'],
redirect_uri: 'https://partner.example.com/swapnice/callback'
})
};
fetch('https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions"
payload = {
"customer_id": "cust_8f2a1c",
"requested_purposes": ["personalization", "analytics"],
"redirect_uri": "https://partner.example.com/swapnice/callback"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"session": {
"id": "cs_0b77e2",
"app_id": "app_91b0",
"customer_id": "cust_8f2a1c",
"status": "created",
"requested_purposes": [
"personalization",
"analytics"
],
"expires_at": "2026-08-26T16:06:00.000Z",
"created_at": "2026-08-26T16:01:00.000Z"
},
"client_token": "cst_example",
"connection_url": "https://swapnice-gateway-dev.ceo-cbc.workers.dev/connect/cs_0b77e2"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Connection sessions
Create a connection session
Start the Plaid-Link-style account linking flow.
POST
/
v1
/
connection-sessions
Create a connection session
curl --request POST \
--url https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"customer_id": "cust_8f2a1c",
"requested_purposes": [
"personalization",
"analytics"
],
"redirect_uri": "https://partner.example.com/swapnice/callback"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_id: 'cust_8f2a1c',
requested_purposes: ['personalization', 'analytics'],
redirect_uri: 'https://partner.example.com/swapnice/callback'
})
};
fetch('https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/connection-sessions"
payload = {
"customer_id": "cust_8f2a1c",
"requested_purposes": ["personalization", "analytics"],
"redirect_uri": "https://partner.example.com/swapnice/callback"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"session": {
"id": "cs_0b77e2",
"app_id": "app_91b0",
"customer_id": "cust_8f2a1c",
"status": "created",
"requested_purposes": [
"personalization",
"analytics"
],
"expires_at": "2026-08-26T16:06:00.000Z",
"created_at": "2026-08-26T16:01:00.000Z"
},
"client_token": "cst_example",
"connection_url": "https://swapnice-gateway-dev.ceo-cbc.workers.dev/connect/cs_0b77e2"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Start the Plaid-Link-style account linking flow.
Open
connection_url for the user and poll the session. See consent and account linking.Authorizations
Headers
Body
application/json