Documentation

UpdateSEO

Update existing SEO pages via the Backend API.

UpdateSEO

Backend API to update existing SEO pages programmatically. Usage is charged from your credit balance.

Server-side only. updateSeoPage and the raw API must be called from the server only. Never use them in client-side code (e.g. React components, browser JavaScript)—the secret key would be exposed. Use API routes, server actions, or backend scripts instead.

Properties

PropertyTypeRequiredDescription
pageIdentifiersarray of PageIdentifiersYesAn array of PageIdentifiers to identify which pages to update.
pageSEOarray of PageSEOYesAn array of PageSEO objects with the updated data.
optionsOptionsNoAdditional options.

PageIdentifiers

PropertyTypeRequiredDescription
pathstringYesThe page path. Must begin with '/'.
pageIdstringNoThe pageId of the SEO page. Optional alternative to path for identifying a page.

PageSEO

PropertyTypeRequiredDescription
pathstringYesThe page path. Must begin with '/'.
titlestringYesPage title.
descriptionstringNoPage description.
follow"follow" or "nofollow"NoDefault: "follow"
index"index" or "noindex"NoDefault: "index"
changeFreq"daily" or "monthly" or "weekly"NoDefault: "weekly"
keywordsArraystring[]NoArray of keywords.
priority"1" to "0.1"NoDefault: "0.5"
ldsJSONstringNoJSON-LD structured data as a string.
imageobject with urlNoThe url property must point to an externally hosted image file.

Options

PropertyTypeRequiredDescription
upsertbooleanNoSet to true to create the page if it does not already exist. Default: false

API Reference

Endpoint: PUT https://v1.seomanager.dev/backend_api/seo/update

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
x-projectidYesYour project ID.
x-projectkeyYesYour project key.
x-projectsecretkeyYesYour secret key. Keep this private and never expose it client-side.

Request Body

{
  "pageIdentifiers": [{ "path": "/example" }],
  "pageSEO": [{ "path": "/example", "title": "Updated Example Page" }],
  "options": { "upsert": true }
}

Response Shape

// Success
{ message: "Successful", results: { succeeded: true }, error: false, statusCode: 200 }

// Error
{ results: false, error: true, message: "Error description" }

Examples

cURL

curl -X PUT https://v1.seomanager.dev/backend_api/seo/update \
  -H "Content-Type: application/json" \
  -H "x-projectid: YOUR_PROJECT_ID" \
  -H "x-projectkey: YOUR_PROJECT_KEY" \
  -H "x-projectsecretkey: YOUR_SECRET_KEY" \
  -d '{"pageIdentifiers":[{"path":"/example"}],"pageSEO":[{"path":"/example","title":"Updated Example Page"}],"options":{"upsert":true}}'

Python

import requests

url = "https://v1.seomanager.dev/backend_api/seo/update"
headers = {
    "Content-Type": "application/json",
    "x-projectid": "YOUR_PROJECT_ID",
    "x-projectkey": "YOUR_PROJECT_KEY",
    "x-projectsecretkey": "YOUR_SECRET_KEY",
}
payload = {
    "pageIdentifiers": [{"path": "/example"}],
    "pageSEO": [{"path": "/example", "title": "Updated Example Page"}],
    "options": {"upsert": True},
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())

PHP

<?php
$url = "https://v1.seomanager.dev/backend_api/seo/update";
$payload = [
    "pageIdentifiers" => [["path" => "/example"]],
    "pageSEO" => [["path" => "/example", "title" => "Updated Example Page"]],
    "options" => ["upsert" => true],
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "x-projectid: YOUR_PROJECT_ID",
    "x-projectkey: YOUR_PROJECT_KEY",
    "x-projectsecretkey: YOUR_SECRET_KEY",
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
echo $response;

Node.js (fetch)

const response = await fetch("https://v1.seomanager.dev/backend_api/seo/update", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
    "x-projectid": process.env.SEO_MANAGER_PROJECT_ID,
    "x-projectkey": process.env.SEO_MANAGER_PROJECT_KEY,
    "x-projectsecretkey": process.env.SEO_MANAGER_SECRET_KEY,
  },
  body: JSON.stringify({
    pageIdentifiers: [{ path: "/example" }],
    pageSEO: [{ path: "/example", title: "Updated Example Page" }],
    options: { upsert: true },
  }),
});
const data = await response.json();

Node.js with nextjs-seo-manager (Next.js)

These examples run in API routes (server-side only)—never in client components.

Pages Router (API route)

// pages/api/update-seo.js
import SEOInit from "nextjs-seo-manager/init";
import { updateSeoPage } from "nextjs-seo-manager";

SEOInit({
  projectId: process.env.SEO_MANAGER_PROJECT_ID,
  secretKey: process.env.SEO_MANAGER_SECRET_KEY,
});

export default async function handler(req, res) {
  try {
    const response = await updateSeoPage(
      [{ path: "/example" }],
      [{ title: "Updated Example Page", path: "/example" }],
      { upsert: true }
    );
    return res.status(200).json(response);
  } catch (err) {
    return res.status(500).json({ error: err.message });
  }
}

App Router (API route)

// app/api/update-seo/route.ts
import { NextRequest, NextResponse } from "next/server";
import SEOInit from "nextjs-seo-manager/init";
import { updateSeoPage } from "nextjs-seo-manager";

SEOInit({
  projectId: process.env.SEO_MANAGER_PROJECT_ID,
  secretKey: process.env.SEO_MANAGER_SECRET_KEY,
});

export async function POST(request: NextRequest) {
  try {
    const { identifiers, seo, options } = await request.json();
    const response = await updateSeoPage(identifiers, seo, options);
    return NextResponse.json(response);
  } catch (err: any) {
    return NextResponse.json({ error: err.message }, { status: 500 });
  }
}

Limitations

  • Both pageIdentifiers and pageSEO arrays are limited to 50 items per call.
  • If any page in the batch has an error, none of them will be updated (all-or-nothing).
Explore

More documentation

Getting Started

Set up nextjs-seo-manager for your Next.js project.