Haijun Enterprise Admin API reference guide
This guide covers spend limits and spend limit increase requests for your Haijun Enterprise organization using the Haijun Enterprise Admin API. Spend limits let you cap each member's usage credit spending over a recurring period, see where each member's limit is inherited from, and review or act on members' requests for a higher limit. For per-user and time-bucketed usage and cost reporting, see the Analytics API reference guide. Haijun Enterprise Admin API is currently in public beta and available to organizations on Enterprise plans with usage credits enabled.
Overview
There are eight endpoints across two resources:
| Resource | Endpoints | Use for | | Spend limits | GET /v1/organizations/spend_limits/effectiveGET /v1/organizations/spend_limits/{spend_limit_id}POST /v1/organizations/spend_limitsDELETE /v1/organizations/spend_limits/{spend_limit_id} | Read each member's effective limit and period-to-date spend; set or clear a per-user override. | | Spend limit increase requests | GET /v1/organizations/spend_limit_increase_requestsGET /v1/organizations/spend_limit_increase_requests/{id}POST /v1/organizations/spend_limit_increase_requests/{id}/approvePOST /v1/organizations/spend_limit_increase_requests/{id}/deny | List members' requests for a higher limit, with the context needed to decide; approve or deny each request. |
Use the spend limits endpoints to answer, “What limit applies to each member, where does it come from, and how close are they to it?" and to set a per-user override. Use the spend limit increase requests endpoints to work the queue of member-submitted requests.
Prerequisites and authentication
Your organization must be on a Haijun Enterprise plan.
Usage credits must be enabled for your organization. Your Primary Owner can enable this under Billing settings in Haijun.
The Primary Owner needs to mint an Admin API key with one or both of the following scopes:
read:spend_limits (required for all GET endpoints)
write:spend_limits (required for POST and DELETE endpoints)
Pass the key in the x-api-key header on every request. Important: Don't share API keys publicly or check them into source control.
Create an Admin API key for your Haijun Enterprise organization
Sign in as the Primary Owner—Only the Primary Owner of your Haijun Enterprise parent organization can create these keys.
Open API settings—Go to Organization settings > API and find the Keys section.
Click and create key—Name the key and select the scopes you need from the scopes table. You can combine scopes from different APIs (for example, read:analytics and read:spend_limits) on a single key.
Copy and store the secret—Copy the displayed secret (starting with sk-ant-api01-) and store it in your secrets manager. The full secret is shown only once.
Base URL
##
##
##
##
| | | | | | | | | | | | | | | | | | | | |
##
###
###
| | | | | | | | | | | | | | | | | | | |
###
###
###
| | | | | | | | | | | |
##
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
##
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
##
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
###
| | | | | | | | | | | | | | | | | | | | | | | |
##
###
####
| | | | | | | | | | | | | | | | | | | | | | | |
####
| | | | | | | | | | | |
####
####
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
###
####
| | | | | | | |
####
####
####
| | | | | | | | | | | | | | | |
###
####
| | | | | | | | | | | | | | | | | | | |
####
####
####
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
###
####
| | | | | | | |
####
####
####
####
| | | | | | | | | | | | | | | | | | | |
##
###
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
####
| | | | | | | | | | | |
####
####
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
###
####
| | | | | | | |
####
####
####
| | | | | | | | | | | | | | | | | | | |
###
####
| | | | | | | |
####
| | | | | | | | | | | | | | | | | | | | | | | |
####
####
####
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
###
####
| | | | | | | |
####
| | | | | | | | | | | |
####
####
####
| | | | | | | | | | | | | | | | | | | | | | | | | | | |
