Skip to content

API Reference

Ospobox provides a REST API for programmatic access to all features.

Base URL

https://your-ospobox-instance.com/api

For local development:

http://localhost:8000/api

Authentication

Most API endpoints require authentication using JWT Bearer tokens.

curl -H "Authorization: Bearer <your-token>" \
     https://api.ospobox.io/api/organizations/

See Authentication for details on obtaining tokens.

Response Format

All responses are JSON. Successful responses return data directly:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "my-organization",
  "platform": "github"
}

Error responses include an error message:

{
  "detail": "Organization not found"
}

HTTP Status Codes

Code Description
200 Success
201 Created
204 No Content
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
429 Too Many Requests
500 Internal Server Error

Rate Limiting

API requests are rate limited to prevent abuse:

Endpoint Type Limit
Authentication 10 requests/minute
Read operations 120 requests/minute
Write operations 30 requests/minute

Rate limit headers are included in responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1640000000

API Endpoints

Paths below are relative to the base URL, so /auth/login is /api/auth/login. The web application's own forms live at /auth/* without the prefix and are CSRF-protected. They are a different surface, outside this API.

Authentication

Method Endpoint Description
POST /auth/login Login with email/password
POST /auth/register Register new account
POST /auth/refresh Refresh access token

Organizations

Method Endpoint Description
GET /organizations/ List monitored organizations
POST /organizations/ Add an organization
GET /organizations/{id} Organization details
DELETE /organizations/{id} Stop monitoring it
POST /organizations/{id}/sync Queue a sync
GET /organizations/{id}/repositories Its repositories

Repositories

Method Endpoint Description
GET /repositories/{id} Repository details, including health score
GET /repositories/{id}/stats Activity counts for the repository

Repositories are reached through the organization that owns them; there is no account-wide list endpoint.

Activity

Method Endpoint Description
GET /activity/summary Counts across a period
GET /activity/commits List commits
GET /activity/pull-requests List pull requests
GET /activity/issues List issues
GET /activity/releases List releases

Time filters (since, until) apply to when work landed. See Activity for the two timestamps a commit carries.

Alerts

Method Endpoint Description
GET /alerts/ List alerts, with severity and unread filters
GET /alerts/{id} One alert
PATCH /alerts/{id}/read Mark read
PATCH /alerts/{id}/acknowledge Acknowledge: frees the slot for a recurrence
PATCH /alerts/read-all Mark everything read
DELETE /alerts/{id} Delete

Webhooks

Method Endpoint Description
GET /webhooks/ List endpoints
POST /webhooks/ Create one; the secret is returned once
GET /webhooks/{id} Endpoint details
PUT /webhooks/{id} Update
DELETE /webhooks/{id} Delete
POST /webhooks/{id}/test Send a test event
GET /webhooks/{id}/deliveries Delivery history

See Webhooks for payloads, signatures and retries.

OAuth

Method Endpoint Description
GET /oauth/{platform}/start Begin a connection flow
GET /oauth/{platform}/callback Provider callback

GitHub and GitLab only.

Health

Outside the /api prefix, and unauthenticated:

Method Endpoint Description
GET /health Health check
GET /health/metrics Prometheus-compatible metrics

Planned

An /api/v1/ prefix. The API is unversioned today, which is fine while nobody depends on it and a problem the moment somebody does.

OpenAPI Documentation

Interactive API documentation is available at:

  • Swagger UI: /docs
  • OpenAPI Schema: /schema

SDK Support

Currently, Ospobox does not provide official SDKs. You can use any HTTP client:

import httpx

client = httpx.Client(
    base_url="http://localhost:8000/api",
    headers={"Authorization": f"Bearer {token}"}
)

orgs = client.get("/organizations/").json()
const response = await fetch('http://localhost:8000/api/organizations/', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});
const orgs = await response.json();
curl -H "Authorization: Bearer $TOKEN" \
     http://localhost:8000/api/organizations/