Check 21.09 · SaaS and B2B SEO

Publish API documentation if applicable

Publish indexable API documentation: static HTML pages, a public OpenAPI specification, generated with Redocly, Scribe, Scramble or API Platform.

Priority
Important
Difficulty
Intermediate
Estimated time
2 to 5 days, then ongoing
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

If your software exposes an API (application programming interface) open to customers or partners, its documentation must be public, readable without logging in and served as HTML that crawlers can read without running JavaScript. Once this check is done, every API resource has a page with a stable URL, the OpenAPI specification can be downloaded from a fixed address, and a developer finds “how to create a work order with the Planifia API” from Google or an AI assistant. If you have no public API, this check does not apply to you.

Why it matters

In B2B, the API is part of the evaluation. A prospect's technical lead checks before buying that the tool integrates with their ERP, their CRM or their scripts. They search for “[product] API webhooks”, “[product] API rate limit”, or ask an AI assistant directly to write the calling code. If the documentation sits behind a customer account, search finds nothing and the assistant invents endpoint names that look plausible but are wrong.

The second trap is technical. The most common viewers (Swagger UI, Redoc, Scalar) build the page in the browser from an OpenAPI file: the initial HTML contains almost nothing. Google renders JavaScript, but its own documentation points out that server-side rendering or pre-rendering is still a good idea because not all bots can run JavaScript. An API reference that only exists once a script has run is fragile for indexing and unreliable for generative engines.

This check is about publication and visibility. Making the API usable by AI agents is covered in document existing public APIs (opens in a new tab) and use OpenAPI if relevant (opens in a new tab).

What it improves

  • Visibility on technical queries Queries such as “[product] API”, “[product] webhook”, “integrate [product] with [tool]” find a dedicated page.
  • AI assistant answers Exact endpoint, parameter and error code names that generative engines can reuse instead of guessing them. No page guarantees a citation.
  • Sales cycle The technical prospect validates the integration on their own, without waiting for a meeting.
  • Inbound links Developers cite public documentation in their tutorials, repositories and forums.
  • Support Fewer “how do I do X with the API” tickets.
  • Overall rankings Indirect effect, limited to technical queries.

How to check

  1. Access without an account: open the documentation in a private browsing window. No reference page should ask you to log in.
  2. Content in the initial HTML: check that an endpoint name appears in the raw HTML, before any JavaScript.
curl -s https://example.com/docs/api/interventions | grep -c "POST /v1/interventions"

A result of 0 while the page does show the endpoint in the browser means the content is injected by JavaScript.

  1. Indexability: in Search Console, run URL Inspection on two or three reference pages. They must be indexable, with no noindex and no robots.txt block. Bing Webmaster Tools offers the same check in URL Inspection.
  2. Public specification: curl -s -o /dev/null -w "%{http_code} %{content_type}\n" https://example.com/openapi.json must return 200 application/json.
  3. GEO test: ask ChatGPT, Perplexity or Claude “How do I create a work order with the [product] API? Give me the curl request”. Compare the answer with your documentation: every invented endpoint points to a page that is missing, poorly indexed or ambiguous.

How to implement

Before you start

Plan the structure before the tool. Useful API documentation contains at least these pages:

Page Example URL Expected content
Quick start /docs/api/ Getting a key, first call in curl, response returned
Authentication /docs/api/authentification Method (key, OAuth 2.0), scope of permissions, key rotation
One page per resource /docs/api/interventions Endpoints, parameters, request and response examples
Webhooks /docs/api/webhooks Events, payload, signature, retries
Errors /docs/api/erreurs HTTP codes, business codes, what to do for each
Limits /docs/api/limites Quotas, rate limit, 429 code, Retry-After header
Versions and changelog /docs/api/versions Current version, deprecations, end-of-support dates
Specification /openapi.json Downloadable OpenAPI file

