Generate connection link
Generates a new authorization URL for an existing LinkedIn account. The user must open the link to authenticate with LinkedIn or reconnect the account.
The connection link is valid for 48 hours.
Request
Endpoint
POST https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts/{account_id}/generate-connect-link
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 in which the LinkedIn account exists |
account_id | Yes | integer | Path parameter - ID of the LinkedIn account for which the new authorization link will be generated |
Body
This endpoint does not require a request body.
Request samples
- cURL
- Python
- Java
- Node.js
- PHP
curl --request POST \
--url "https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts/{account_id}/generate-connect-link" \
--header "x-api-key: {YOUR_API_KEY}" \
--header "Content-Type: application/json"
import requests
def generate_connect_link(company_id, account_id):
url = f"https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/linkedin_accounts/{account_id}/generate-connect-link"
headers = {
"x-api-key": "{YOUR_API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
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
account_id = 456 # Example LinkedIn account ID
data = generate_connect_link(company_id, account_id)
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
int accountId = 456; // Example LinkedIn account ID
generateConnectLink(companyId, accountId);
}
public static void generateConnectLink(int companyId, int accountId) {
try {
String url = "https://api.woodpecker.co/rest/v2/agency/companies/" + companyId + "/linkedin_accounts/" + accountId + "/generate-connect-link";
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.noBody())
.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 generateConnectLink(companyId, accountId) {
const url = `https://api.woodpecker.co/rest/v2/agency/companies/${companyId}/linkedin_accounts/${accountId}/generate-connect-link`;
const headers = {
'x-api-key': '{YOUR_API_KEY}',
'Content-Type': 'application/json'
};
try {
const response = await axios.post(url, null, { 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 accountId = 456; // Example LinkedIn account ID
await generateConnectLink(companyId, accountId);
})();
<?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}';
$accountId = '{ACCOUNT_ID}';
try {
$response = $client->post("agency/companies/{$companyId}/linkedin_accounts/{$accountId}/generate-connect-link");
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
- 500
Connection link generated, use it 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 LinkedIn account |
connect_account_link | string | URL to use to finish the authorization process |
Non-existing or incorrect account_id
{
"type": "VALIDATION_ERROR",
"code": "BAD_REQUEST",
"message": "Invalid account id.",
"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 explanation of the problem |
request_id | string | Unique identifier of the request. Provide it when contacting support |
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 |
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 |