This guide assumes you already have a Token with at least the
moments.read and moments.write scopes. If you don't, head to
Authentication first.
cURL
| 1 | curl -X POST https://api.webmoment.app/v1/moments \ |
| 2 | -H "Authorization: Bearer $WEBMOMENT_TOKEN" \ |
| 3 | -H "Content-Type: application/json" \ |
| 4 | -d '{ |
| 5 | "url": "https://ac.me", |
| 6 | "viewport": "desktop" |
| 7 | }' |
| 8 | |
The response is a freshly created Moment with status: "INITIAL"
(Capture is queued). Its Location header identifies the Moment resource.
Poll GET /v1/moments/{id} until status becomes COMPLETE, PARTIAL, or
FAILED.
JavaScript (fetch)
| 1 | const response = await fetch("https://api.webmoment.app/v1/moments", { |
| 2 | method: "POST", |
| 3 | headers: { |
| 4 | Authorization: `Bearer ${process.env.WEBMOMENT_TOKEN}`, |
| 5 | "Content-Type": "application/json", |
| 6 | }, |
| 7 | body: JSON.stringify({ |
| 8 | url: "https://ac.me", |
| 9 | viewport: "desktop", |
| 10 | scheduleFrequency: "daily", |
| 11 | scheduleEnabled: true, |
| 12 | }), |
| 13 | }); |
| 14 | const moment = await response.json(); |
| 15 | console.log(moment); |
| 16 | |
Python (httpx)
| 1 | import httpx, os |
| 2 | |
| 3 | response = httpx.post( |
| 4 | "https://api.webmoment.app/v1/moments", |
| 5 | headers={ |
| 6 | "Authorization": f"Bearer {os.environ['WEBMOMENT_TOKEN']}", |
| 7 | "Content-Type": "application/json", |
| 8 | }, |
| 9 | json={ |
| 10 | "url": "https://ac.me", |
| 11 | "viewport": "desktop", |
| 12 | }, |
| 13 | ) |
| 14 | response.raise_for_status() |
| 15 | print(response.json()) |
| 16 | |
Listening for completion
Captures are async. Subscribe to moment.completed when a Moment is
ready to use, or moment.failed when WebMoment cannot preserve it.
Use moment.updated if you also need screenshot URLs as soon as they
are available. See Webhooks for the signing protocol
and full event catalog.
Use viewport: "responsive" to preserve Desktop and Mobile in one Moment, or
viewport: "fullresponsive" to preserve Desktop, Tablet and Mobile. Both
create one Moment; read completed artifact URLs from the screenshots object.
To wait up to 60 seconds for primary Screenshots, add Prefer: wait=15 to the
create request. This wait never includes Replay; use moment.completed for
Replay completion.
Listing the workspace's history
| 1 | curl -G https://api.webmoment.app/v1/moments \ |
| 2 | -H "Authorization: Bearer $WEBMOMENT_TOKEN" \ |
| 3 | --data-urlencode "page=1" \ |
| 4 | --data-urlencode "pageSize=50" |
| 5 | |
See Moments for the full request and response shape.

