Admin API
What is the admin API?
The admin API lets you do everything you can do in the AIProxy dashboard from a script, a CI job, or an agent: create apps and services of every type, submit provider keys, add endpoints, configure rate limits, model overrides, alerts, bans, DeviceCheck and App Attest, flip remote config flags, and read your traffic back (requests, logs, token usage, latency, errors).
This page is the reference for configuration. Reading traffic and usage is on Admin API: analytics, and the loop an agent runs with both is on Operating an app with an agent. If you are using Claude Code or Codex, the MCP server exposes the same operations as tools, with no scripting.
All requests go to:
https://dashboard.aiproxy.com/api/v1
Requests and responses are JSON. Request bodies use top-level keys (there is no wrapping object), and every response is either a single object or an array of objects.
Authentication
Every request must carry your admin API key in the Authorization header as a bearer token. Generate your key on the account page of the dashboard. It is shown once, when you generate it; we store only a hash of it, so copy it then. Afterwards the account page shows the last five characters so you can tell which key is active.
curl https://dashboard.aiproxy.com/api/v1/projects \
-H "Authorization: Bearer $AIPROXY_ADMIN_KEY"
POST /account/rotate_admin_api_key. The old key stops working immediately. If you lose it, rotate it: there is no way to retrieve an existing key.A missing or invalid key returns 401.
The read-only key
The account page also issues a read-only API key. It is sent the same way and reads everything the admin key reads: projects, services, configuration, request history, logs, and analytics. It cannot change anything: every POST, PATCH, PUT, and DELETE returns 403 with "details": {"api_key_scope": ["readonly"]}, and it cannot download a DeviceCheck .p8 file. Give it to agents, dashboards, and CI jobs that watch your app; keep the admin key for the ones that change it. GET /account reports which kind of key made the request in api_key_scope.
# Issue or replace the read-only key (needs the admin key; the new key is returned once)
curl -s -X POST "$API/account/rotate_readonly_api_key" -H "$AUTH"
# => {"readonly_api_key": "…"}
Quick start
The following creates an app, adds an OpenAI service to it, and submits a provider key. The response to the last call contains the partial_key and service_url that you drop into your app, exactly as the dashboard would show them.
export AIPROXY_ADMIN_KEY="your-admin-api-key"
export API="https://dashboard.aiproxy.com/api/v1"
export AUTH="Authorization: Bearer $AIPROXY_ADMIN_KEY"
# 1. Create an app
curl -s "$API/projects" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"name": "My app"}'
# => {"uuid":"4f865a6d","name":"My app", ...}
# 2. Add a service to it
curl -s "$API/projects/4f865a6d/services" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"proxy_domain": "api.openai.com"}'
# => {"api_uuid":"e88e2881","proxy_domain":"api.openai.com","service_url":"https://api.aiproxy.com/4f865a6d/e88e2881", ...}
# 3. Submit your OpenAI key. Copy `partial_key` from the response now, it is not returned again.
curl -s "$API/projects/4f865a6d/services/e88e2881/keys" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"name": "Production", "provider_key": "sk-..."}'
# => {"id":42,"name":"Production","partial_key":"v2|1a2b3c4d|...","service_url":"https://api.aiproxy.com/4f865a6d/e88e2881", ...}
Conventions
Identifiers
- Apps are addressed by their
uuid(the short id in dashboard URLs). - Services are addressed by their
api_uuid(the last segment of the service URL). - Keys, endpoints, rate limits, overrides and alerts are addressed by their numeric
id. - Bans are addressed by their kind and value, e.g.
/bans/ip_address/203.0.113.9.
Responses
- Creates return
201with the created object. Updates return200with the updated object. - Deletes return
204with no body. - Timestamps are ISO 8601 in UTC.
- Update requests are partial: only the fields you send are changed.
Errors
Errors have an error message. Validation failures also carry details, keyed by field:
{
"error": "Proxy domain can't be blank",
"details": { "proxy_domain": ["can't be blank"] }
}
| Status | Meaning |
|---|---|
400 | A required field is missing. |
401 | The API key is missing or invalid. |
403 | The key is read-only and the request would change something (or download a private key). |
404 | The record does not exist, or does not belong to your account. |
409 | The record already exists (DeviceCheck and App Attest are configured once per app). |
422 | Validation failed. See details. |
Account
Your email, plan, monthly request quota and requests so far this month.
{
"uuid": "…",
"email": "[email protected]",
"email_verified": true,
"api_key_scope": "admin",
"admin_api_key_last5": "3f2a1",
"readonly_api_key_last5": "9c0d2",
"plan": "pro",
"promo": null,
"request_quota": 100000,
"requests_this_month": 12345,
"created_at": "2025-01-01T00:00:00.000Z"
}
Replaces your admin API key. Responds with {"admin_api_key": "…"}, the only time the new key is returned. The key used to make this request stops working immediately.
Issues or replaces the read-only key. Responds with {"readonly_api_key": "…"}, returned once. Needs the admin key. The account object carries readonly_api_key_last5 and api_key_scope (admin or readonly, the key that made the request).
Apps
Apps use the /projects resource in the API; existing endpoints and field names remain unchanged.
| Field | Description |
|---|---|
name | Required. The app name. |
uuid | Read only. The app identifier used in URLs. |
device_check_configured | Read only. Whether the app has a complete DeviceCheck configuration. |
usage | Read only, on GET /projects/:uuid only. requests_this_month and requests_total. |
Services
A service is one thing your app talks to through AIProxy. Its type is fixed at creation and decides which fields apply and what the service URL does. These are the same settings as the service Settings page in the dashboard.
service_type | What it does |
|---|---|
proxy | Default. A reverse proxy to a provider host such as api.openai.com. Uses partial keys, endpoints, and model overrides. |
foundation_models_router | For apps on the AIProxy Foundation Models package (iOS 27+). The app sends one provider-neutral request; you pick the provider and model here and can change them without an app update. Authenticated with App Attest. |
remote_config | Named on/off flags your app reads from the service URL. Flip them here; the app sees the change on its next fetch. |
otel_log_ingest | Receives OpenTelemetry (OTLP/HTTP JSON) logs from your app at <service URL>/v1/logs and keeps them for 30 days. Read them back with the logs endpoint. |
| Field | Description |
|---|---|
service_type | Create only. One of the types above. Defaults to proxy. |
proxy_domain | Required for proxy services, ignored otherwise. The provider's host, e.g. api.openai.com. A scheme and trailing slash are stripped. |
proxy_all_paths | Proxy services. Default true. When false, only paths added as endpoints are proxied. |
protect_endpoints_with_device_check | Proxy services. Default false. Requests must carry a DeviceCheck token; see DeviceCheck. The app's configuration can be added before or after turning this on. |
protect_endpoints_with_app_attest | Default true for routers and log ingest, false for proxies, and not available on remote config (flag values are public data; sending true returns 422). Requests must carry an App Attest assertion; see App Attest. Without an app configuration the service answers 403 naming the missing setup. |
api_key_override | Proxy services, write only. A provider key to use for every request, bypassing partial keys (see API key override). Send null or "" to clear it. Responses only include api_key_override_set. |
generation_destination | Routers. {"provider", "model", "api_key"}. Required on create; on update, send the fields to change (a missing api_key keeps the stored key). Responses show provider, model, api_key_last4, updated_at. Provider keys are encrypted with AWS KMS and only decrypted inside the proxy. |
remote_config_flags | Read only, remote config services. The current flags as {"name": true}. Change them with the remote config endpoint. |
api_uuid | Read only. The service identifier used in URLs. |
name | Read only. A display name: inferred from the domain for proxies (e.g. "OpenAI"), the type label otherwise. |
service_url | Read only. The service URL your app uses: https://api.aiproxy.com/<app>/<service>. Every AIProxy package takes exactly this one value. |
New services get the same defaults as services created in the dashboard: two global rate limits (1000 requests per user and per IP, per hour) and two alerts (10 consecutive bad provider responses, 10 consecutive DeviceCheck failures).
# A proxy to OpenAI
curl -s "$API/projects/4f865a6d/services" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"proxy_domain": "api.openai.com"}'
# A Foundation Models router pointed at Claude; change provider or model later without an app update
curl -s "$API/projects/4f865a6d/services" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"service_type": "foundation_models_router",
"generation_destination": {"provider": "anthropic", "model": "claude-sonnet-5", "api_key": "sk-ant-..."}}'
curl -s "$API/projects/4f865a6d/services/c27411bd" -H "$AUTH" -X PATCH -H "Content-Type: application/json" \
-d '{"generation_destination": {"model": "claude-haiku-4-5"}}'
# A remote config service and an OpenTelemetry log ingest service
curl -s "$API/projects/4f865a6d/services" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"service_type": "remote_config"}'
curl -s "$API/projects/4f865a6d/services" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"service_type": "otel_log_ingest", "protect_endpoints_with_app_attest": true}'
Providers for generation_destination.provider: anthropic (complete), openai and gemini (accepted by the dashboard; the proxy answers 501 until their translators ship).
Remote config
The flags of a remote_config service. Flag values are public data: anyone with the service URL can read them, so treat them like strings shipped in your binary and keep secrets behind a proxy or router. In return the first fetch is one fast unauthenticated request, safe for boot-time decisions, and you can test with curl. Your app reads resolved values from <service_url>/v1/config (or with the AIProxyRemoteConfig package) and gets {"flags": {"use_aiproxy": true, "paywall": "annual_first", "max_free_messages": 10}}: one value per flag, already evaluated for that device. A change here is live on the app's next fetch, which makes flags the switch an agent uses to change behaviour between runs: a paywall variant, a creative, which backend to use, how much of the audience sees a feature.
Kinds, rollouts, variants, overrides
| Field | Description |
|---|---|
kind | boolean, string, or number. Fixed once the flag exists. |
enabled | Boolean flags. The value when the device is inside the rollout. |
rollout_percent | Boolean flags, 0 to 100, default 100. The share of devices that get enabled; the rest get false. |
value | String and number flags. The default value. |
variants | String and number flags. [{"value": "annual_first", "weight": 50}, {"value": "monthly_first", "weight": 50}]. Weights are any positive integers; devices are split in proportion. Empty means every device gets value. |
overrides | Per-device pins: {"<client id>": value}. An override wins over rollout and variants, so you can put your own phone, or one user who reported a bug, into a variant. |
description | Optional, for people and agents reading the flag list. |
Assignment is stable: a device's bucket is a hash of the flag key and its client id, so the same device gets the same answer on every fetch and on every proxy node, different flags split the audience differently, and no rules ever ship to the app. Raising a rollout from 10 to 20 percent keeps the first 10 percent in.
GET returns the definitions. PUT merges by flag name: flags you send are changed, flags you omit are untouched, a flag sent as null is removed. Each flag can be written as a shorthand or an object:
curl -s "$API/projects/4f865a6d/services/4995ea8e/remote_config" -H "$AUTH" -X PUT -H "Content-Type: application/json" -d '{
"flags": {
"use_aiproxy": true, # boolean shorthand: sets enabled
"max_free_messages": 10, # number shorthand: sets the default value
"beta_composer": {"kind": "boolean", "enabled": true, "rollout_percent": 10},
"paywall": {"kind": "string", "value": "monthly_first",
"variants": [{"value": "annual_first", "weight": 50}, {"value": "monthly_first", "weight": 50}],
"overrides": {"D5EC1C56-…": "annual_first"},
"description": "Which plan is listed first"},
"old_flag": null # remove
}}'
# => {"service_uuid": "4995ea8e", "updated_at": "…", "flags": {"use_aiproxy": {"kind": "boolean", "enabled": true, "rollout_percent": 100, "description": null, "overrides": {}}, "paywall": {"kind": "string", "value": "monthly_first", "variants": [...], "overrides": {"D5EC1C56-…": "annual_first"}, ...}, ...}}
Override entries merge too: {"overrides": {"<client id>": null}} removes one pin. Changing a flag's kind returns 422; remove and recreate it instead. Names are 1 to 64 characters of lowercase letters, digits, and underscores, starting with a letter.
GET …/remote_config/evaluate?client_id=… answers "what does this device get?" without the device:
{
"client_id": "D5EC1C56-…",
"flags": {"use_aiproxy": true, "beta_composer": false, "paywall": "annual_first", "max_free_messages": 10},
"assignments": {
"use_aiproxy": {"source": "default", "bucket": 853},
"beta_composer": {"source": "rollout", "bucket": 4120},
"paywall": {"source": "override", "bucket": 1725},
"max_free_messages": {"source": "default", "bucket": 2210}
}
}
Calling any of these routes on a service of another type returns 422.
API keys
Keys belong to proxy services. Submitting a provider key splits it into a partial key for your app and an encrypted remainder on AIProxy. As in the dashboard, the partial_key is only returned in the response to the create request; it is not stored and cannot be retrieved later. If you lose it, create a new key.
| Field | Description |
|---|---|
name | Required. A label for the key. The only field that can be updated. |
provider_key | Required on create, write only. The secret key from your provider, 12 to 1024 characters. |
partial_key | Read only, in the create response only. The partialKey for your app. |
service_url | Read only, in the create response only. The serviceURL for your app. |
device_check_bypass | Read only, in the create response only, when DeviceCheck is configured. The value for the AIPROXY_DEVICE_CHECK_BYPASS environment variable in your Xcode scheme. |
{
"id": 42,
"uuid": "1a2b3c4d",
"name": "Production",
"key_version": 1,
"partial_key": "v2|1a2b3c4d|…",
"service_url": "https://api.aiproxy.com/4f865a6d/e88e2881",
"created_at": "2026-08-31T00:00:00.000Z",
"updated_at": "2026-08-31T00:00:00.000Z"
}
Deleting a key invalidates the partial key derived from it. Requests from apps still using it will fail.
Endpoints
Endpoints belong to proxy services. They are the provider paths the service allows, e.g. /v1/chat/completions. They are required when proxy_all_paths is false, and they are where per-endpoint rate limits and model overrides attach.
| Field | Description |
|---|---|
path | Required. The path, with or without a leading slash. Must be a valid URL path and unique within the service. |
rate_limits | Read only. The endpoint's rate limits (see below). |
overrides | Read only. The endpoint's model overrides (see below). |
GET …/endpoints/suggestions lists the paths AIProxy already knows for the service's provider, the same list the dashboard offers in its dropdown. Any other path is accepted too.
path replaces the endpoint, matching the dashboard. The response carries a new id, and any rate limits or overrides attached to the old endpoint are removed.Rate limits
Global rate limits apply to every endpoint of a service. Endpoint rate limits apply to one endpoint. Both use the same fields (see Rate limits).
Endpoint rate limits live under the endpoint:
| Field | Description |
|---|---|
limit_on | Required. requests_per_user or requests_per_ip. |
window | Required. minute, hour, day, week or month. |
quantity | Required. The number of requests allowed per window. A positive integer. |
window_in_seconds | Read only. The window as seconds. |
curl -s "$API/projects/4f865a6d/services/e88e2881/rate_limits" -H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"limit_on": "requests_per_user", "window": "day", "quantity": 500}'
Model overrides
A model override rewrites the model of requests to an endpoint without shipping an app update (see Model overrides). Overrides are available on OpenAI's /v1/chat/completions, /v1/responses and /v1/audio/speech endpoints.
| Field | Description |
|---|---|
name | Required. The override kind. Currently openai_model_swap. |
old_value | Required. The model to match, or Any to match every request. |
new_value | Required. The model to send to the provider instead. |
GET …/overrides/options lists the overrides the endpoint supports along with the old_values and new_values the dashboard offers. It is empty for endpoints that support no overrides, and creating an override on such an endpoint returns 422.
curl -s "$API/projects/4f865a6d/services/e88e2881/endpoints/7/overrides" -H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"name": "openai_model_swap", "old_value": "Any", "new_value": "gpt-4o-mini"}'
Alerts
Alerts email you when a service misbehaves.
| Field | Description |
|---|---|
limit_on | Required. bad_provider_status_consecutive (consecutive non-2xx responses from the provider) or device_check_failure_consecutive (consecutive DeviceCheck failures). |
quantity | Required. How many consecutive occurrences trigger the alert. A positive integer. |
Bans
A ban blocks a client ID or an IP address from every service in an app. Bans have no numeric id; they are addressed by kind and value.
| Field | Description |
|---|---|
ban_type | Required. client_id or ip_address. |
value | Required. The client ID (as shown in the dashboard's request log) or a single IPv4 or IPv6 address. Ranges are not supported. IP addresses are normalized, so use the value from the response when deleting. |
note | Optional. Up to 500 characters, for your own reference. |
banned_at | Read only. |
curl -s "$API/projects/4f865a6d/bans" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"ban_type": "ip_address", "value": "203.0.113.9", "note": "scraper"}'
curl -s "$API/projects/4f865a6d/bans/ip_address/203.0.113.9" -H "$AUTH" -X DELETE
Bans take effect on the next request. Banning a value that is already banned returns 422. To find who to ban, use top clients and request history; a banned client's later requests show up there as client_banned or ip_banned rejections.
DeviceCheck
An app has one DeviceCheck configuration, so this is a singular resource. The fields match the DeviceCheck tab of the dashboard, except that the .p8 file is sent as a string rather than a file upload.
| Field | Description |
|---|---|
apple_team_id | Required. Your Apple developer team ID. |
device_check_key_id | Required. The key ID of the DeviceCheck key you created in the Apple developer portal. |
p8_file | Required on create, write only. The full contents of the .p8 file, including the BEGIN and END lines. |
p8_file_name | Optional. Defaults to AuthKey_<key id>.p8. |
apply_to_existing_services | Optional, write only. When true, turns on protect_endpoints_with_device_check for every service already in the app. |
device_check_bypass | Read only. The value for the AIPROXY_DEVICE_CHECK_BYPASS environment variable when running in the simulator. |
configured | Read only. Whether the configuration is complete. |
curl -s "$API/projects/4f865a6d/device_check" -H "$AUTH" -H "Content-Type: application/json" \
-d "$(jq -n --rawfile p8 AuthKey_ABC123.p8 \
'{apple_team_id: "TEAM12345", device_check_key_id: "ABC123", p8_file: $p8, apply_to_existing_services: true}')"
POST …/device_check/import copies the configuration from another of your apps. Send {"from_project_uuid": "…"}, optionally with apply_to_existing_services. GET …/device_check/p8_file downloads the stored .p8 file. POST …/device_check and …/import return 409 when the app is already configured; update or delete the existing configuration instead.
POST …/device_check/rotate_bypass replaces the Simulator bypass token and returns the configuration with the new device_check_bypass. The old token is rejected immediately, so update AIPROXY_DEVICE_CHECK_BYPASS in every Xcode scheme that carries it. Rotate it whenever it may have leaked, for example after it was pasted into a shared channel or committed. The same control is the rotate icon next to the token on the DeviceCheck tab.
App Attest
An app has one App Attest configuration, so this is a singular resource. It matches the App Attest tab of the dashboard: the Apple team ID and the bundle ID of the app, nothing else. App Attest is what the Foundation Models, remote config, and logs packages authenticate with on iOS 27+; DeviceCheck stays for the AIProxySwift proxy path.
| Field | Description |
|---|---|
apple_team_id | Required. Your Apple developer team ID (10 characters). |
bundle_id | Required. The app's bundle identifier. Together they form the App ID the attestation is checked against. |
app_id | Read only. <team id>.<bundle id>. |
app_url | Read only. https://api.aiproxy.com/<app>: the value for AIProxy.configure(verificationMethod: .appAttest(appURL:)), and the base of the attestation routes. Any of the app's service URLs without its last segment. |
bypass_token | Read only. The value for the AIPROXY_APP_ATTEST_BYPASS environment variable when running in the Simulator, where App Attest is unavailable. Never ship it. |
configured | Read only. Whether the configuration is complete. |
curl -s "$API/projects/4f865a6d/app_attest" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"apple_team_id": "TEAM12345", "bundle_id": "com.example.app"}'
POST …/app_attest returns 409 when the app is already configured; update or delete the existing configuration instead.
POST …/app_attest/rotate_bypass replaces the Simulator bypass token and returns the configuration with the new bypass_token. The old token is rejected immediately, so update AIPROXY_APP_ATTEST_BYPASS in every Xcode scheme that carries it. The same control is the rotate icon next to the token on the App Attest tab.
Audit log
Every configuration change is recorded: who made it (a person in the dashboard, or an admin API key by its last five characters), what changed, and when. It is the record a person reads to see what an agent did, and the record an agent reads before it acts.
Newest first. Params: limit (default and maximum 100); before, the id of the last event you have, for the next page; service, a service api_uuid; record_type, for example RemoteConfigFlag, GlobalRateLimit, Ban, Service. Readable with the read-only key.
[
{
"id": 9120,
"time": "2026-09-11T14:02:11.000Z",
"actor": "admin_api",
"api_key_last5": "3f2a1",
"action": "updated",
"record_type": "RemoteConfigFlag",
"record_id": "77",
"record_label": "paywall",
"service_uuid": "4995ea8e",
"changes": {"variants": [[], [{"value": "annual_first", "weight": 50}, {"value": "monthly_first", "weight": 50}]]},
"request_id": "…",
"ip": "203.0.113.9"
}
]
changes maps each changed field to [old, new]; secrets (provider keys, p8 files) are recorded as "[redacted]". Deletes carry the record's final values. The same list is on the dashboard under the app's Audit log.
Reading traffic back
Everything the dashboard's monitoring pages show is also on the API: request history, OpenTelemetry logs, top clients by requests or tokens, per-client token usage, latency percentiles, error breakdowns, and time series for charts. They are documented on Admin API: analytics.
Not available through the API
- Billing and plan changes. Use the account page, which hands off to Stripe.
- Changing your email or password. These require your current password in the dashboard.
- The live console (a streaming view of requests as they happen). Poll request history instead.
If you need one of these, or anything else, let us know at [email protected].