Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt

Use this file to discover all available pages before exploring further.

Inspect and update your org’s spend cap, credit alert thresholds, and Opus model access. Both endpoints require the control:read scope.

Get budget settings

GET https://api.usehasp.com/v1/usage/budget
Authorization: Bearer wa_live_...

Response

{
  "success": true,
  "data": {
    "spend_cap": 50000,
    "alert_thresholds": [75, 90],
    "credits_allotment": 100000,
    "opus_enabled": false
  }
}

Fields

FieldDescription
spend_capCredit cap for this billing cycle. Requests return 402 AI_CREDITS_EXHAUSTED when credits used reaches this value. null means no cap (full allotment applies).
alert_thresholdsSorted list of percentage integers (1–99) at which usage notifications are sent. Empty array means no alerts configured. Max 3 thresholds.
credits_allotmentTotal credits available this cycle (read-only — set by your plan).
opus_enabledWhether the Opus model is enabled for this org. When false, requests using claude-opus-4-7 return 403 OPUS_NOT_ENABLED.

Update budget settings

PUT https://api.usehasp.com/v1/usage/budget
Authorization: Bearer wa_live_...
Content-Type: application/json
All fields are optional. Send only what you want to change. An empty body returns the current state without modifying anything.

Body

{
  "spend_cap": 50000,
  "alert_thresholds": [75, 90],
  "opus_enabled": false
}
FieldTypeDescription
spend_capinteger or nullCredit cap. Min 0. Set null to remove the cap.
alert_thresholdsarray or nullPercentage integers, each 1–99. Max 3 entries. Sorted automatically. Set [] or null to clear.
opus_enabledbooleantrue to enable Opus model access; false to disable.

Response

Returns the updated budget state in the same shape as the GET response.
{
  "success": true,
  "data": {
    "spend_cap": 50000,
    "alert_thresholds": [75, 90],
    "credits_allotment": 100000,
    "opus_enabled": false
  }
}
Every successful update is recorded in the audit log with action: budget.updated.

Error codes

CodeHTTPDescription
INVALID_API_KEY401Invalid or revoked token
MISSING_SCOPE403Key lacks control:read scope
VALIDATION_FAILED422spend_cap is negative; threshold out of 1–99 range; more than 3 thresholds