HYBRID-CHAINDEVELOPERS
DOCUMENTATIONv2
PUT

Teams & workspaces

Set active workspace

/api/v2/me/active-workspace
AUTHENTICATIONBearer token · workspaces:writeAUTHORITATIVE OWNERidentity-serviceCONTRACT AUTHORITYGenerated Rust OpenAPISTATUSSource ready · production listed

PURPOSE + BUSINESS CONTEXT

Switch the account’s selected operating context to another workspace in which the user is already an active member.

WHEN THIS CALL IS USEFUL

Call this after the user chooses a workspace and before refreshing wallet, portfolio, merchant, member, or policy views for that boundary.

OUTCOME · Select context

What changes

Updates only the subject’s active-workspace preference. It does not move assets, change roles, rebind keys, create wallets, approve transactions, or activate trading.

WHY IT MATTERS

  • Lets one account safely operate multiple personal, team, treasury, or trading contexts without blending their state.
  • Causes account and wallet experiences to resolve the selected boundary before presenting workspace-owned resources.

ISOLATION + AUTHORITY

Selection is allowed only for an existing active membership and cannot independently choose a tenant. Downstream services continue to enforce their own workspace, network, wallet, and policy boundaries.

BEFORE YOU CALL

  • A bearer token with workspaces:write.
  • A workspace_id from the caller’s fresh active-membership list.
  • A signed request and Idempotency-Key for the exact selection.

WHAT TO DO NEXT

  • Re-read the active workspace to reconcile the preference version.
  • Refresh every workspace-scoped view and discard cached state from the previous boundary.

AGENT GUIDANCE

  • Make the context switch visible and refresh all workspace-scoped state; stale balances or policies from the prior workspace must not remain on screen.
  • Never use workspace switching to bypass a missing membership, role, scope, wallet binding, or policy decision.
  • If dependent wallet state cannot refresh, report the partial UI failure while preserving the confirmed workspace selection.
MACHINE CONTRACT

The exact deployed parameters, schemas, responses, security requirements, and Hybrid-Chain agent metadata are authoritative at this operation's production OpenAPI JSON Pointer. The readable tables below add integration guidance; the deployed OpenAPI controls if guidance and the machine contract ever differ.

Open the authoritative production contract

EXTENDED INTEGRATION GUIDANCE

Readable request and response reference

Examples illustrate integration intent; the referenced OpenAPI operation and component schemas define the executable shape.

PARAMETERS

Headers, path, query, and body

NAMELOCATIONPRESENCETYPE / RULES / PURPOSE
AuthorizationheaderRequired

Bearer tokenCredential containing the workspaces:write scope.EXAMPLEBearer hc_live_…

Idempotency-KeyheaderRequired

ASCII string · 1–128Caller-generated key reused for every retry of the same logical mutation.EXAMPLElaunch-treasury-v1-001

Content-TypeheaderRequired

application/jsonSigned mutations accept canonical JSON only.EXAMPLEapplication/json

Content-DigestheaderRequired

RFC 9530 SHA-256 digestDigest of the exact transmitted body bytes.EXAMPLEsha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:

Signature-InputheaderRequired

RFC 9421 signature parametersCovers @method, @path, content-digest, content-type, and idempotency-key; includes keyid, nonce, created, and expires.EXAMPLEsig1=("@method" "@path" "content-digest" "content-type" "idempotency-key");created=1786582800;expires=1786583100;nonce="01J…";keyid="machine-prod"

SignatureheaderRequired

Ed25519 HTTP Message SignatureSignature made by an active public key registered to the authenticated client.EXAMPLEsig1=:base64-signature:

workspace_idbodyRequired

32-character workspace identifierWorkspace selected from the caller's active memberships.

REQUEST

JSON body example

{
  "workspace_id": "b00dc220da8f480d86cdc11341372746"
}

STABLE ERROR CODES

Branch on the code, then follow the recovery action

These codes are published by the authoritative gateway contract for this endpoint. Treat message as safe diagnostic text; integrations should branch on code and HTTP status.

STATUSCODEMEANING
400invalid_jsonThe JSON body is malformed or fails the published identity schema.
400invalid_security_requestThe identity, workspace, permission, or key request is invalid.
400missing_idempotency_keyA nonempty Idempotency-Key is required for this mutation.
401invalid_credentialsThe bearer or proof-of-possession credential is invalid.
403step_up_requiredThe caller lacks role authority or fresh purpose-bound approval.
404workspace_resource_not_foundThe requested workspace, membership, or invitation was not found.
409security_conflictThe requested permission or identity transition conflicts with current state.
503identity_security_unavailableThe authoritative Identity security service is temporarily unavailable.

RESPONSES

Status and payload examples

