THE DEVELOPER’S CORNER

A good place to start building.

Connect a page, create a key, and make your first request. The rest is yours to build.

Integration examples

Replace YOUR_FEED_ID and the key placeholders with values from your account. Use environment variables for secret keys.

Server JavaScript

const response = await fetch(
  "https://api.profeedwp.com/api/headless-profeed/v1/feeds/YOUR_FEED_ID/posts?page_size=20",
  { headers: { Authorization: `Bearer ${process.env.PROFEED_API_KEY}` } },
);

if (response.status === 202) {
  // Return your loading state and retry after the Retry-After header.
} else if (!response.ok) {
  throw new Error(`Feed request failed: ${response.status}`);
} else {
  const { posts, refresh } = await response.json();
  // Render posts with your own components.
}

For server-rendered React frameworks, make the request in a server component or server route. Keep the key out of variables prefixed with NEXT_PUBLIC_, VITE_, or equivalent browser prefixes.

Browser JavaScript

const response = await fetch("https://api.profeedwp.com/api/headless-profeed/v1/feeds/YOUR_FEED_ID/posts", {
  headers: { "X-API-Key": "YOUR_PUBLISHABLE_KEY" },
});

if (response.ok && response.status !== 202) {
  const { posts } = await response.json();
  // The browser sends Origin automatically.
  // Render post text with textContent or React text nodes.
}

Configure the website’s exact origin on the publishable key. Do not send cookies or try to override Origin. Browser credentials are intentionally public and read-only.

PHP

<?php
$request = curl_init('https://api.profeedwp.com/api/headless-profeed/v1/feeds/YOUR_FEED_ID/posts');
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 10,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('PROFEED_API_KEY')],
]);
$body = curl_exec($request);
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
curl_close($request);
if ($status === 200 && $body !== false) {
    $feed = json_decode($body, true, flags: JSON_THROW_ON_ERROR);
    foreach ($feed['posts'] as $post) {
        echo '<p>' . htmlspecialchars($post['text'], ENT_QUOTES, 'UTF-8') . '</p>';
    }
}

Static-site builds

Fetch the API during your build with a secret key supplied by CI. Deploy only the returned public posts, never the key. When LinkedIn has not finished its first refresh, wait and retry rather than publishing an empty page as a successful build.

Your own build frequency determines when visitors see updated content. To refresh independently of builds, use a server route or the browser example above.