Semaphore API
This document describes all the resources that make up Semaphore API version v1alpha
. If you have any problems or requests please contact support.
The root of the API can be found here: https://<org_name>.semaphoreci.com/api/v1alpha
.
Overview
Every API request and response must satisfy the following constraints:
- All requests must use HTTPS.
- All data is sent and received as JSON.
- Blank fields are included as
null
instead of being omitted. - Timestamps are in different formats due to the historical circumstances of how these public APIs appeared. In the next release of the API, they will be standardized. Currently, there are the following formats:
- Unixtime Epoch time:
"create_time": "1571083003"
- Unixtime Epoch time with nanoseconds:
"created_at": {"seconds": 1571063401, "nanos": 559492000}
- Custom format:
YYYY-MM-DD HH:MM:SS.ffffffZ
, e.g.,"2019-10-14 12:11:47.824128Z"
- All API requests must set the User-Agent to
SemaphoreCI v2.0 Client
.
- Unixtime Epoch time:
Authentication
All API requests require authentication. To authenticate, you need an API Token. You can find your token by visiting your account settings.
Your API Token must be sent as an HTTP header in all requests, as shown below:
curl -H "Authorization: Token {api_token}" "https://<org_name>.semaphoreci.com/api/v1alpha/{resource_name}"
Errors
You can receive several errors as a response to an API request
Error Message | Meaning |
---|---|
HTTP/1.1 401 Unauthorized | Failure to authenticate |
HTTP/1.1 404 Not Found | Resource doesn't exist or is not visible to user |
Pagination
Every request that that returns more than 30 items will be paginated. To avoid this, you should form calls with link
header values instead of constructing your own URLs.
A link
header includes information about pagination, as shown below:
link: <http://<org_name>.semaphoreci.com/api/v1alpha/?PAGE_PARAMS>; rel="first",
<http://<org_name>.semaphoreci.com/api/orgs?PAGE_PARAMS>; rel="next"
The possible rel
values are:
- next - The link for the next page of results.
- prev - The link for the previous page of results.
- first - The link for the first page of results.
Stability
There are two types of changes:
- Compatible and emergency changes may be made with no advanced notice
- Disruptive changes will not occur without advanced notice. In the event that a disruptive change is needed, a new major version will be developed
- Emergency changes happen without notice. We will, however, try to notify users as best as possible