200Active-workspace preference updated.Mutation completed · JSON RESPONSE+
{
  "workspace_id": "b00dc220da8f480d86cdc11341372746",
  "tenant_uuid": "b00dc220da8f480d86cdc11341372746",
  "name": "Treasury Operations",
  "purpose": "TREASURY",
  "isolation_policy": "MPC",
  "status": "ACTIVE",
  "version": 1,
  "created_by": "d2f46f7e234c40a4a54e54208368d8d5",
  "created_at": "2026-08-12T21:00:00Z",
  "updated_at": "2026-08-12T21:00:00Z",
  "membership_id": "7bb755ad325c48e5a4f4cc7f5711fa62",
  "role": "OWNER",
  "membership_version": 1,
  "idempotent_replay": false,
  "preference_version": 3
}
INTEGRATION DECISION
CALLER ACTION
Accept the returned representation or receipt, then re-read the active workspace to reconcile the preference version.
RETRY SAFETY
Do not repeat a successful mutation merely to confirm it. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Persist returned identifiers, versions, commitments, and receipts. Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
400The JSON body or required signed headers are malformed.Request must change · JSON RESPONSE+
{
  "code": "invalid_json",
  "message": "The JSON body or required signed headers are malformed."
}
INTEGRATION DECISIONinvalid_json
CALLER ACTION
Rebuild the request from the live OpenAPI operation and correct the rejected method, media type, header, parameter, or body field.
RETRY SAFETY
Do not retry the same invalid request. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Compare the submitted values with the documented constraints before another call. Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.
401The bearer credential or HTTP Message Signature is missing, expired, replayed, or invalid.Authentication required · JSON RESPONSE+
{
  "code": "invalid_credentials",
  "message": "The bearer credential or HTTP Message Signature is missing, expired, replayed, or invalid."
}
INTEGRATION DECISIONinvalid_credentials
CALLER ACTION
Discard the rejected credential, complete the documented authentication or reassertion flow, and rebuild any request signature with fresh timestamps and nonces.
RETRY SAFETY
Retry only with a newly valid credential and fresh replay-protection values. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Assume the outcome is unknown only when the connection failed after transmission; otherwise authentication failed before domain work. Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.
403The principal lacks the required scope, workspace role, or tenant authority.Authority or policy denied · JSON RESPONSE+
{
  "code": "workspace_forbidden",
  "message": "The principal lacks the required scope, workspace role, or tenant authority."
}
INTEGRATION DECISIONworkspace_forbidden
CALLER ACTION
Verify the exact scope, tenant or workspace membership, owner boundary, step-up purpose, feature policy, and resource eligibility. Never broaden authority automatically.
RETRY SAFETY
Do not retry until the missing authority or policy condition has been deliberately resolved with least privilege.
STATE RECONCILIATION
Confirm the caller and resource resolve to the same authority boundary for tenant-bound workspaces, memberships, invitations, roles, preferences, revisions, and lifecycle receipts.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.
404The workspace, invitation, or membership was not found in the caller's authority boundary.Resource not visible · JSON RESPONSE+
{
  "code": "workspace_not_found",
  "message": "The workspace, invitation, or membership was not found in the caller's authority boundary."
}
INTEGRATION DECISIONworkspace_not_found
CALLER ACTION
Verify the canonical identifier and authenticated owner boundary. A 404 may intentionally conceal a resource outside the caller's authority.
RETRY SAFETY
Do not retry the unchanged identifier repeatedly. Refresh the relevant collection or lookup before choosing another identifier.
STATE RECONCILIATION
Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.
409The idempotency body, invitation state, or optimistic membership version conflicts with current state.State reconciliation required · JSON RESPONSE+
{
  "code": "workspace_conflict",
  "message": "The idempotency body, invitation state, or optimistic membership version conflicts with current state."
}
INTEGRATION DECISIONworkspace_conflict
CALLER ACTION
Stop the mutation sequence and fetch the latest authoritative resource, lifecycle state, version, ETag, reservation, or existing idempotency result.
RETRY SAFETY
Retry only after reconciling the conflict. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions.
STATE RECONCILIATION
Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.
503The authoritative Identity workspace service is unavailable.Dependency unavailable or outcome uncertain · JSON RESPONSE+
{
  "code": "identity_security_unavailable",
  "message": "The authoritative Identity workspace service is unavailable."
}
INTEGRATION DECISIONidentity_security_unavailable
CALLER ACTION
Preserve the exact request and treat the outcome as uncertain until authoritative state proves whether it committed.
RETRY SAFETY
Reconcile before retrying. For one logical mutation, retain the same Idempotency-Key and byte-equivalent request. Never reuse that key for changed instructions. Use bounded backoff with jitter.
STATE RECONCILIATION
Refresh the workspace, active roster, invitation, membership and preference versions, role, tenant binding, and idempotent mutation receipt.
ESCALATE WHEN
Escalate when membership, invitation, role, optimistic version, tenant isolation, or last-administrator safety remains inconsistent.

OPERATIONAL NOTES

Security and lifecycle guarantees

  • The selected workspace must already have an active membership for the caller.
  • The tenant cannot be selected independently of that membership. A byte-equivalent retry with the same Idempotency-Key returns the retained selection.
DOCUMENTATION STATUS

This route is implemented in canonical gateway source and appears in the production OpenAPI snapshot observed 2026-09-11T06:35:11.572Z. Authentication, tenant, feature, venue, and market policy still apply.

Verify the exact production OpenAPI operation Return to the V2 directory