Documentation · API reference
POST
/api/v1/sitesAdd a site
This page as Markdown, or in an AI chatMore ways to read this page
Add a site to the account. Its name is its domain; the answer is the site as it now is.
# Add a site
> tidekeeper's API reference: https://tidekeeper.eu/docs/api/post-sites
`POST /api/v1/sites`
Add a site to the account. Its name is its domain; the answer is the site as it now is.
## What to send
`SiteCreate`
- `hostnames` (list of string or null): Left out, the name is the one hostname.
- `name` (string, needed): Usually the domain: `eza.rocks`.
- `settings` (object or null)
- `time_zone` (string or null): An IANA name. Left out, `UTC`.
## The answer
201, `SiteView`
- `created_at` (string, needed)
- `declared` (boolean, needed): Declared in the instance's configuration: read-only here, pausable.
- `hostnames` (list of string, needed): Hostnames allowed to send hits for this site.
- `id` (string, needed)
- `mode` (string, needed): `easy` or `hard`.
- `name` (string, needed): The name the tag carries (`data-site`).
- `paused` (boolean, needed)
- `reading` (string, needed): `strict` or `cnil`.
- `settings` (object, needed)
- `time_zone` (string, needed)
## Asking
```sh
curl -X POST https://tidekeeper.eu/api/v1/sites \
-H "Authorization: Bearer $TIDEKEEPER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "shop.example.org"}'
```
What to send
SiteCreate
- hostnames
- list of string or nullLeft out, the name is the one hostname.
- name
- stringneededUsually the domain: `eza.rocks`.
- settings
- object or null
- time_zone
- string or nullAn IANA name. Left out, `UTC`.
The answer
Status 201
SiteView
- created_at
- stringneeded
- declared
- booleanneededDeclared in the instance's configuration: read-only here, pausable.
- hostnames
- list of stringneededHostnames allowed to send hits for this site.
- id
- stringneeded
- mode
- stringneeded`easy` or `hard`.
- name
- stringneededThe name the tag carries (`data-site`).
- paused
- booleanneeded
- reading
- stringneeded`strict` or `cnil`.
- settings
- objectneeded
- time_zone
- stringneeded
Asking
curl -X POST https://tidekeeper.eu/api/v1/sites \ -H "Authorization: Bearer $TIDEKEEPER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "shop.example.org"}'
const answer = await fetch("https://tidekeeper.eu/api/v1/sites", { method: "POST", headers: { Authorization: `Bearer ${process.env.TIDEKEEPER_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({"name": "shop.example.org"}), }).then((r) => r.json());