Connect LinkedIn account
Create a LinkedIn account within the company and returns the account ID together with an authorization URL. The user must open the URL to authenticate with LinkedIn and complete the connection.
The connection link is valid for 48 hours.
To connect a LinkedIn account, you need an available LinkedIn slot. An account admin can manage slots in the billing section of the app.
Request
Endpoint
POST https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts
Headers
x-api-key: {YOUR_API_KEY}
Content-Type: application/json
For details on how to authenticate your requests, please see the authentication guide.
Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
company_id | Yes | integer | Path parameter - ID of the company where the LinkedIn account will be created |
Body
{
"timezone": "Europe/Warsaw"
}
Body schema
| Field | Required | Type | Description |
|---|---|---|---|
timezone | Yes | string | Canonical IANA time zone identifier representing the account's local time. (e.g. America/New_York, Europe/London). List of accepted timezonesAfrica/AbidjanAfrica/Algiers Africa/Bissau Africa/Cairo Africa/Casablanca Africa/El_Aaiun Africa/Johannesburg Africa/Khartoum Africa/Lagos Africa/Maputo Africa/Monrovia Africa/Nairobi Africa/Ndjamena Africa/Sao_Tome Africa/Tripoli Africa/Tunis Africa/Windhoek America/Anchorage America/Argentina/Buenos_Aires America/Asuncion America/Barbados America/Belize America/Bogota America/Caracas America/Cayenne America/Chicago America/Chihuahua America/Costa_Rica America/Denver America/Edmonton America/El_Salvador America/Grand_Turk America/Guatemala America/Guayaquil America/Guyana America/Halifax America/Havana America/Jamaica America/La_Paz America/Lima America/Los_Angeles America/Managua America/Manaus America/Martinique America/Mazatlan America/Mexico_City America/Miquelon America/Monterrey America/Montevideo America/New_York America/Panama America/Paramaribo America/Phoenix America/Port-au-Prince America/Puerto_Rico America/Regina America/Rio_Branco America/Santiago America/Santo_Domingo America/Sao_Paulo America/St_Johns America/Tegucigalpa America/Tijuana America/Toronto America/Vancouver America/Whitehorse America/Winnipeg Asia/Almaty Asia/Amman Asia/Ashgabat Asia/Baghdad Asia/Baku Asia/Bangkok Asia/Beirut Asia/Bishkek Asia/Colombo Asia/Damascus Asia/Dhaka Asia/Dubai Asia/Dushanbe Asia/Gaza Asia/Hong_Kong Asia/Irkutsk Asia/Jakarta Asia/Jerusalem Asia/Kabul Asia/Kamchatka Asia/Karachi Asia/Kathmandu Asia/Kolkata Asia/Krasnoyarsk Asia/Macau Asia/Magadan Asia/Manila Asia/Nicosia Asia/Novosibirsk Asia/Omsk Asia/Pyongyang Asia/Qatar Asia/Riyadh Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Taipei Asia/Tashkent Asia/Tbilisi Asia/Tehran Asia/Thimphu Asia/Tokyo Asia/Ulaanbaatar Asia/Urumqi Asia/Vladivostok Asia/Yakutsk Asia/Yerevan Atlantic/Azores Atlantic/Bermuda Atlantic/Cape_Verde Atlantic/Faroe Atlantic/South_Georgia Atlantic/Stanley Australia/Adelaide Australia/Brisbane Australia/Darwin Australia/Hobart Australia/Melbourne Australia/Perth Australia/Sydney Europe/Andorra Europe/Athens Europe/Belgrade Europe/Berlin Europe/Brussels Europe/Bucharest Europe/Budapest Europe/Chisinau Europe/Dublin Europe/Gibraltar Europe/Helsinki Europe/Istanbul Europe/Lisbon Europe/London Europe/Madrid Europe/Malta Europe/Minsk Europe/Moscow Europe/Paris Europe/Prague Europe/Riga Europe/Rome Europe/Sofia Europe/Tallinn Europe/Tirane Europe/Vienna Europe/Vilnius Europe/Volgograd Europe/Warsaw Europe/Zurich Indian/Chagos Indian/Maldives Indian/Mauritius Pacific/Auckland Pacific/Efate Pacific/Fakaofo Pacific/Fiji Pacific/Guadalcanal Pacific/Guam Pacific/Honolulu Pacific/Kiritimati Pacific/Nauru Pacific/Niue Pacific/Norfolk Pacific/Noumea Pacific/Pago_Pago Pacific/Palau Pacific/Pitcairn Pacific/Port_Moresby Pacific/Rarotonga Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu |
Request samples
- cURL
- Python
- Java
- Node.js
- PHP
curl --request POST \
--url "https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts" \
--header "x-api-key: {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"timezone": "Europe/Warsaw"
}'
import requests
def connect_linkedin(company_id, timezone):
url = f"https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts"
headers = {
"x-api-key": "{YOUR_API_KEY}",
"Content-Type": "application/json"
}
data = {
"timezone": timezone
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
return response.json()
else:
raise Exception(f"POST request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
try:
company_id = 123 # Example company ID
timezone = "Europe/Warsaw"
data = connect_linkedin(company_id, timezone)
print("POST response:", data)
except Exception as e:
print("Error:", e)
public class WoodpeckerApiClient {
private static final String API_KEY = "{YOUR_API_KEY}";
public static void main(String[] args) {
int companyId = 123; // Example company ID
String timezone = "Europe/Warsaw";
connectLinkedinAccount(companyId, timezone);
}
public static void connectLinkedinAccount(int companyId, String timezone) {
try {
String url = "https://api.woodpecker.co/rest/v2/agency/companies/" + companyId + "/linkedin_accounts";
String jsonData = "{ \"timezone\": \"" + timezone + "\" }";
java.net.http.HttpClient client = java.net.http.HttpClient.newHttpClient();
java.net.http.HttpRequest request = java.net.http.HttpRequest.newBuilder()
.uri(new java.net.URI(url))
.header("x-api-key", API_KEY)
.header("Content-Type", "application/json")
.POST(java.net.http.HttpRequest.BodyPublishers.ofString(jsonData))
.build();
java.net.http.HttpResponse<String> response = client.send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 201) {
System.out.println("POST response: " + response.body());
} else {
System.err.println("POST request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require('axios');
async function connectLinkedinAccount(companyId, timezone) {
const url = `https://api.woodpecker.co/rest/v2/agency/companies/${companyId}/linkedin_accounts`;
const headers = {
'x-api-key': '{YOUR_API_KEY}',
'Content-Type': 'application/json'
};
const data = { timezone: timezone };
try {
const response = await axios.post(url, data, { headers });
if (response.status === 201) {
console.log('POST response:', response.data);
} else {
console.error('POST request failed:', response.status);
}
} catch (error) {
console.error('POST request failed:', error.response ? error.response.status : error.message);
}
}
(async () => {
const companyId = 123; // Example company ID
const timezone = "Europe/Warsaw";
await connectLinkedinAccount(companyId, timezone);
})();
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client([
'base_uri' => 'https://api.woodpecker.co/rest/v2/',
'headers' => ['x-api-key' => getenv('WOODPECKER_API_KEY')],
]);
$companyId = '{COMPANY_ID}';
try {
$response = $client->post("agency/companies/{$companyId}/linkedin_accounts", [
'json' => [
'timezone' => 'Europe/Warsaw',
],
]);
echo $response->getStatusCode(), "\n";
echo $response->getBody(), "\n";
} catch (RequestException $e) {
echo "Error: ", $e->getMessage(), "\n";
if ($e->hasResponse()) {
echo $e->getResponse()->getBody(), "\n";
}
}
Response
Response examples
- 201
- 400
- 401
- 404
- 422
- 500
Account created in Woodpecker, use the generated link to finish the authorization process. After successful authorization, the account becomes active and ready to use.
{
"account_id": 123,
"connect_account_link": "https://app.edges.run/identities/linkedin/login?token=ey6Ickv8p9.eys4JpZ3BGl0"
}
Body schema
| Field | Type | Description |
|---|---|---|
account_id | integer | ID of the newly created LinkedIn account |
connect_account_link | string | URL to use to finish the authorization process |
Missing request body:
{
"type": "VALIDATION_ERROR",
"code": "BAD_REQUEST",
"message": "Missing request body",
"request_id": "dc4faa0f-78bf-54e9-9d5d-ce9538f2eec5"
}
Malformed request:
{
"type": "VALIDATION_ERROR",
"code": "BAD_REQUEST",
"message": "Invalid field(s).",
"request_id": "dc4faa0f-78bf-54e9-9d5d-ce9538f2eec5",
"fields": [
{
"field": "timezone",
"issue": "string"
}
]
}
Body schema
| Field | Type | Description |
|---|---|---|
type | string | High-level category of the error |
code | string | Text representation of the HTTP status code |
message | string | Human-readable explanation of the problem |
request_id | string | Unique identifier of the request. Provide it when contacting support |
fields | Optional array[object] | Present when the error is related to specific request fields |
└─field | string | Name of the field that failed validation |
└─issue | string | Description of the validation issue for the field. required, invalid |
An issue with authorization. Please review the authorization guide
{
"title": "Unauthorized",
"status": 401,
"detail": "Invalid api key",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description |
|---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
The requested company does not exists, is inactive, or the request URL is incorrect
{
"title": "Not Found",
"status": 404,
"detail": "No active company found" | "Requested resource does not exist",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description |
|---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
There are no available LinkedIn slots in your account. Please contact your administrator.
{
"type": "VALIDATION_ERROR",
"code": "UNPROCESSABLE_ENTITY",
"message": "No free LinkedIn slots available. Purchase more slots.",
"request_id": "fcdd7349-2a71-43bf-b31d-ab5c15a8f833"
}
Body schema
| Field | Type | Description |
|---|---|---|
type | string | High-level category of the error |
code | string | Text representation of the HTTP status code |
message | string | Human-readable explanation of the problem |
request_id | string | Unique identifier of the request. Provide it when contacting support |
Unexpected error, please try again later
{
"type": "INTERNAL_ERROR",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred on the server.",
"request_id": "dc4faa0f-78bf-54e9-9d5d-ce9538f2eec5"
}
Body schema
| Field | Type | Description |
|---|---|---|
type | string | High-level category of the error |
code | string | Text representation of the HTTP status code |
message | string | Human-readable description of what went wrong |
request_id | string | Unique identifier of the request. Provide it when contacting support |