Auth & Accounts
Login, session, device flow, user, role, and API Key.
Read the current browser or Bearer login status
Read the current browser or Bearer login status
Check if the administrator key is configured
Check if the administrator key is configured
Establish a recovery session with an administrator key
It is used for the first administrator recovery, recovery login when there is no account, and permission recovery.
Establish an account session by using the email password
Ordinary account and administrator account unified use this 1 portal login.
Clean up the current browser session
Clean up the current browser session
Read account invitation metadata
Returns the invited email, display name, 24-hour expiry, and optional acceptance time without exposing the stored token hash. Regenerating an invitation immediately invalidates its older link.
Accept an account invitation and set the initial password
Accepts the one-time invitation, sets the password, and revokes the account's existing browser sessions.
Create Device Login Request
CLI, Desktop, and Web first call this endpoint to obtain the device code, user code, and browser approval address,
Poll device flow results and exchange for API Key
Continue to poll by `intervalSeconds` when returning to `authorization_pending`;
Approve a device login in the browser
Approve a device login in the browser
Deny device login once in browser
Deny device login once in browser
Read current account information
Read current account information
Update current account information
Update current account information
List currently manageable API Keys
List currently manageable API Keys
Create a new API Key
Create a new API Key
Undo a API key
Undo a API key
List permission groups and definitions
List permission groups and definitions
List all global roles
List all global roles
Create a custom role
Create a custom role
Update role name, description, or permissions
Update role name, description, or permissions
Delete a custom role
Delete a custom role
List accounts and aggregate permissions summary
The Sub2API binding state defaults to 10 seconds of in-process caching and merging concurrent queries for the same user; the binding state is not written to the Workflow Server database.
Get Sub2API API key grouping configuration
Read the API key packet of Sub2API and merge the open selections saved in the Workflow Server database.
Save Sub2API API key groupings available to Server users
The Sub2API packet is re-read and all groupId are verified before saving. An empty array means that no grouping is provided to the Server user.
Synchronous API key grouping presentation from Sub2API
Rereads the API key grouping for Sub2API, bypassing the short-term cache, merging the saved open selections and logging the administrator synchronization audit events.
Configure the user open status and package price of a Sub2API group
Configure the user open status and package price of a Sub2API group
Get all Sub2API user subscriptions
The subscription, package cycle, and usage in the Sub2API management interface are read by page, and the Workflow account information is used to supplement the user identity that can be matched.
Simulate refund and cancel Sub2API subscription
The refund amount must be greater than 0 and cannot exceed the total of Workflow completed simulated payments associated with this Sub2API subscription.
Get the AI configurations and benefits available to the current user
Combine the administrator's open group, Sub2API balance, balance group usage, subscription usage, and key configuration status; user status uses 10-second in-process cache by default, and grouping uses 60-second in-process cache by default. The same concurrent queries will be merged. Temporary network, timeout, throttling, or 5xx faults after cache expiration can return the last successful result within the default 5-minute stale window; forced refresh and authoritative 4xx do not downgrade. Server does not synchronize the benefits, usage, binding status, or key status to the Workflow Server database, nor does it return the Sub2API key or key ID.
Save the current user's AI provider preferences
Save the Sub2API group IDs opened by the administrator in order. `groups` for `GET /api/auth/sub2api/catalog` and `credentials` for `GET /api/auth/sub2api/llm-credentials` use the same order; the run directory skips the currently unavailable configuration, but does not retry across provider after the model request has already begun. New groups that are not committed are appended in the default group ID order; an empty array removes user preferences and restores the default order.
Obtain the AI request usage of the current user.
Read the current login user's successive model requests and time range summary from the Sub2API page. The response only retains the display fields such as model, configuration, entry, token, cost, time consumption, and billing method, and does not return Sub2API Key, user information, IP address, User-Agent, upstream request ID, or internal account ID. Reads use the default 10-second in-process cache, concurrent merge, and the default 5-minute stale-if-error window, not synchronized to the Workflow Server database.
Gets the directory of server AI credentials available to the current user
This function returns the configuration that has been opened, the group is valid, the user key is active, and the subscription group has active subscription. `credentials` Follow the provider usage preferences saved by the current user. Configurations that are invalid, disabled, model empty, or model read failed will be skipped, and subsequent valid items will remain in relative order. Read-only Sub2API details follow the short-term cache and bounded stale-if-error strategy; 502 is returned when there is no cache or when the pocket window has expired and the upstream is unavailable. Sub2API determines available models, and Workflow Server supplements vision, networking, inference, and tool invocation capabilities with a built-in catalog of versioned models; unknown models do not declare capabilities. The response contains the one-hour short-term proxy credentials, but does not contain the real Sub2API Key. Only account sessions with user identity, account API Key or Server runtime capability are available; Administrator Key without user identity returns 403.
Proxy Anthropic Messages request
Proxy a JSON or SSE request with a short credential signed by the server AI directory. Server Removes client authentication, cookies, and hop-by-hop headers, and then injects the actual Sub2API Key. A short credential expiration after the start of the request does not interrupt an already established stream.
Proxy OpenAI Responses requests
Only forward to the fixed path of Sub2API `/v1/responses`, JSON and SSE are supported. The upper limit of the request body is 50 MiB, and the upstream request is canceled when the client is disconnected.
Proxy OpenAI Chat Completions request
Forward only to the fixed Sub2API `/v1/chat/completions` path, supports JSON and SSE; does not accept the client to specify any upstream URL.
Get a model that AI grouping support
Only groups that have been opened to users by the administrator are allowed to query. When the custom model list is enabled for the group, the list prevails. When the custom model list is not enabled, the current model list of the active account in the group is read from the Sub2API page and merged and deduplicated. Server uses the 60-second in-process cache by default and merges the same concurrent requests without synchronizing the model list to the Workflow Server database.
Enable a balance billing AI grouping
The Sub2API API key of the corresponding group is created for the current user when the key is activated for the first time. When the key is deactivated, it is directly restored to active without recharging the account balance or returning the key content or ID.
Deactivate a balance billing AI group
Change the existing Sub2API API key status of the group corresponding to the current user to inactive; the key is not deleted, and the key content or ID is not returned.
Get the current user's Sub2API order
Get the current user's Sub2API order
Create Sub2API order for payment
Subscription package orders are bound to a group and the administrator price is used. Balance recharge is an account-level order without binding groups, and the amount is specified by the amountCents. This step does not call Sub2API.
Simulate payment and fulfill order to Sub2API
A subscription order assigns or renews a 30-day subscription after creating a grouping key; a balance order only increases the account-level shared balance for the current Sub2API user.
Invite a new user
Invite a new user
Regenerate an invitation link for an existing invited user
Regenerate an invitation link for an existing invited user
Update a user's mailbox, display name, temporary password, or start/stop status
Update a user's mailbox, display name, temporary password, or start/stop status
Verify the Sub2API binding status of the Workflow user
Use deterministic Sub2API mailbox to query users in real time and return bound or unbound status; return 502 when upstream is not available.
Binding a Workflow user as a Sub2API normal user
Generate a Sub2API user name and a `<userId>@workflow-code.local` mailbox using the Workflow user ID.
Unbind Workflow user Sub2API
Find and delete the corresponding Sub2API normal user by deterministic mailbox, and the Workflow user is not affected.
Override the role collection for the specified user
Override the role collection for the specified user