Integrate the Linking Agent API directly into your backend. One POST request returns anchor texts and destination URLs ready to render, with typical responses under 50 ms.
The internal linking API returns a list of anchor texts and destination URLs for any page on your site. Each response may include an optional grouping so you can render a cluster of related links in a single section of the page, making navigation clearer for visitors and crawlers alike.
A typical response resolves within 50 ms. Most teams also cache the results locally since link data usually updates on a daily or weekly cadence. To further reduce latency, keep the HTTP connection open (persistent connections) for subsequent requests. Learn more about the Linking Agent on the Internal Linking platform page.
Send a POST request to the Linking Agent endpoint with the following headers and body.
X_API_KEY - your API key, provided during onboarding.User-Agent - a string identifying your application. For example: example corp/1.0 (+https://www.example.com)Content-Type: application/jsonPOST /api/links HTTP/1.1
Content-Type: application/json
X_API_KEY: your-api-key
User-Agent: example corp/1.0 (+https://www.example.com)
{
"url": "https://www.example.com/category/shoes"
}The url field should contain the full URL of the page you want internal links for. The API will return links relevant to that specific page.
The API returns one of two HTTP status codes depending on whether links are available for the given page.
If there are no internal links to show for this page, the API returns an HTTP 204 with an empty body. No further action is needed on your side.
When the Linking Agent has links for the page, you receive an HTTP 200 with a JSON body:
{
"relatedSearches": [
{
"name": "running shoes for flat feet",
"url": "https://www.example.com/guides/flat-feet-running-shoes"
},
{
"name": "best trail running shoes",
"url": "https://www.example.com/category/trail-running"
},
{
"name": "shoe size guide",
"url": "https://www.example.com/help/size-guide"
}
]
}name - the anchor text to display for the link.url - the full destination URL the link should point to.For details on rendering these links and handling the content payload, see the content payload guide.
While the API already responds within 50 ms in most cases, caching on your side removes the network round-trip entirely for repeat visitors. Here are the recommended strategies:
// Pseudocode: fetch with cache
async function getInternalLinks(pageUrl) {
const cacheKey = "links:" + pageUrl;
let links = await cache.get(cacheKey);
if (!links) {
const response = await fetch(API_ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X_API_KEY": process.env.SIMILAR_API_KEY,
"User-Agent": "mysite/1.0 (+https://www.mysite.com)"
},
body: JSON.stringify({ url: pageUrl })
});
if (response.status === 204) {
links = [];
} else {
const data = await response.json();
links = data.relatedSearches;
}
// Cache for 24 hours
await cache.set(cacheKey, links, { ttl: 86400 });
}
return links;
}Server-side integration gives you full control over caching and rendering, but it is not the only option. Depending on your stack, one of these approaches may be a better fit:
The Linking Agent API integrates in minutes and responds in under 50 ms. Get your API key and start connecting your pages today.