Skip to main content

API Overview

The CICosts API allows you to programmatically access your CI/CD cost data. Use it to build custom dashboards, automate reporting, and integrate with your existing tools.

Base URL

https://api.cicosts.dev/api/v1

For development:

https://dev-api.cicosts.dev/api/v1

API Availability

PlanAccess Level
FreeDashboard API (read-only), 3 repos
ProFull API access, unlimited repos
TeamFull access + higher rate limits

Authentication

The API uses JWT tokens obtained through GitHub OAuth. All requests require a valid access token:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.cicosts.dev/api/v1/auth/me

See Authentication for details on obtaining tokens.

Response Format

All responses are JSON:

{
"total_cost": 247.50,
"trend_percent": -5.2,
"total_runs": 1247,
"avg_cost_per_run": 0.198
}

Error Responses

Errors include a detail message:

{
"detail": "Organization not found"
}

HTTP status codes:

  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (missing/invalid token)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found
  • 429 - Rate Limited
  • 500 - Server Error

Rate Limits

Rate limits are applied per user per minute:

PlanRequests/Minute
Free60
Pro300
Team600

Rate limit headers are included in responses:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1705320060

Available Endpoints

Authentication

EndpointMethodDescription
/auth/loginGETInitiate GitHub OAuth
/auth/callbackGETOAuth callback handler
/auth/meGETGet current user
/auth/refreshPOSTRefresh access token
/auth/logoutPOSTInvalidate token

Dashboard

EndpointMethodDescription
/dashboard/summaryGETCost summary for org
/dashboard/trendsGETCost trends over time
/dashboard/top-workflowsGETMost expensive workflows
/dashboard/recent-runsGETRecent workflow runs
/dashboard/workflowsGETList all workflows
/dashboard/workflows/summaryGETWorkflow statistics

Alerts

EndpointMethodDescription
/alertsGETList all alerts
/alertsPOSTCreate new alert
/alerts/{id}GETGet alert details
/alerts/{id}PUTUpdate alert
/alerts/{id}DELETEDelete alert
/alerts/{id}/triggersGETGet trigger history
/alerts/{id}/checkPOSTManually check alert

Settings

EndpointMethodDescription
/settings/userGETGet user settings
/settings/userPATCHUpdate user settings
/settings/notificationsGETGet notification prefs
/settings/notificationsPATCHUpdate notification prefs
/settings/organizationsGETList organizations
/settings/organizations/{id}/leavePOSTLeave organization
/settings/accountDELETEDelete account

Billing

EndpointMethodDescription
/billing/subscriptionGETGet subscription status
/billing/checkoutPOSTCreate checkout session
/billing/portalPOSTCreate billing portal

Limits

EndpointMethodDescription
/limits/usageGETCurrent usage vs limits
/limits/planGETPlan limits
/limits/upgrade-suggestionGETUpgrade recommendations

Query Parameters

Most GET endpoints accept common query parameters:

ParameterTypeDescription
org_idUUIDOrganization ID (required for most endpoints)
daysintTime range in days (default: 30, max based on plan)
limitintResults per page (default: 10)

Example:

curl -H "Authorization: Bearer $TOKEN" \
"https://api.cicosts.dev/api/v1/dashboard/summary?org_id=uuid&days=30"

Quick Start

1. Authenticate

Login via GitHub to get your access token:

# Opens browser for GitHub OAuth
open https://app.cicosts.dev/login

2. Get Your Organization ID

curl -H "Authorization: Bearer $TOKEN" \
https://api.cicosts.dev/api/v1/auth/me

Response:

{
"id": "user-uuid",
"email": "you@example.com",
"organizations": [
{
"id": "org-uuid",
"github_org_slug": "your-org",
"role": "owner"
}
]
}

3. Fetch Cost Data

curl -H "Authorization: Bearer $TOKEN" \
"https://api.cicosts.dev/api/v1/dashboard/summary?org_id=org-uuid"

Response:

{
"total_cost": 247.50,
"trend_percent": -5.2,
"total_runs": 1247,
"avg_cost_per_run": 0.198,
"period_days": 30
}

Runner Pricing Reference

CICosts uses these rates for cost calculation:

RunnerOSPrice/Minute
ubuntu-latestLinux (2-core)$0.008
ubuntu-latest-4-coresLinux (4-core)$0.016
ubuntu-latest-8-coresLinux (8-core)$0.032
ubuntu-latest-16-coresLinux (16-core)$0.064
ubuntu-latest-armLinux ARM (2-core)$0.005
windows-latestWindows (2-core)$0.016
macos-latestmacOS (3/4-core)$0.080
macos-latest-largemacOS (12-core)$0.120

Plan Limits

Data history is limited by plan:

PlanHistory DaysMax Repos
Free303
Pro365Unlimited
Team365Unlimited

Requests for data beyond your plan's limit will be capped automatically.

Best Practices

Cache Responses

Cost data is updated in near real-time as workflows complete:

  • Cache summary data for 1-5 minutes
  • Cache historical data for longer periods

Handle Rate Limits

async function fetchWithRetry(url, options, retries = 3) {
const response = await fetch(url, options);

if (response.status === 429 && retries > 0) {
const resetTime = response.headers.get('X-RateLimit-Reset');
const waitMs = (resetTime * 1000) - Date.now() + 1000;
await new Promise(r => setTimeout(r, waitMs));
return fetchWithRetry(url, options, retries - 1);
}

return response;
}

Next: Authentication