Skip to main content
Use this guide for a website you build and maintain through code, such as Next.js, React, or plain HTML. This includes sites built by you, a developer, or with AI coding tools. Your website’s code retrieves published articles from RankAI’s API and displays them on public pages. The guide covers the two main API endpoints and a Next.js example you can adapt to your site. If your blog uses a supported CMS, choose its platform guide first, even when the rest of your website uses code.

API endpoints overview

RankAI provides two essential API endpoints for integrating content:
  • Articles list endpoint: Fetch a paginated list of all your published articles.
  • Single article endpoint: Fetch a specific article by its slug with customizable format (HTML or Markdown).

Endpoint 1: Get articles list

Use this endpoint to retrieve a paginated list of all your published articles with summary information.

API URL

Parameters

  • projectId: Your unique project identifier (replace {projectId} in the URL).
  • page: Page number for pagination (optional, defaults to 1).
  • limit: Number of articles per page (optional, defaults to 10, max 100).

Response format

Example usage

Endpoint 2: Get single article

Use this endpoint to fetch a specific article by its slug with full content in your preferred format.

API URL

Parameters

  • projectId: Your unique project identifier (replace {projectId} in the URL).
  • slug: The article’s URL slug (replace {slug} in the URL).
  • format: Content format — “html” or “markdown” (optional, defaults to “html”).
  • publishedUrl: The full URL where this article is published on your site (required for tracking).

Response format

Example usage

Next.js implementation example

Article list component

Single article component

Best practices

  • Pass published URL: Always include the publishedUrl parameter so we can track where your articles are published. This enables better analytics and indexing tracking.
  • Implement caching: Cache API responses to reduce load times and API calls (e.g. use Next.js revalidate).
  • Error handling: Always check the “success” field in responses and handle errors gracefully.
  • Pagination: Use the pagination data to implement proper pagination controls.

Troubleshooting

Common issues

  • Invalid format error: Ensure the format parameter is either “html” or “markdown”.
  • Article not found: Verify the slug exists and the article is published.
With these API endpoints, you can display RankAI’s content, optimized for SEO and AEO, on your website. The flexible format options and pagination support make it easy to build robust content flows that scale with your needs.

Install the technical SEO & AEO script

The article API above supplies content for your website to display. Follow the separate illustrated technical SEO & AEO setup to install the RankAI script.
Last reviewed: October 12, 2026.