Skip to content

API Reference

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

Base URL

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

For local development:

http://localhost:8000/api/v1

Authentication

Most API endpoints require authentication using JWT Bearer tokens.

curl -H "Authorization: Bearer <your-token>" \
     https://api.ospobox.io/api/v1/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/v1/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.

Portfolio

Method Endpoint Description
GET /portfolio Units with participation, volume and cost
GET /portfolio/ai-contribution Share of commits crediting an agent
GET /portfolio/views The role compositions this instance ships

Every unit has a basis field stating what its figures counted. Cost appears only where cost inputs are configured, and only against a unit: it is never returned for one person. See See where the effort goes.

Projects

Method Endpoint Description
GET /projects Projects in the account
POST /projects Create one
POST /projects/{id}/repositories Assign repositories to it

A repository belongs to at most one project, so assigning it removes it from any other.

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 on a commit.

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
PATCH /alerts/acknowledge-all Acknowledge every open alert in one call
DELETE /alerts/{id} Delete

Webhooks

Method Endpoint Description
GET /webhooks/ List endpoints
POST /webhooks/ Create one. The response includes the signing secret, once; see Webhooks
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.

Billing

These three endpoints exist only where an operator sells subscriptions. Without a Stripe key they answer 404, which says that a self-hosted instance has no billing surface to probe.

Method Endpoint Description
POST /billing/checkout/{tier} Open a hosted Stripe checkout page for a tier
GET /billing/plan The account's tier, subscription status and usage against each limit
POST /billing/webhook Stripe subscription events, authenticated by signature alone

A request a plan does not cover is answered 402. See Subscriptions and quotas for the limits and the switch.

Health

These sit outside the /api prefix and need no authentication:

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 until the first caller depends on it and a problem from then on.

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/v1",
    headers={"Authorization": f"Bearer {token}"}
)

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