v3

Act as a business you represent, or as yourself

Points the caller's session at a business, or back at themselves with an empty businessId. Every other endpoint reads the acting context off the credential rather than accepting it in a request, so this is the only way to change it. The session, its refresh chain and its device binding are unchanged — switching is not a new sign-in.

PUT/api/v3/users/me/acting-context

Send two credentials: your own, and the customer's.

How authentication works
Yours
x-api-keyorAuthorization: Bearer
The customer's
User-Authorization: BearerorUser-Identifier

Language

Environment

Credentials

Your credential

The customer's credential

Choose an environment first.

cURL request
curl -X PUT https://api.btcdirect.eu/api/v3/users/me/acting-context \  -H "x-api-key: $BTCD_API_KEY" \  -H "User-Authorization: Bearer $BTCD_USER_TOKEN" \  -H "Content-Type: application/json" \  -d '{    "businessId": "4f1d0f6e-9b7a-4c31-8a2e-6d5b0c9e7f14"  }'
Choose an environment to run this.

Response

The new access token.
{  "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5ZmM",  "actingBusinessId": "4f1d0f6e-9b7a-4c31-8a2e-6d5b0c9e7f14"}

Request

businessIdstring

The business to act as. Omit or send empty to act as yourself again.

Example4f1d0f6e-9b7a-4c31-8a2e-6d5b0c9e7f14

Responses

200The new access token.
400No session to switch, or an unparseable id.
401No authenticated customer.
403Not a representative of that business. Deliberately indistinguishable from an unknown business.
503`maintenance` — full maintenance is on, and every endpoint refuses every request until it ends (`endsAt`, when it has an end). Nothing is wrong with the request and nothing was done; the same request is accepted afterwards. Told apart from any other 503 by `code`.

Body of the success response

tokenstringrequired

A fresh access token carrying the new context. The refresh token is unchanged and not reissued.

ExampleeyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5ZmM

actingBusinessIdstring

Echoed back; absent when the session is now personal.

Example4f1d0f6e-9b7a-4c31-8a2e-6d5b0c9e7f14

Every failure answers with a message and a code. Switch on the code — messages are written for people and can change.