API Overview
Pakyas provides a RESTful HTTP API for all operations.
Base URLs
Section titled “Base URLs”| Environment | URL |
|---|---|
| Production | https://api.pakyas.com/api/v1 |
| Ping Endpoint | https://ping.pakyas.com |
Authentication
Section titled “Authentication”API Keys
Section titled “API Keys”Generate an API key from your organization settings (Settings > API Keys), or with pakyas api-key create. Include it in requests:
curl -H "Authorization: Bearer pk_live_xxx" \ "https://api.pakyas.com/api/v1/checks?org_id=<ORG_ID>"A key belongs to one organization and can only access that organization.
Scopes
Section titled “Scopes”| Scope | Allows |
|---|---|
read | View checks, pings, projects and the organization |
write | read, plus create, update, pause and delete checks and projects, and manage phone destinations. Also needed to create or revoke API keys |
manage | write, plus Owner/Admin operations: organization settings, members, deleting the organization, and quota usage |
A key never does more than the user who created it: Admin- and Owner-level operations also need that user to hold the role. A key made by an Admin can’t promote anyone to Owner or delete the organization, and a key whose creator has left the organization can’t do Admin- or Owner-level operations at all.
API keys can’t create organizations. Sign in to the web app to create one.
Project access
Section titled “Project access”A key has access to All projects, or to Selected projects only (chosen when you create it in Settings > API Keys). A key limited to selected projects:
- Lists only its projects and their checks, and only its own organization.
- Gets
404 Not Foundfor any project, check or ping outside its projects, the same response as for one that doesn’t exist. Creating a check in another project is also a 404. - Can’t do organization-wide operations: organization settings and members, API keys, phone destinations, quota, or creating projects. These return
403 Forbidden.
Use selected-project keys for CI jobs and servers that only report on, or manage, a few projects.
Creating keys with a key
Section titled “Creating keys with a key”POST /api/v1/api-keys made with an API key can only create a key that:
- has scopes the calling key holds,
- expires no later than the calling key (if the calling key expires, the new key must too),
- belongs to the same organization.
Keys limited to selected projects can’t create or revoke keys. project_access must be all or selected, and selected needs at least one project from the organization in allowed_project_ids.
JWT Tokens
Section titled “JWT Tokens”For browser/CLI authentication, use JWT tokens obtained via login.
Endpoints
Section titled “Endpoints”Ping API
Section titled “Ping API”Ping URLs are on https://ping.pakyas.com and need no API key.
| Method | Endpoint | Description |
|---|---|---|
| GET/POST | /{public_id} | Success ping |
| GET/POST | /{public_id}/start | Start ping |
| GET/POST | /{public_id}/fail | Fail ping |
| GET/POST | /{public_id}/{exit_code} | Ping with exit code |
Management API
Section titled “Management API”| Method | Endpoint | Description |
|---|---|---|
| GET | /checks | List checks |
| POST | /checks | Create check |
| GET | /checks/{id} | Get check |
| PUT | /checks/{id} | Update check |
| DELETE | /checks/{id} | Delete check |
See individual endpoint pages for details.
Rate Limits
Section titled “Rate Limits”- Ping API: 3,000 pings per minute from one IP address, and 500 per minute from one IP address to one check. Over the limit, pings get
429 Too Many RequestswithX-RateLimit-Limit,X-RateLimit-RemainingandX-RateLimit-Resetheaders. - Management API: if you get
429 Too Many Requests, wait and retry.
Error Handling
Section titled “Error Handling”Errors return JSON with an error field:
{ "error": "Check not found"}| Status | Meaning |
|---|---|
| 400 | Invalid request (for example, an out-of-range threshold or an invalid project_access) |
| 401 | Missing, invalid, expired or revoked API key |
| 403 | The key’s scopes, the key’s project access, or the user’s role don’t allow the operation |
| 404 | Not found, or outside the projects a restricted key may access |
| 409 | Conflict, such as a project slug already used in the organization (on create and update) |
| 429 | Rate limited |
Next Steps
Section titled “Next Steps”- Ping Endpoint - Sending pings via HTTP
- Check Endpoints - Managing checks via API