Local API Requests and Retries
This guide supplements the environment-operation implementation in the current 2.0.0 client. Older clients retain their versioned API reference. Use a capability only when both client and backend support it. Deployment status, effective quantities, and delays come from actual responses, not design or integration-test candidates.
Prerequisites
Enable Local API in the desktop client using API Management. Access is local to this computer; do not expose it through public listeners, port forwarding, or shared API keys.
Except for GET /api/v1/status, business requests require Authorization: Bearer <api-key>. This does not replace the client login, current-team permissions, or plan feature access. Launching also requires an engine supported on the current platform; engine and extension preparation can affect timing.
Fixed Request Boundaries
These are current input-validation boundaries, not the total number of profiles a team may store:
| Item | Current boundary | Notes |
|---|---|---|
| Batch start, restart, and stop | 1–10 raw array items | Length is checked before deduplication, so repeated IDs still count. A larger GUI selection does not imply the API accepts that quantity in one call |
Batch concurrency | Integer 1–10, default 5 | Per-request parallelism; launching also follows shared client scheduling, so this does not guarantee that many free slots |
| Batch delete, permanent delete, and group move | Up to 100 raw array items | Permissions, runtime state, and endpoint-specific fields still apply; not every batch endpoint accepts 100 items |
| Pagination | page defaults to 1; size defaults to 10, maximum 100 | Fetch one page at a time and follow response pagination; runtime state reflects the query snapshot |
| JSON body | Up to 2 MiB | Applies to the entire Local API request body; oversized bodies return HTTP 413 / 41301. This is not a per-cookie size limit or a universal cloud API boundary |
| JSON syntax | Valid JSON required | Invalid JSON returns HTTP 400 / 40001 |
Do not replay a whole batch for partial failures or split work into unbounded concurrent requests. Submit manageable batches and inspect each profile's result.
Dynamic Rules and Sharing Scope
| Rule | Scope | Integration guidance |
|---|---|---|
| Per-operation creation, clone, sharing, or migration-link quantity | Action, team, and destination team where applicable | Use single_request.effective_maximum; null means this rule adds no finite maximum, but existing endpoint and screen boundaries still apply |
| Ordinary Local API request frequency | Queries and writes share one client instance | Scripts, connections, and API keys do not each receive a separate allowance |
| High-cost Local API request frequency | Creation, start, restart, and related batches share a pool and also use the ordinary request channel | Count one local HTTP request once; an internal restart-to-start call is not counted again. Additions cannot consume all capacity reserved for opening existing profiles |
| Stop and health checks | A separate shared control channel, with a health-check sublimit and stop reservation | Stop still needs authorization and may wait; reserved capacity does not guarantee no 429 response or successful closure in every situation |
| Cloud high-cost request frequency | One user across devices and teams | Switching devices or teams does not create another user-level allowance; this is separate from local channels |
| Daily additions | One team, Beijing-time calendar day | Counts successful additions; share copies count against the receiving team. See Profile Quantities and Operation Guidance |
Rules are negotiated internally; do not assume Local API exposes a public all-rules endpoint. Internal observed_maximum is an observation threshold, not an enforced value. guard_mode=observe does not reject requests for new business thresholds, while authentication, validation, and local resource boundaries remain active. enforce applies effective business settings; local frequency enforcement also requires enforcement_ready=true. Do not hardcode candidate per-second, per-minute, or daily quantities.
Shared Local Launch Scheduling
The interface, Local API, RPA, and RPA Plus share a launch coordinator in the same Electron main process. Before the first valid configuration is available, the current client uses launch concurrency 10, waiting capacity 100, and a queue wait of 60 seconds. Valid backend settings then take precedence; a temporary refresh failure does not overwrite confirmed settings. Account or team changes cause settings to be retrieved for the new context.
These values schedule launch tasks; they are neither plan storage capacity nor a total open-window cap. A Local API batch still accepts at most 10 items, not 100 just because the waiting capacity is 100. GUI batches may be larger and progress incrementally; waiting capacity is not a GUI selection limit.
A queue wait or launch-stage timeout may return queue_timeout. Check actual running state first; do not launch another instance if the profile is already running.
Read and Preserve Error Details
Read the business code, message, and data, not just the HTTP status. A batch may return HTTP 200 with success=false items; inspect each item's error.code/message/data.
| Response | Typical meaning | What to do |
|---|---|---|
400 / 413 | Invalid input or oversized body | Correct fields, array length, or body size instead of rapidly replaying the request |
422, batch_limit | Quantity exceeds the effective per-operation range | Adjust using data.limit or the current screen value |
422, runtime_snapshot_too_large | Query contains too many IDs | Reduce exact IDs; for an oversized runtime snapshot, remove the running-state filter. Never truncate IDs and present the result as complete |
429, rate_limited | Requests are concentrated within the current time window | Honor the supplied delay and reduce parallel requests; verify results of operations with side effects |
409, daily_limit | Insufficient daily additions remain | Reduce quantity or check the next counting period; merely waiting does not fix a batch larger than the entire daily allowance |
409, operation_processing / idempotency_conflict | Original work is processing, or input differs for the same key | Look up the original result; do not blindly issue a new key |
409, team_changed / cancelled | Team context changed or task was cancelled | Verify team, task, and current state before submitting again |
503, queue_full / queue_timeout | Launch admission, waiting, or execution did not complete | Wait for current tasks and verify state; handle only profiles not running |
503, cookie_sync_pending / cookie_sync_failed | Closing cookies have not finished syncing or recovering | Preserve local recovery data and finish sync or recovery in the client before opening |
503, guard_initializing / capability_unavailable | Settings are not ready or a capability is unavailable | Retry later or check version and capability; do not loop over side-effecting requests |
503, service_busy / read_invalidated | Processing did not complete, or data changed during a query | Use source and execution state: refresh reads, verify writes first. Do not diagnose every case as a cloud outage |
404, result_unavailable, or an incomplete response | Original result cannot be confirmed | Check profiles and original team; unavailable results do not prove the operation never ran |
Preserve request_id, operation time, and the relevant operation_key for diagnosis. Do not expose API keys, cookies, or passwords in public logs. Available detail fields include:
source,backend_code,reason,scope: origin, original business code, and rule scope. Do not infer causes from display text.retry_after_seconds,retry_at,Retry-After: honor them when provided.Retry-Aftermay be seconds or an HTTP date. Do not invent an exact delay when none is returned; use bounded backoff rather than a tight loop.stage,browser_state,execution_state: failure stage, observed browser state, and execution state of the operation.limit,requested,used,quota_day,rule_version: actual quantities and rule context. Not every error contains every field.
execution_state=not_started means that operation did not start; address its cause before resubmitting. For in_progress, continue checking; for completed, consume the existing result. unknown does not mean failure. Even retryable=true does not justify ignoring side effects or successful batch items.
Two-Stage Restart Results
Restart closes the window before cookie sync, preparation, and launch. On failure, read stage (such as closing, cookie_sync, or preparing) and browser_state (such as active or inactive), then query current state. Do not interpret inactive as the original window still running. A not_started execution state for a later operation does not undo an earlier completed close.
Do not automatically restart again after every restart error. If the profile is closed, resolve sync or preparation first and then start it. If it is already running, use the existing window. For a batch, handle only items that still require action.
Idempotency and Addition Results
When the relevant capabilities are supported, Local API creation accepts Idempotency-Key and X-Expected-Team-Id. Keys contain 16–128 letters, digits, underscores, or hyphens. Retry the same logical operation with the original key and identical input; never reuse the key for different input. Do not assume every endpoint or older client supports idempotency.
Local result lookup is GET /api/v1/environment-operations/{operation_key}, with the original original_team_id, action, and target_team_id for share-copy operations. Lookup still verifies the current login and permissions; an operation key is not an access credential.
- Retain the original key, source team, action, and input digest.
- After a timeout, disconnect, or unknown execution state, look up that operation before generating a new key.
- For
processing, wait and check again; forsucceeded, use the returned profile IDs; forfailed, address the actual error before deciding the next operation. - If the result is unavailable, expired, unauthorized, or unsupported, check the profile list and escalate for manual verification if needed. None of these conditions proves no profile was created.
- Create a genuinely new operation only after confirming the original result.
An idempotency key does not bypass team or permission checks. Also verify successful migration imports before generating replacement links; a pending status does not prove no import occurred.
Bounded ID Queries
Exact-ID and runtime-state queries require backend support. Internal query_capability.max_filter_ids bounds the combined raw lengths of exact_env_ids and runtime_snapshot.env_ids before deduplication. Its value comes from capability settings, not a fixed 1000 or plan capacity. This internal query body is not a list of fields directly accepted by Local API list requests.
An unavailable capability returns an explicit error instead of downloading all profiles and filtering locally. Runtime-state conditions combine with team, permission, and business filters before pagination and counting. Filtering only the current page does not produce a complete total.