Link Account to Squid
curl --request POST \
--url https://api.lobstr.io/v1/squids/{squid_hash} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"accounts": [
{}
]
}
'import requests
url = "https://api.lobstr.io/v1/squids/{squid_hash}"
payload = { "accounts": [{}] }
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({accounts: [{}]})
};
fetch('https://api.lobstr.io/v1/squids/{squid_hash}', 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/squids/{squid_hash}",
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([
'accounts' => [
[
]
]
]),
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/squids/{squid_hash}"
payload := strings.NewReader("{\n \"accounts\": [\n {}\n ]\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/squids/{squid_hash}")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"accounts\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/squids/{squid_hash}")
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 \"accounts\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyAccount
Link Account to Squid
Attach a platform account to a squid so account-based scrapers can authenticate
POST
/
v1
/
squids
/
{squid_hash}
Link Account to Squid
curl --request POST \
--url https://api.lobstr.io/v1/squids/{squid_hash} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"accounts": [
{}
]
}
'import requests
url = "https://api.lobstr.io/v1/squids/{squid_hash}"
payload = { "accounts": [{}] }
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({accounts: [{}]})
};
fetch('https://api.lobstr.io/v1/squids/{squid_hash}', 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/squids/{squid_hash}",
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([
'accounts' => [
[
]
]
]),
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/squids/{squid_hash}"
payload := strings.NewReader("{\n \"accounts\": [\n {}\n ]\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/squids/{squid_hash}")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"accounts\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lobstr.io/v1/squids/{squid_hash}")
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 \"accounts\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodySome scrapers require a connected platform account to run (LinkedIn, Facebook, Sales Navigator, etc.). Link one or more accounts to a squid by passing their hash IDs in the
The
accounts array when updating the squid.
Only scrapers that require authentication have an
accounts field. For public scrapers (Google Maps, Trustpilot, etc.) this field is ignored.Headers
string
required
Your API authentication token. Value:
Token YOUR_API_KEYstring
required
Request body format. Value:
application/jsonPath Parameters
string
required
The hash of the squid to update
Body Parameters
array
required
Array of account hash strings to link to the squid. Pass an empty array
[] or null to remove all linked accounts. Each hash must correspond to an account of the correct type for the scraper.How to find your account hash
Use List Accounts to retrieve your connected accounts and theirid (hash) values:
curl -X GET "https://api.lobstr.io/v1/accounts" \
-H "Authorization: Token YOUR_API_KEY"
id field in each account object is the hash you pass in the accounts array.
Code Examples
curl -X POST "https://api.lobstr.io/v1/squids/YOUR_SQUID_HASH" \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accounts": ["YOUR_ACCOUNT_HASH"]
}'
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.lobstr.io/v1"
headers = {"Authorization": f"Token {API_KEY}"}
# Step 1: get your account hashes
accounts_response = requests.get(f"{BASE_URL}/accounts", headers=headers)
accounts = accounts_response.json()["data"]
# Find the account you want to link
linkedin_account = next(a for a in accounts if a["type"] == "linkedin-sync")
account_hash = linkedin_account["id"]
# Step 2: link the account to your squid
squid_hash = "YOUR_SQUID_HASH"
response = requests.post(f"{BASE_URL}/squids/{squid_hash}",
headers=headers,
json={"accounts": [account_hash]}
)
print(response.json())
Response
200
{
"name": "LinkedIn Leads Scraper (1)",
"concurrency": 1,
"accounts": ["YOUR_ACCOUNT_HASH"]
}
Removing linked accounts
Pass an empty array to unlink all accounts from a squid:curl -X POST "https://api.lobstr.io/v1/squids/YOUR_SQUID_HASH" \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"accounts": []}'
Errors
| Error | Cause |
|---|---|
AccountDoesNotExist | One of the account hashes was not found or doesn’t belong to you |
InvalidParamType | accounts is not an array, or contains non-string values |