# Get an article

```text
GET https://api.seoforsaas.dev/api/v1/projects/{projectId}/content/by-slug/{slug}
GET https://api.seoforsaas.dev/api/v1/projects/{projectId}/content/{articleId}
```

Use the slug on an article page. Use the ID if your site stores IDs. Both return the same object, and neither changes when an article is rewritten.

cURL:

```bash
curl "https://api.seoforsaas.dev/api/v1/projects/YOUR_PROJECT_ID/content/by-slug/how-google-decides-what-to-show" \
  -H "Authorization: Bearer $SEOFORSAAS_CONTENT_KEY"
```

TypeScript:

```ts
import { createClient } from "./lib/seoforsaas/client";

const seoforsaas = createClient({
  projectId: process.env.SEOFORSAAS_PROJECT_ID,
  contentKey: process.env.SEOFORSAAS_CONTENT_KEY,
});

// The article and its related links, or null when there is none at this slug.
const article = await seoforsaas.getArticle("how-google-decides-what-to-show");
```

Python:

```python
import os
from urllib.parse import quote

import requests

BASE = f"https://api.seoforsaas.dev/api/v1/projects/{os.environ['SEOFORSAAS_PROJECT_ID']}/content"

session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['SEOFORSAAS_CONTENT_KEY']}"


def get_article(slug: str) -> dict | None:
    """The article and its related links, or None when there is none at this slug."""
    res = session.get(f"{BASE}/by-slug/{quote(slug)}", timeout=10)
    if res.status_code == 404:
        return None
    res.raise_for_status()
    return res.json()["data"]
```

## Response

```json
{
  "success": true,
  "data": {
    "id": "…",
    "slug": "how-google-decides-what-to-show",
    "title": "…",
    "blocks": [],
    "seo": {},
    "related": [{ "title": "How to write a sitemap", "href": "/blog/how-to-write-a-sitemap" }]
  }
}
```

A draft, an archived article, and an unknown slug all return the same `404`. `related` is computed when you read, from the articles published by then, so older articles gain links to newer ones on your next build; each `href` already starts with your base path (**Articles live under**).
