---
title: "Write API and site keys"
description: "Add, update, and remove sitemap URLs from a script, deploy hook, or automation tool, authenticated with the site's key."
---

> 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.

# Write API and site keys

The write API changes a site's sitemap URLs without opening Atomicity or redeploying the site. Anything that can send an HTTP request can use it: a script, a step that runs after the site deploys, or an automation tool. There's no library to install.

Each site has one **site key**. Find it under **Sitemap → API**. Only your agency team can see or change keys.

## The site key

A key has two parts:

| Part | Where it's used |
| --- | --- |
| **Key ID** | In the request URL. It isn't secret. |
| **Secret** | As a bearer token in the `Authorization` header. It's shown once, when it's created; after that, only its last characters are shown, under **Secret ends in**. |

Opening the **Install** tab creates the site's key if it doesn't have one yet. Keep the secret out of your code: put it in an environment variable, such as `SITEMAP_KEY`.

| Action | What happens |
| --- | --- |
| **Get a new secret** | Replaces the secret. The old one stops working straight away, so update anything that uses it. The route on the site keeps working, since it doesn't use the secret. |
| **Revoke this key** | The site's sitemap stops being served: its `/sitemap.xml` answers not found, and scripts using the key stop working. Opening the Install tab again creates a new key. |

## Requests

```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 there. |
| `DELETE` | Removes each URL. URLs that aren't in the sitemap are ignored. |

Every request needs:

- `Authorization: Bearer YOUR_SECRET`
- `Content-Type: application/json`
- A JSON body with `urls`: one URL or up to **1,000** per request.

Each URL is either a string, or an object with `loc` and optional details:

```json
{
  "urls": [
    "https://yourclient.com/about",
    {
      "loc": "https://yourclient.com/blog/new-post",
      "lastmod": "2026-11-22",
      "changefreq": "weekly",
      "priority": 0.8
    }
  ]
}
```

| Field | Type | Notes |
| --- | --- | --- |
| `loc` | string | Required. An `https://` URL on the site's domain or one of its other domains, up to 2,048 characters. |
| `lastmod` | string | Optional. `2026-11-22` or `2026-11-22T10:00:00Z`. Tells search engines when a page changed. |
| `changefreq` | string | Optional. `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, or `never`. |
| `priority` | number | Optional. From 0 to 1. |

## Responses

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

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

A request is **all or nothing**. If any URL is invalid, such as one on another domain, nothing is saved, and the response lists which URLs failed and why. A request that would take the sitemap over its plan's cap is refused. See [Plans and limits](https://docs.atomicity.dev/billing/plans/).

Each key can make 60 requests a minute. The [Sitemap API reference](https://docs.atomicity.dev/reference/sitemap-api/#errors) lists every error.

## Examples

### curl

```sh
curl -X PUT https://app.atomicity.dev/s/YOUR_KEY_ID/urls \
  -H "Authorization: Bearer $SITEMAP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://yourclient.com/new-page"]}'
```

### JavaScript

```js
const response = await fetch("https://app.atomicity.dev/s/YOUR_KEY_ID/urls", {
  method: "PUT",
  headers: {
    Authorization: "Bearer " + process.env.SITEMAP_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ urls: ["https://yourclient.com/new-page"] }),
});

console.log(await response.json()); // { success: true, added: 1, updated: 0, total: 13 }
```

### Python

```python
import os
import requests

response = requests.put(
    "https://app.atomicity.dev/s/YOUR_KEY_ID/urls",
    headers={"Authorization": "Bearer " + os.environ["SITEMAP_KEY"]},
    json={"urls": ["https://yourclient.com/new-page"]},
)

print(response.json())
```

## Zapier, Make, and n8n

Use each tool's built-in HTTP request or webhook step, such as **Webhooks by Zapier**:

- **Method**: `PUT` to add or update, `DELETE` to remove.
- **Header**: `Authorization`, with the value `Bearer YOUR_SECRET`.
- **Body (JSON)**: `{"urls": ["https://yourclient.com/page"]}`.

## Related

- [Manage URLs](https://docs.atomicity.dev/sitemaps/manage-urls/)
- [Change webhooks](https://docs.atomicity.dev/sitemaps/webhooks/)
- [Sitemap API](https://docs.atomicity.dev/reference/sitemap-api/)

Source: https://docs.atomicity.dev/sitemaps/api/index.mdx
