- API reference
- Introduction
- Specly API
Specly API
Start a deploy from CI, or read a site's analytics, with an organization API key.
The Specly API has two calls. You can start a deploy of a site, and read its analytics. Both use an organization API key, so CI and scripts can call them without a person’s login.
The server is https://app.specly.xyz.
Make a key
Section titled “Make a key”Open Settings › Organization › API keys in the dashboard. Only an admin of the organization can make or see keys.
- Give the key a name, such as the pipeline that uses it.
- Choose what it may do. Each choice is a scope.
- Choose where it works: every site in the organization, or only the sites you pick.
- Select Create key, and copy the key. Specly shows it once.
A key belongs to the organization, not to a person, so it keeps working when people leave. Revoke it on the same page.
deployscopeStart a deploy:
POST /api/sites/{id}/deploy.
analytics:readscopeRead analytics:
GET /api/sites/{id}/analytics.
Call the API
Section titled “Call the API”Send the key as a bearer token. Every key starts with spk_org_. {id} is the site’s ID, which is in its address in the
dashboard.
curl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ https://app.specly.xyz/api/sites/{id}/deploycurl -H "Authorization: Bearer YOUR_API_KEY" \ "https://app.specly.xyz/api/sites/{id}/analytics?days=30"Answers are JSON. A deploy answers 202 with the build it started.
Errors
Section titled “Errors”401statusThe key is missing, malformed, unknown or revoked. The answer has a
WWW-Authenticate: Bearerheader.
403statusThe key can’t be used on this site, or doesn’t have the scope the call needs.
429statusToo many requests. Wait a minute. A key may start 10 deploys and make 60 analytics calls a minute.
Each error has an error field that says what went wrong. The pages in this tab show every call’s fields and answers.
There’s no Send button, because the API doesn’t accept calls from a browser page. Use curl.