Refresh Cookies
curl --request POST \
--url https://api.lobstr.io/v1/accounts/cookies \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"account": "<string>",
"type": "<string>",
"cookies": {}
}
'import requests
url = "https://api.lobstr.io/v1/accounts/cookies"
payload = {
"account": "<string>",
"type": "<string>",
"cookies": {}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({account: '<string>', type: '<string>', cookies: {}})
};
fetch('https://api.lobstr.io/v1/accounts/cookies', 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.lobstr.io/v1/accounts/cookies",
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([
'account' => '<string>',
'type' => '<string>',
'cookies' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.lobstr.io/v1/accounts/cookies"
payload := strings.NewReader("{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.lobstr.io/v1/accounts/cookies")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/accounts/cookies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status_code": 123,
"status_text": "<string>"
}Account
Refresh Cookies
Update and re-synchronize cookies for an existing account
POST
/
v1
/
accounts
/
cookies
Refresh Cookies
curl --request POST \
--url https://api.lobstr.io/v1/accounts/cookies \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"account": "<string>",
"type": "<string>",
"cookies": {}
}
'import requests
url = "https://api.lobstr.io/v1/accounts/cookies"
payload = {
"account": "<string>",
"type": "<string>",
"cookies": {}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({account: '<string>', type: '<string>', cookies: {}})
};
fetch('https://api.lobstr.io/v1/accounts/cookies', 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.lobstr.io/v1/accounts/cookies",
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([
'account' => '<string>',
'type' => '<string>',
'cookies' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.lobstr.io/v1/accounts/cookies"
payload := strings.NewReader("{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.lobstr.io/v1/accounts/cookies")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/accounts/cookies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"account\": \"<string>\",\n \"type\": \"<string>\",\n \"cookies\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"status_code": 123,
"status_text": "<string>"
}This endpoint updates and synchronizes cookies for an existing account using its account hash. Use this when your account cookies have expired or need to be refreshed.
Headers
string
required
Your API authentication token. Value:
Token YOUR_API_KEYstring
required
Must be application/json. Value:
application/jsonRequest Body
string
required
Existing account hash to update. Example:
"abfeb440ceccdfab974e8d261836c9d6"string
required
Account type identifier. Example:
"twitter-sync"object
required
Object containing updated cookie name-value pairs. Example:
{"auth_token": "...", "ct0": "..."}Response Field Explanations
string
Synchronization task identifier. Example:
"7966b678b6b63ef599deeea99cb2b219"string
Always “synchronize-cookies”. Example:
"synchronize-cookies"integer
Task status code (100 = created). Example:
100string
Human-readable status. Example:
"created"Refresh cookies immediately when you notice status_code_info showing ‘cookies_expired’ in List Accounts or Get Account Details.
Use the returned task ID with Check Sync Status to monitor the refresh process.
Refreshing cookies preserves all account settings and limits. You don’t need to reconfigure the account after refresh.
Set up monitoring to check account status regularly and automate cookie refresh when needed.
Code Examples
curl -X POST "https://api.lobstr.io/v1/accounts/cookies" \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account": "abfeb440ceccdfab974e8d261836c9d6",
"type": "twitter-sync",
"cookies": {
"auth_token": "<cookie.auth_token>",
"ct0": "<cookie.ct0>"
}
}'
import requests
import time
url = "https://api.lobstr.io/v1/accounts/cookies"
headers = {
"Authorization": "Token YOUR_API_KEY",
"Content-Type": "application/json"
}
# Refresh cookies for an existing Twitter account
payload = {
"account": "abfeb440ceccdfab974e8d261836c9d6", # Existing account hash
"type": "twitter-sync",
"cookies": {
"auth_token": "<cookie.auth_token>",
"ct0": "<cookie.ct0>"
}
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(f"Refresh task created: {data['id']}")
print(f"Status: {data['status_text']}")
# Poll for completion
task_id = data['id']
while True:
status_response = requests.get(
f"https://api.lobstr.io/v1/synchronize/{task_id}",
headers=headers
)
status = status_response.json()
if status['status_code'] == 200:
print(f"\n✓ Cookies refreshed successfully!")
break
elif status['status_code'] >= 400:
print(f"\n✗ Failed: {status['status_text']}")
break
print(f"Status: {status['status_text']}...")
time.sleep(2)
Response
200
{
"id": "7966b678b6b63ef599deeea99cb2b219",
"object": "synchronize-cookies",
"status_code": 100,
"status_text": "created"
}
400
{
"detail": "Invalid cookies or account type mismatch."
}
404
{
"detail": "Account not found."
}
⌘I