Build payments into your product with TPE virtual. Start integrating →
Logo

Workspaces

List the workspaces an API key can act inside and select one per request.

A trader account owns one or more workspaces. Every resource — payment instances, links, forms, transactions — belongs to exactly one, and each request acts inside exactly one.

List workspaces

Returns every workspace this API key can reach, oldest first.

MethodEndpoint
GET/workspaces
Request
curl https://api.mytpe.app/api/ext/workspaces \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET"
200 OK
{
  "data": [
    {
      "id": "7f3a1b2c-8d9e-4f01-a2b3-c4d5e6f70819",
      "name": "Boutique Centrale",
      "is_owner": true,
      "is_active": true
    },
    {
      "id": "9b1c2d3e-4f50-4a61-b2c3-d4e5f6a70b81",
      "name": "Boutique Annexe",
      "is_owner": false,
      "is_active": false
    }
  ]
}

Response fields

FieldTypeDescription
idstring (UUID)The value to send in X-Workspace-Id.
namestringDisplay name. Not unique — never key off it.
is_ownerbooleantrue when this account owns the workspace, false when it reaches it through a membership.
is_activebooleantrue for the workspace this request resolved to. Exactly one entry is true.

is_active tells you the current default without a second request. Call GET /workspaces with no X-Workspace-Id and whichever entry comes back true is what every other endpoint uses by default.

Select a workspace

Send the id in the X-Workspace-Id header. Every endpoint accepts it.

Request
curl https://api.mytpe.app/api/ext/instances \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET" \
  -H "X-Workspace-Id: 9b1c2d3e-4f50-4a61-b2c3-d4e5f6a70b81"

Omit the header and the API uses your earliest workspace. There is no "all workspaces" view — a request always resolves to exactly one.

Naming a workspace this key can't reach returns 403:

403 Forbidden
{
  "errors": [
    {
      "status": "403",
      "code": "WORKSPACE_ACCESS_DENIED",
      "title": "You do not have access to the requested workspace.",
      "detail": "The X-Workspace-Id value names a workspace this account cannot reach. Omit the header to use your default workspace.",
      "meta": []
    }
  ]
}

What scoping affects

Selecting a workspace changes what a request can see and create:

AreaEffect
ListsGET /instances, /links, /forms return only that workspace's rows.
ReadsFetching an id from another workspace returns 404, not 403, so the API never confirms it exists.
CreatesNew resources belong to the selected workspace.

A resource created in one workspace is invisible from another. A 404 on an id you know exists almost always means the request resolved to a different workspace — check X-Workspace-Id before anything else.

On this page