{ "swagger": "2.0", "info": { "contact": {} }, "paths": { "/auth/login": { "post": { "description": "Verifies credentials and returns a 24-hour session token. Revokes any existing session for the user.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Authenticate with email and password", "parameters": [ { "description": "Login credentials", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.loginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.loginResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/dashboard/stats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns aggregate key counts and 24-hour usage metrics. Scope is determined by the caller's role: org (admin), team (team_admin), or user (member).", "produces": [ "application/json" ], "tags": [ "dashboard" ], "summary": "Get dashboard statistics", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.dashboardStatsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/invites/peek": { "get": { "description": "Returns invite metadata (org name, role, expiry) for display in the registration UI. No authentication required.", "produces": [ "application/json" ], "tags": [ "invites" ], "summary": "Peek at an invite", "parameters": [ { "type": "string", "description": "Invite token", "name": "token", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.peekInviteResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "410": { "description": "Gone", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/invites/redeem": { "post": { "description": "Creates a new user account and org membership from a valid invite token. No authentication required.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invites" ], "summary": "Redeem an invite", "parameters": [ { "description": "Redemption parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.redeemInviteRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.redeemInviteResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/me": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns the profile of the user associated with the current session key.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Get authenticated user profile", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.meResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/me/available-models": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns model names accessible to the caller's org, team, and key scope.", "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "List models available to the authenticated key", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.availableModelsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/models": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of models. Requires system admin.", "produces": [ "application/json" ], "tags": [ "models" ], "summary": "List models", "parameters": [ { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen model)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include inactive models", "name": "include_inactive", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedModelsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Persists a new model and adds it to the live registry. The API key is encrypted at rest. Requires system admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Create a model", "parameters": [ { "description": "Model parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createModelRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/models/test-connection": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Probes the provider's /models endpoint to verify URL and API key without persisting any data. Requires system admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Test upstream provider connectivity", "parameters": [ { "description": "Connection parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.testConnectionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.testConnectionResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/models/{model_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single model by ID. Requires system admin.", "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Get a model", "parameters": [ { "type": "string", "description": "Model ID", "name": "model_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes the model and removes it from the live registry. Requires system admin.", "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Delete a model", "parameters": [ { "type": "string", "description": "Model ID", "name": "model_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates model fields and refreshes the live registry. Requires system admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Update a model", "parameters": [ { "type": "string", "description": "Model ID", "name": "model_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateModelRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/models/{model_id}/activate": { "patch": { "security": [ { "BearerAuth": [] } ], "description": "Marks the model as active and adds it to the live registry so proxy requests can use it immediately. Requires system admin.", "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Activate a model", "parameters": [ { "type": "string", "description": "Model ID", "name": "model_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/models/{model_id}/deactivate": { "patch": { "security": [ { "BearerAuth": [] } ], "description": "Marks the model as inactive and removes it from the live registry. In-flight requests are not affected. Requires system admin.", "produces": [ "application/json" ], "tags": [ "models" ], "summary": "Deactivate a model", "parameters": [ { "type": "string", "description": "Model ID", "name": "model_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs": { "get": { "security": [ { "BearerAuth": [] } ], "description": "System admins get a paginated list of all orgs; other roles receive only their own org.", "produces": [ "application/json" ], "tags": [ "orgs" ], "summary": "List organizations", "parameters": [ { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen org)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include soft-deleted orgs (system admin only)", "name": "include_deleted", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedOrgsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new organization. Only system admins may call this endpoint.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "orgs" ], "summary": "Create an organization", "parameters": [ { "description": "Organization parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createOrgRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.orgResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single organization. System admins may fetch any org; other roles may only fetch their own.", "produces": [ "application/json" ], "tags": [ "orgs" ], "summary": "Get an organization", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.orgResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes an organization. Only system admins may call this endpoint.", "produces": [ "application/json" ], "tags": [ "orgs" ], "summary": "Delete an organization", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates the organization. System admins may update any org; org admins may only update their own.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "orgs" ], "summary": "Update an organization", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateOrgRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.orgResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/invites": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of invite tokens for the organization, with computed status (pending, expired, redeemed).", "produces": [ "application/json" ], "tags": [ "invites" ], "summary": "List invites", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen invite)", "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedInvitesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Generates an invite token for the given email. Only system admins may invite with role org_admin. The plaintext token is returned exactly once.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "invites" ], "summary": "Create an invite", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Invite parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createInviteRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.createInviteResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/invites/{invite_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Permanently deletes the invite token, preventing redemption.", "produces": [ "application/json" ], "tags": [ "invites" ], "summary": "Revoke an invite", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Invite ID", "name": "invite_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/keys": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of API keys. Scope is filtered by role.", "produces": [ "application/json" ], "tags": [ "keys" ], "summary": "List API keys", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen key)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include soft-deleted keys (system admin only)", "name": "include_deleted", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedAPIKeysResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new API key for the organization. Members may only create user keys for themselves. The plaintext key is returned exactly once.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "keys" ], "summary": "Create an API key", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "API key parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createAPIKeyRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.createAPIKeyResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/keys/{key_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single API key. Visibility is scoped by role: org admins see all keys, team admins see their team keys, members see only their own.", "produces": [ "application/json" ], "tags": [ "keys" ], "summary": "Get an API key", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "API key ID", "name": "key_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.apiKeyResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes the API key and immediately evicts it from the auth cache. The key will be rejected by the proxy without delay.", "produces": [ "application/json" ], "tags": [ "keys" ], "summary": "Delete an API key", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "API key ID", "name": "key_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates name, rate limits, token limits, or expiry of an API key. Only provided fields are changed.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "keys" ], "summary": "Update an API key", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "API key ID", "name": "key_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateAPIKeyRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.apiKeyResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/keys/{key_id}/model-access": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns the list of model names in the API key's allowlist. An empty list means all team-allowed models are permitted.", "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Get key model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "API key ID", "name": "key_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Atomically replaces the API key's model allowlist. All models must be allowed at the team and org level. Pass an empty array to clear.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Set key model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "API key ID", "name": "key_id", "in": "path", "required": true }, { "description": "Model allowlist", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/members": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of organization memberships.", "produces": [ "application/json" ], "tags": [ "org-members" ], "summary": "List org members", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen membership)", "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedOrgMembershipsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Adds a user to the organization with the specified role. Only system admins may assign the org_admin role.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "org-members" ], "summary": "Add an org member", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Membership parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createOrgMembershipRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.orgMembershipResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/members/{membership_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Removes a user from the organization by deleting their membership record.", "produces": [ "application/json" ], "tags": [ "org-members" ], "summary": "Remove an org member", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Membership ID", "name": "membership_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Changes the role of an org membership. Only system admins may assign org_admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "org-members" ], "summary": "Update an org membership", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Membership ID", "name": "membership_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateOrgMembershipRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.orgMembershipResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/model-access": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns the list of model names in the org's allowlist. An empty list means all models are permitted.", "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Get org model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Atomically replaces the org's model allowlist. Pass an empty array to allow all models.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Set org model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Model allowlist", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/model-aliases": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns all model aliases defined at the org scope.", "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "List org model aliases", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.modelAliasResponse" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a model alias scoped to the org. The alias must not conflict with any canonical model name.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "Create an org model alias", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Alias parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createModelAliasRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.modelAliasResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/model-aliases/{alias_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Permanently removes the model alias from the org scope.", "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "Delete an org model alias", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Alias ID", "name": "alias_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/service-accounts": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of service accounts. Members only see accounts they created.", "produces": [ "application/json" ], "tags": [ "service-accounts" ], "summary": "List service accounts", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen service account)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include soft-deleted service accounts (system admin only)", "name": "include_deleted", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedServiceAccountsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new service account. Must be called with a user key (not a service account key).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "service-accounts" ], "summary": "Create a service account", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Service account parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createServiceAccountRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.serviceAccountResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/service-accounts/{sa_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single service account. Members only see service accounts they created.", "produces": [ "application/json" ], "tags": [ "service-accounts" ], "summary": "Get a service account", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Service account ID", "name": "sa_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.serviceAccountResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes the service account. Members may only delete service accounts they created.", "produces": [ "application/json" ], "tags": [ "service-accounts" ], "summary": "Delete a service account", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Service account ID", "name": "sa_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates the service account name. Members may only update service accounts they created.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "service-accounts" ], "summary": "Update a service account", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Service account ID", "name": "sa_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateServiceAccountRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.serviceAccountResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of teams. Org admins see all teams; others see only teams they belong to.", "produces": [ "application/json" ], "tags": [ "teams" ], "summary": "List teams", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen team)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include soft-deleted teams (system admin only)", "name": "include_deleted", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedTeamsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new team within the organization. Requires org admin or higher.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "teams" ], "summary": "Create a team", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "description": "Team parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createTeamRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.teamResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single team with member and key counts. Team admins only see teams they belong to.", "produces": [ "application/json" ], "tags": [ "teams" ], "summary": "Get a team", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.teamResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes the team. Requires org admin or higher.", "produces": [ "application/json" ], "tags": [ "teams" ], "summary": "Delete a team", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates team name, slug, or limits. Only provided fields are changed.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "teams" ], "summary": "Update a team", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateTeamRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.teamResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}/members": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of team memberships.", "produces": [ "application/json" ], "tags": [ "team-members" ], "summary": "List team members", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen membership)", "name": "cursor", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedTeamMembershipsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Adds a user to the team with the specified role (team_admin or member).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "team-members" ], "summary": "Add a team member", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "description": "Membership parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createTeamMembershipRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.teamMembershipResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}/members/{membership_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Removes a user from the team by deleting their membership record.", "produces": [ "application/json" ], "tags": [ "team-members" ], "summary": "Remove a team member", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "type": "string", "description": "Membership ID", "name": "membership_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Changes the role of a team membership (team_admin or member).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "team-members" ], "summary": "Update a team membership", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "type": "string", "description": "Membership ID", "name": "membership_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateTeamMembershipRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.teamMembershipResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}/model-access": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns the list of model names in the team's allowlist. An empty list means all org-allowed models are permitted.", "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Get team model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Atomically replaces the team's model allowlist. All models must be allowed at the org level. Pass an empty array to clear.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "model-access" ], "summary": "Set team model access", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "description": "Model allowlist", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.modelAccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}/model-aliases": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns all model aliases defined at the team scope.", "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "List team model aliases", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.modelAliasResponse" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a model alias scoped to the team. The alias must not conflict with any canonical model name.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "Create a team model alias", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "description": "Alias parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createModelAliasRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.modelAliasResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/teams/{team_id}/model-aliases/{alias_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Permanently removes the model alias from the team scope.", "produces": [ "application/json" ], "tags": [ "model-aliases" ], "summary": "Delete a team model alias", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Team ID", "name": "team_id", "in": "path", "required": true }, { "type": "string", "description": "Alias ID", "name": "alias_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/orgs/{org_id}/usage": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns aggregated usage metrics for the organization over a time range (max 90 days). Requires org admin.", "produces": [ "application/json" ], "tags": [ "usage" ], "summary": "Get org usage", "parameters": [ { "type": "string", "description": "Organization ID", "name": "org_id", "in": "path", "required": true }, { "type": "string", "description": "Start of range (RFC3339)", "name": "from", "in": "query", "required": true }, { "type": "string", "description": "End of range (RFC3339)", "name": "to", "in": "query", "required": true }, { "type": "string", "description": "Aggregation dimension: model, team, key, user, day, hour", "name": "group_by", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.usageResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/usage/me": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns aggregated usage metrics scoped to the current key or user. Any authenticated key may call this endpoint.", "produces": [ "application/json" ], "tags": [ "usage" ], "summary": "Get own usage", "parameters": [ { "type": "string", "description": "Start of range (RFC3339)", "name": "from", "in": "query", "required": true }, { "type": "string", "description": "End of range (RFC3339)", "name": "to", "in": "query", "required": true }, { "type": "string", "description": "Aggregation dimension: model, team, key, user, day, hour", "name": "group_by", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.usageResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/users": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a cursor-paginated list of all users. Requires system admin.", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "List users", "parameters": [ { "type": "integer", "description": "Page size (default 20, max 100)", "name": "limit", "in": "query" }, { "type": "string", "description": "Pagination cursor (UUIDv7 of the last seen user)", "name": "cursor", "in": "query" }, { "type": "boolean", "description": "Include soft-deleted users", "name": "include_deleted", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.paginatedUsersResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Creates a new user account. Only system admins may set is_system_admin=true.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Create a user", "parameters": [ { "description": "User parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.createUserRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/internal_api_admin.userResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } }, "/users/{user_id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Returns a single user. Org admins may only fetch users within their org; system admins may fetch any user.", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Get a user", "parameters": [ { "type": "string", "description": "User ID", "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.userResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Soft-deletes a user. Requires system admin.", "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Delete a user", "parameters": [ { "type": "string", "description": "User ID", "name": "user_id", "in": "path", "required": true } ], "responses": { "204": { "description": "No Content" }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } }, "patch": { "security": [ { "BearerAuth": [] } ], "description": "Updates user profile fields. Only system admins may change is_system_admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Update a user", "parameters": [ { "type": "string", "description": "User ID", "name": "user_id", "in": "path", "required": true }, { "description": "Fields to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api_admin.updateUserRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api_admin.userResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "409": { "description": "Conflict", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/internal_api_admin.swaggerErrorResponse" } } } } } }, "definitions": { "internal_api_admin.apiKeyResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "created_by": { "type": "string" }, "daily_token_limit": { "type": "integer" }, "expires_at": { "type": "string" }, "id": { "type": "string" }, "key_hint": { "type": "string" }, "key_type": { "type": "string" }, "last_used_at": { "type": "string" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "org_id": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "service_account_id": { "type": "string" }, "team_id": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.availableModelsResponse": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "string" } } } }, "internal_api_admin.createAPIKeyRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "expires_at": { "type": "string" }, "key_type": { "type": "string" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "service_account_id": { "type": "string" }, "team_id": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.createAPIKeyResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "created_by": { "type": "string" }, "daily_token_limit": { "type": "integer" }, "expires_at": { "type": "string" }, "id": { "type": "string" }, "key": { "type": "string" }, "key_hint": { "type": "string" }, "key_type": { "type": "string" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "org_id": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "service_account_id": { "type": "string" }, "team_id": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.createInviteRequest": { "type": "object", "properties": { "email": { "type": "string" }, "role": { "type": "string" } } }, "internal_api_admin.createInviteResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "email": { "type": "string" }, "expires_at": { "type": "string" }, "id": { "type": "string" }, "org_id": { "type": "string" }, "role": { "type": "string" }, "token": { "type": "string" }, "token_hint": { "type": "string" } } }, "internal_api_admin.createModelAliasRequest": { "type": "object", "properties": { "alias": { "type": "string" }, "model_name": { "type": "string" } } }, "internal_api_admin.createModelRequest": { "type": "object", "properties": { "aliases": { "description": "Aliases are optional short names that resolve to this model in proxy requests.", "type": "array", "items": { "type": "string" } }, "api_key": { "type": "string" }, "azure_api_version": { "type": "string" }, "azure_deployment": { "type": "string" }, "base_url": { "type": "string" }, "input_price_per_1m": { "type": "number" }, "max_context_tokens": { "type": "integer" }, "name": { "type": "string" }, "output_price_per_1m": { "type": "number" }, "provider": { "type": "string" } } }, "internal_api_admin.createOrgMembershipRequest": { "type": "object", "properties": { "role": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.createOrgRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" }, "timezone": { "type": "string" } } }, "internal_api_admin.createServiceAccountRequest": { "type": "object", "properties": { "name": { "type": "string" }, "team_id": { "type": "string" } } }, "internal_api_admin.createTeamMembershipRequest": { "type": "object", "properties": { "role": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.createTeamRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" } } }, "internal_api_admin.createUserRequest": { "type": "object", "properties": { "display_name": { "type": "string" }, "email": { "type": "string" }, "is_system_admin": { "type": "boolean" }, "password": { "type": "string" } } }, "internal_api_admin.dashboardStatsResponse": { "type": "object", "properties": { "active_keys": { "type": "integer" }, "cost_estimate_24h": { "type": "number" }, "requests_24h": { "type": "integer" }, "scope": { "description": "Scope indicates the data boundary: \"org\", \"team\", or \"user\".", "type": "string" }, "tokens_24h": { "type": "integer" }, "total_members": { "type": "integer" }, "total_teams": { "type": "integer" } } }, "internal_api_admin.inviteResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "created_by": { "type": "string" }, "email": { "type": "string" }, "expires_at": { "type": "string" }, "id": { "type": "string" }, "org_id": { "type": "string" }, "role": { "type": "string" }, "status": { "type": "string" }, "token_hint": { "type": "string" } } }, "internal_api_admin.loginRequest": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } }, "internal_api_admin.loginResponse": { "type": "object", "properties": { "expires_at": { "type": "string" }, "token": { "type": "string" }, "user": { "$ref": "#/definitions/internal_api_admin.meResponse" } } }, "internal_api_admin.meResponse": { "type": "object", "properties": { "display_name": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "string" }, "is_system_admin": { "type": "boolean" }, "org_id": { "type": "string" }, "role": { "type": "string" } } }, "internal_api_admin.modelAccessRequest": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "string" } } } }, "internal_api_admin.modelAccessResponse": { "type": "object", "properties": { "models": { "type": "array", "items": { "type": "string" } } } }, "internal_api_admin.modelAliasResponse": { "type": "object", "properties": { "alias": { "type": "string" }, "created_at": { "type": "string" }, "created_by": { "type": "string" }, "id": { "type": "string" }, "model_name": { "type": "string" }, "org_id": { "type": "string" }, "scope_type": { "type": "string" }, "team_id": { "type": "string" } } }, "internal_api_admin.modelResponse": { "type": "object", "properties": { "aliases": { "type": "array", "items": { "type": "string" } }, "azure_api_version": { "type": "string" }, "azure_deployment": { "type": "string" }, "base_url": { "type": "string" }, "created_at": { "type": "string" }, "id": { "type": "string" }, "input_price_per_1m": { "type": "number" }, "is_active": { "type": "boolean" }, "max_context_tokens": { "type": "integer" }, "name": { "type": "string" }, "output_price_per_1m": { "type": "number" }, "provider": { "type": "string" }, "source": { "type": "string" }, "updated_at": { "type": "string" } } }, "internal_api_admin.orgMembershipResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "string" }, "org_id": { "type": "string" }, "role": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.orgResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "daily_token_limit": { "type": "integer" }, "deleted_at": { "type": "string" }, "id": { "type": "string" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" }, "timezone": { "type": "string" }, "updated_at": { "type": "string" } } }, "internal_api_admin.paginatedAPIKeysResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.apiKeyResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedInvitesResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.inviteResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedModelsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.modelResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedOrgMembershipsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.orgMembershipResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedOrgsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.orgResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedServiceAccountsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.serviceAccountResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedTeamMembershipsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.teamMembershipResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedTeamsResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.teamResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.paginatedUsersResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.userResponse" } }, "has_more": { "type": "boolean" }, "next_cursor": { "type": "string" } } }, "internal_api_admin.peekInviteResponse": { "type": "object", "properties": { "email": { "type": "string" }, "expires_at": { "type": "string" }, "org_name": { "type": "string" }, "role": { "type": "string" } } }, "internal_api_admin.redeemInviteRequest": { "type": "object", "properties": { "display_name": { "type": "string" }, "password": { "type": "string" }, "token": { "type": "string" } } }, "internal_api_admin.redeemInviteResponse": { "type": "object", "properties": { "display_name": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "string" }, "org_id": { "type": "string" }, "role": { "type": "string" } } }, "internal_api_admin.serviceAccountResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "created_by": { "type": "string" }, "deleted_at": { "type": "string" }, "id": { "type": "string" }, "key_count": { "type": "integer" }, "name": { "type": "string" }, "org_id": { "type": "string" }, "team_id": { "type": "string" }, "updated_at": { "type": "string" } } }, "internal_api_admin.swaggerErrorDetail": { "type": "object", "properties": { "code": { "type": "string", "example": "not_found" }, "message": { "type": "string", "example": "resource not found" } } }, "internal_api_admin.swaggerErrorResponse": { "type": "object", "properties": { "error": { "$ref": "#/definitions/internal_api_admin.swaggerErrorDetail" } } }, "internal_api_admin.teamMembershipResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "string" }, "role": { "type": "string" }, "team_id": { "type": "string" }, "user_id": { "type": "string" } } }, "internal_api_admin.teamResponse": { "type": "object", "properties": { "created_at": { "type": "string" }, "daily_token_limit": { "type": "integer" }, "deleted_at": { "type": "string" }, "id": { "type": "string" }, "key_count": { "type": "integer" }, "member_count": { "type": "integer" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "org_id": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" }, "updated_at": { "type": "string" } } }, "internal_api_admin.testConnectionRequest": { "type": "object", "properties": { "api_key": { "type": "string" }, "base_url": { "type": "string" }, "provider": { "type": "string" } } }, "internal_api_admin.testConnectionResponse": { "type": "object", "properties": { "message": { "type": "string" }, "success": { "type": "boolean" } } }, "internal_api_admin.updateAPIKeyRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "expires_at": { "type": "string" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" } } }, "internal_api_admin.updateModelRequest": { "type": "object", "properties": { "aliases": { "description": "Aliases, when non-nil, replaces the full set of aliases for the model.\nPass an empty slice to remove all aliases.", "type": "array", "items": { "type": "string" } }, "api_key": { "type": "string" }, "azure_api_version": { "type": "string" }, "azure_deployment": { "type": "string" }, "base_url": { "type": "string" }, "input_price_per_1m": { "type": "number" }, "max_context_tokens": { "type": "integer" }, "name": { "type": "string" }, "output_price_per_1m": { "type": "number" }, "provider": { "type": "string" } } }, "internal_api_admin.updateOrgMembershipRequest": { "type": "object", "properties": { "role": { "type": "string" } } }, "internal_api_admin.updateOrgRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" }, "timezone": { "type": "string" } } }, "internal_api_admin.updateServiceAccountRequest": { "type": "object", "properties": { "name": { "type": "string" } } }, "internal_api_admin.updateTeamMembershipRequest": { "type": "object", "properties": { "role": { "type": "string" } } }, "internal_api_admin.updateTeamRequest": { "type": "object", "properties": { "daily_token_limit": { "type": "integer" }, "monthly_token_limit": { "type": "integer" }, "name": { "type": "string" }, "requests_per_day": { "type": "integer" }, "requests_per_minute": { "type": "integer" }, "slug": { "type": "string" } } }, "internal_api_admin.updateUserRequest": { "type": "object", "properties": { "display_name": { "type": "string" }, "email": { "type": "string" }, "is_system_admin": { "type": "boolean" }, "password": { "type": "string" } } }, "internal_api_admin.usageDataPoint": { "type": "object", "properties": { "avg_duration_ms": { "type": "number" }, "completion_tokens": { "type": "integer" }, "cost_estimate": { "type": "number" }, "group_key": { "type": "string" }, "prompt_tokens": { "type": "integer" }, "total_requests": { "type": "integer" }, "total_tokens": { "type": "integer" } } }, "internal_api_admin.usageResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/internal_api_admin.usageDataPoint" } }, "from": { "type": "string" }, "group_by": { "type": "string" }, "org_id": { "type": "string" }, "to": { "type": "string" } } }, "internal_api_admin.userResponse": { "type": "object", "properties": { "auth_provider": { "type": "string" }, "created_at": { "type": "string" }, "deleted_at": { "type": "string" }, "display_name": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "string" }, "is_system_admin": { "type": "boolean" }, "updated_at": { "type": "string" } } } } }