aboutsummaryrefslogtreecommitdiffstats
path: root/pages.sr.ht/api.md
blob: b7e6d0e09260a02d575c5ed8a56a6d991ce53ae4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
title: pages.sr.ht API reference
---

The pages.sr.ht API is a convenience wrapper around the [GraphQL API][0] and
allows one to easily publish a site with tools like `curl`.

# API endpoints

The following endpoints are available to users with an OAuth2 token valid for
the specified scope.

## POST /publish/:domain

**Scopes**: `PAGES:RW`

Publish a site.

The request body must use the `multipart/form-data` content type. The following
fields are supported:

- `content` (required): a .tar.gz file containing the new site content.
- `protocol`: select which protocol variant of the site to update. If unset,
  defaults to HTTPS.

A sub-directory can be appended to the URL (e.g. `/publish/example.org/subdir`)
in which case only the specified sub-directory is updated. The rest of the
files are left unchanged.

The response contains the new site version as plain-text.

[0]: https://srht.site/graphql