---
title: "Sitemap API"
description: "The public XML routes a site's proxy reads, and the authenticated endpoints that add and remove URLs."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.atomicity.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sitemap API

The sitemap API has two parts: **public routes** that serve a site's sitemap as XML, which the [proxy route](https://docs.atomicity.dev/sitemaps/install/) on the site reads, and **write endpoints** that change its URLs with the [site key](https://docs.atomicity.dev/sitemaps/api/).

## Public XML routes

No authentication. A site's sitemap is addressed by its site ID.

| Route | Returns |
| --- | --- |
| `GET https://app.atomicity.dev/s/YOUR_SITE_ID/sitemap.xml` | The sitemap. Up to 50,000 URLs, a `urlset`. Above that, a sitemap index listing the child files. |
| `GET https://app.atomicity.dev/s/YOUR_SITE_ID/sitemaps/FILE.xml` | One child file of a sitemap index. |

`HEAD` works on both, and returns headers only.

These are for the proxy route to fetch. Give search engines the client's own address, `https://yourclient.com/sitemap.xml`, never these.

### Sitemap indexes

Above 50,000 URLs, which only the Scale plan allows, the sitemap is split into child files of about 40,000 URLs each, kept under 16 MB. `/sitemap.xml` then serves a `sitemapindex` that lists them, under the client's `/sitemaps/` path. The number of child files grows with the sitemap.

### Response headers

| Header | Value |
| --- | --- |
| `Content-Type` | `application/xml; charset=utf-8` |
| `Cache-Control` | `public, max-age=300, s-maxage=300, stale-while-revalidate=3600, stale-if-error=86400` |
| `ETag` | A hash of the file. Send it back as `If-None-Match` to get `304 Not Modified` when nothing changed. |

### Not found

`404`, with `Cache-Control: public, max-age=60`, when:

- The site ID doesn't exist, or the file doesn't.
- The site's sitemap is turned off.
- The site's key has been revoked.

## Write endpoints

```txt
https://app.atomicity.dev/s/YOUR_KEY_ID/urls
```

| Method | Does |
| --- | --- |
| `PUT` or `POST` | Adds each URL, or replaces its details if it's already in the sitemap. |
| `DELETE` | Removes each URL. URLs that aren't in the sitemap are ignored. |

### Authentication

Send the key's secret as a bearer token:

```txt
Authorization: Bearer YOUR_SECRET
```

There's no CORS: call the write endpoints from a server, never from a browser.

### Request body

`Content-Type: application/json`. Up to 1,000 URLs per request.

| Body | Method |
| --- | --- |
| `{ "urls": [ ... ] }`: each item a URL string, or an object with `loc` and optional details | Any |
| `{ "loc": "...", "lastmod": "...", "changefreq": "...", "priority": 0.5 }`: one URL | `PUT`, `POST`, `DELETE` |
| `{ "url": "..." }`: one URL, with no details | Any |

| Field | Type | Rules |
| --- | --- | --- |
| `loc` | string | Required. `https://`, on the site's domain or one of its other domains, up to 2,048 characters. |
| `lastmod` | string or null | `2026-11-22` or `2026-11-22T10:00:00Z`. |
| `changefreq` | string or null | `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, or `never`. |
| `priority` | number or null | From 0 to 1. |

The same URL twice in one request is an error.

### Success

`200`:

```json title="PUT or POST"
{ "success": true, "added": 2, "updated": 0, "total": 12 }
```

```json title="DELETE"
{ "success": true, "removed": 2 }
```

Changes show up on the public routes within a few minutes.

### Errors

Every error is `{ "success": false, "error": "code", "message": "..." }`. A request is all or nothing: on any error, nothing is changed.

| Status | `error` | Cause |
| --- | --- | --- |
| `400` | `invalid_body` | The body isn't valid JSON, or isn't one of the shapes above. |
| `401` | `unauthorized` | The `Authorization` header is missing, or the key isn't valid. |
| `403` | `sitemap_disabled` | The site's sitemap is turned off. |
| `413` | `too_large` | The body is over 512 KB. Send fewer URLs at a time. |
| `422` | `too_many` | Over 1,000 URLs in one request. |
| `422` | `invalid_urls` | Some URLs can't be used. The response lists each one, with its position and the reason. |
| `422` | `over_cap` | The request would take the sitemap past its plan's cap. Includes `cap` and `total`. |
| `429` | `rate_limited` | Over 60 requests a minute for this key. Includes `Retry-After`. |
| `500` | `failed` | Couldn't save. Safe to retry. |
| `503` | `unavailable` | Couldn't check the key. Safe to retry. |

## Related

- [Write API and site keys](https://docs.atomicity.dev/sitemaps/api/)
- [Install the proxy](https://docs.atomicity.dev/sitemaps/install/)
- [Change webhooks](https://docs.atomicity.dev/sitemaps/webhooks/)

Source: https://docs.atomicity.dev/reference/sitemap-api/index.mdx
