curl --request POST \
--url https://api.example.com/api/v1/connected-accounts/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"claim_token": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/connected-accounts/claim"
payload = { "claim_token": "<string>" }
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({claim_token: '<string>'})
};
fetch('https://api.example.com/api/v1/connected-accounts/claim', 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.example.com/api/v1/connected-accounts/claim",
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([
'claim_token' => '<string>'
]),
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.example.com/api/v1/connected-accounts/claim"
payload := strings.NewReader("{\n \"claim_token\": \"<string>\"\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.example.com/api/v1/connected-accounts/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"claim_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/connected-accounts/claim")
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 \"claim_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"previous_owner_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedin_slug": "<string>",
"success": true,
"next_action": "reconnect"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Claim Connected Account
Free a LinkedIn slug previously connected by another user.
The frontend calls this after receiving a 409 account_owned_by_another_user
from /connect or /connect-cookie. That earlier 409 carries a signed
claim_token AND deletes the requesting user’s freshly minted
Unipile account upstream so no orphan accumulates if the user never
follows through. Presenting the token here:
- Verifies HMAC + expiry + requesting-user binding (fail-closed).
- Enforces single-use jti via INSERT into
consumed_claim_tokens; a replay returns 410 Gone. - Runs the DB function
claim_connected_accountwhich (inside one transaction) disconnects the previous owner’s row, pauses their campaigns, and queues a user_alert. - Best-effort: deletes the previous owner’s Unipile account upstream.
The function does NOT INSERT a new row for the requesting user.
Response carries next_action="reconnect"; the frontend redirects
the user back to /connect (or /connect-cookie) to register their own
Unipile session, which now succeeds because the slug is no longer
held by any connected row.
curl --request POST \
--url https://api.example.com/api/v1/connected-accounts/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"claim_token": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/connected-accounts/claim"
payload = { "claim_token": "<string>" }
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({claim_token: '<string>'})
};
fetch('https://api.example.com/api/v1/connected-accounts/claim', 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.example.com/api/v1/connected-accounts/claim",
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([
'claim_token' => '<string>'
]),
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.example.com/api/v1/connected-accounts/claim"
payload := strings.NewReader("{\n \"claim_token\": \"<string>\"\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.example.com/api/v1/connected-accounts/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"claim_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/connected-accounts/claim")
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 \"claim_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"previous_owner_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"linkedin_slug": "<string>",
"success": true,
"next_action": "reconnect"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request body for POST /api/v1/connected-accounts/claim.
10 - 4096Response
Successful Response
Response from a successful ownership transfer.
The claim flow only DISCONNECTS the previous owner's row to free
the canonical slug; the requesting user re-runs /connect to
register their own Unipile session, which then succeeds because
the slug is no longer held.
User ID of the previous owner (for client-side audit logging only).
The canonical slug that was freed. The frontend uses this to prompt the user to re-run /connect and complete onboarding.
Always 'reconnect'. The frontend should redirect the user back to the connect flow so they can register their own Unipile session.