Rules that apply to every environment:

  • One URL per resource, not a single 300-screen page: each page can then target its query and be cited precisely. Keep stable anchors for each operation (#creer-une-intervention).
  • A subdirectory or a subdomain: example.com/docs/api/ and docs.example.com both work. Avoid the subdomain provided by a documentation platform (your-product.platform.io): the links you earn would benefit an address you do not control.
  • Static HTML for the reference, plus an interactive viewer if you want a “Try it” button.
  • An explicit title on each page: “Create a work order – Planifia API” rather than “POST /v1/interventions”.
  • Limits stated plainly: see present product limitations (opens in a new tab).

The examples use Planifia, a fictional vendor of field service scheduling software.

With Redocly CLI (any environment)

Redocly CLI validates an OpenAPI file and turns it into a standalone HTML page that any server can serve. It is the simplest route when the API is already described in OpenAPI.

npm install --global @redocly/cli
redocly lint openapi.yaml
redocly build-docs openapi.yaml --output public/docs/api/index.html

Without the --output option, the generated file is named redoc-static.html. Run these commands in your continuous integration every time the specification changes, then also copy openapi.yaml (or its JSON version) to the public root. Then use the curl command from the “How to check” section to confirm that the text of the operations is present in the HTML served.

This single file suits a small API. Beyond ten or so resources, prefer a documentation site generator that produces one page per resource (Docusaurus with the docusaurus-openapi-docs plugin, for example): more targeted URLs, lighter pages.

Laravel

Versions Laravel 10 to 13; Scribe 5, Scramble 0.13.

Scribe generates the documentation from the routes and validation requests:

composer require knuckleswtf/scribe
php artisan vendor:publish --tag=scribe-config

In config/scribe.php, choose the static type to get HTML files written to public/docs, served by the web server without going through PHP:

'type' => 'static',

Then generate:

php artisan scribe:generate

Scribe also writes public/docs/openapi.yaml and a Postman collection, public/docs/collection.json. With the laravel type (the default value), the documentation is served under /docs by a Blade view, which is also rendered on the server.

Scramble produces the OpenAPI specification automatically and displays it under /docs/api, with the JSON document under /docs/api.json. By default, these routes only work in the local environment. To open them to everyone in production, define the viewApiDocs gate in the boot method of AppServiceProvider; the nullable parameter allows visitors who are not logged in:

use App\Models\User;
use Illuminate\Support\Facades\Gate;

public function boot(): void
{
    Gate::define('viewApiDocs', fn (?User $user): bool => true);
}

Scramble's interface is built in the browser. For a version every crawler can read, export the specification and generate a static page with Redocly CLI:

php artisan scramble:export --path=public/openapi.json
redocly build-docs public/openapi.json --output public/docs/api/index.html

Symfony

Versions Symfony 6.4, 7.4 and 8.x; API Platform 4 and 5, NelmioApiDocBundle 5.

API Platform publishes the documentation under /docs (Swagger UI by default) and the raw specification under /docs.jsonopenapi. Export it to generate a static version:

bin/console api:openapi:export --output=public/openapi.json
redocly build-docs public/openapi.json --output public/docs/api/index.html

The --yaml option produces a YAML file (requires the symfony/yaml package). With NelmioApiDocBundle, the approach is the same: export the specification with bin/console nelmio:apidoc:dump --format=json > public/openapi.json, then generate the static page.

Next.js

Versions Next.js 15 and 16.

Generate the HTML page with Redocly CLI at build time, in public/, then expose it under a clean URL with a rewrite in next.config.js (or in the object exported by next.config.ts, the file create-next-app creates by default):

// next.config.js
module.exports = {
  async rewrites() {
    return [
      { source: '/docs/api', destination: '/api-reference.html' },
    ];
  },
};
{
  "scripts": {
    "prebuild": "redocly build-docs openapi.yaml --output public/api-reference.html && cp openapi.yaml public/openapi.yaml"
  }
}

For multi-page documentation, generate one page per resource in the App Router with generateStaticParams, from the OpenAPI file: each page is then pre-rendered at build time.

WordPress

Versions WordPress 6.4 to 7.1.

WordPress is poorly suited to a generated API reference. Two options:

  • Static files alongside WordPress: put the folder generated by Redocly CLI in docs/api/ at the site root (over SFTP or in your deployment). WordPress's default .htaccess rules do not rewrite files and folders that actually exist: Apache serves the HTML directly.
  • Guides written in WordPress: quick start, authentication, integration tutorials. Link them to the static reference.

Nginx

Versions Nginx 1.18 and later.

Serve the static folder and the specification with the right content type, in the site's server block (/etc/nginx/sites-available/example.com):

location /docs/api/ {
    alias /var/www/example/docs-api/;
    index index.html;
    try_files $uri $uri/ =404;
}

location = /openapi.json {
    root /var/www/example/public;
    default_type application/json;
    add_header Access-Control-Allow-Origin "*";
}

The CORS header lets online tools (OpenAPI editors, API clients) load the specification from their own domain. Reload with sudo nginx -t && sudo systemctl reload nginx.

Apache

Versions Apache 2.4.

In the .htaccess file at the root or in the virtual host configuration:

<Files "openapi.json">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
</Files>
AddType application/json .json
AddType application/yaml .yaml .yml

The generated docs/api/ folder is served as is. Reload with sudo apachectl configtest && sudo systemctl reload apache2 if you change the server configuration.

Hosted documentation platforms

Mintlify, ReadMe, GitBook and Stoplight host the documentation for you. Before choosing or keeping one of them, check four points:

  1. Custom domain (docs.example.com) configured, with a 301 redirect from the platform's address.
  2. Content in the initial HTML: the curl test from the “How to check” section on a reference page.
  3. Indexing allowed: no noindex left over from a private mode or a trial project, and a published sitemap.
  4. Public pages without login: some plans restrict the documentation to logged-in users; in that case, only a public part can be indexed.

Some platforms also generate an llms.txt file; this is an experimental convention, see evaluate llms-full.txt for documentation (opens in a new tab).

Write each reference page

For each operation:

  • one sentence that says what it does (“Creates a work order and assigns it to a technician”);
  • the method and path, the parameters with their type, whether they are required and an example;
  • a complete curl request, ready to copy, followed by the actual response;
  • the possible errors, with their cause;
  • the permissions required and the limits that apply.

Link each resource to the pages that cover it on the product side, for example the actual integration pages (opens in a new tab), and the other way round.

Common mistakes

  • Documentation restricted to logged-in customers: invisible to search engines, to AI assistants and to prospects evaluating the tool.
  • Reference only in Swagger UI or Redoc loaded client-side: the initial HTML is empty, and indexing depends on JavaScript rendering.
  • A single giant page: impossible to target a query or get a precise citation.
  • Documentation on the platform's subdomain: the links benefit a domain that is not yours and will be lost if you change tools.
  • Untested examples: a curl request that fails costs more trust than a missing page. Generate the examples from real calls.
  • Specification and documentation out of sync: generate both from the same source, in the same continuous integration.
  • Forgotten noindex mode after a new platform goes live.

Frequently asked questions

Should a SaaS API's documentation be public?

Yes. As soon as the API is offered to customers or partners, make its reference documentation public. Technical prospects evaluate it before buying, search engines can index it and AI assistants can answer with the real endpoint names. Secrets stay protected by API keys, not by hiding the documentation. Keep private only internal APIs or those reserved for a few partners under contract.

Are Swagger UI or Redoc enough for SEO?

Swagger UI and Redoc display the documentation by building the page in the browser from the OpenAPI file: the initial HTML contains very little text. Google runs JavaScript, but not every crawler can, including some generative engine crawlers. Keep the interactive viewer if you like, and publish a static HTML version alongside it, generated with Redocly CLI, for example.

API documentation on a subdomain or in a subdirectory?

Both work for SEO: docs.example.com and example.com/docs/api can be crawled and indexed in the same way. The choice depends mostly on the tool and the team that maintains the documentation. The mistake to avoid is the subdomain assigned by a third-party documentation platform: configure a custom domain that you control, so you keep the links if you change tools.

Should the OpenAPI file itself be published?

Yes. Publish the OpenAPI file at a stable address, for example /openapi.json, with the application/json content type. Developers import it into their API clients, tools generate SDKs from it and AI agents can use it to call the API correctly. Generate it from the same source as the HTML documentation so that the two do not drift apart.

Updated on

Topic checklist (PDF)

And now?

In the “SaaS and B2B SEO” topic

  1. Create pages for each feature
  2. Create pages for each use case
  3. Create pages for each industry and role
  4. Create pages for actual integrations
  5. Publish objective comparisons and useful alternatives pages
  6. Publish clear pricing
  7. Publish case studies
  8. Publish public documentation and a knowledge base
  9. Publish API documentation if applicable
  10. Publish a changelog
  11. Present security and verifiable certifications
  12. Present hosting options
  13. Present product limitations
  14. Present trial terms
  15. Build a presence on relevant review platforms
  16. Test AI-generated SaaS comparisons