Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Workspaces

Flat groups of principals, such as a team or a customer. The principal who creates one is its owner, and a workspace always keeps an owner.

Workspaces explains members, owners, and invitations.

Paths are relative to https://api.agentpost.tools/v1/identity, and every request follows the API basics. Who may call explains each kind of caller.

Create a workspace

POST /workspaces

Creates a workspace.

  • Who may call: Your server or a signed-in principal.
  • Access: A principal becomes the owner of what it creates. A trusted caller names the owner with ownerId. Every caller is held to the workspaces.maxOwnedPerPrincipal limit when it is set.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.create(input)
  • Idempotency-Key: optional. Retrying a write has the rule.

Body

Name Type Required Description
name string Yes 1–120 characters.
metadata object No
ownerId string No A principal ID, prn_….

Response

201 Created, with WorkspaceWithMembership.

Errors

Any operation can also answer with the codes Conventions lists.

List workspaces

GET /workspaces

The caller’s workspaces, with their membership. A trusted caller lists every workspace.

  • Who may call: A signed-in principal or your server.
  • Credential: the examples send a signed-in principal’s session token, agp_st_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.list(query)
  • Pages: limit, 1 to 500, default 100, with next and after. Lists has the rule.

Query parameters

Name Type Required Description
limit integer No 1–500; default 100.
after string No 1–64 characters.

Response

200 OK, with:

Name Type Present Description
workspaces WorkspaceWithMembership array Always
next string When set

Errors

Any operation can also answer with the codes Conventions lists.

Get a workspace

GET /workspaces/:id

One workspace, with the caller’s membership.

  • Who may call: A signed-in principal or your server.
  • Access: Needs identity.workspace:view in the workspace.
  • Credential: the examples send a signed-in principal’s session token, agp_st_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.get(id)

Path parameters

Name Type Required Description
id string Yes A workspace ID, wsp_…. The id of a Workspace.

Response

200 OK, with WorkspaceWithMembership.

Errors

Any operation can also answer with the codes Conventions lists.

Update a workspace

PATCH /workspaces/:id

Renames a workspace or changes its metadata.

  • Who may call: Your server or a signed-in principal.
  • Access: Needs identity.workspace:update.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.patch(id, patch)
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A workspace ID, wsp_…. The id of a Workspace.

Body

Name Type Required Description
name string No 1–120 characters.
metadata object No

Response

200 OK, with:

Name Type Present Description
workspace Workspace Always

Errors

Any operation can also answer with the codes Conventions lists.

Archive a workspace

POST /workspaces/:id/archive

Archives a workspace. Its memberships, its grants, and the delegations and resource roles in it stop granting anything; a project role still applies. It can’t be renamed and takes no new members, invitations, grants, or delegations. Your server, or a project role that allows it, can still change or remove its members, and any member may leave it. It can’t be undone, so ask the principal to confirm it on your own screen first.

  • Who may call: Your server or a signed-in principal.
  • Access: Needs identity.workspace:archive.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.archive(id)
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A workspace ID, wsp_…. The id of a Workspace.

Response

200 OK, with:

Name Type Present Description
workspace Workspace Always

Errors

Any operation can also answer with the codes Conventions lists.

Leave a workspace

POST /workspaces/:id/leave

The caller leaves a workspace. The last owner can’t.

  • Who may call: A signed-in principal.
  • Credential: the examples send a signed-in principal’s session token, agp_st_…, as Authorization: Bearer <token>.
  • SDK: client.workspaces.leave(id)
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A workspace ID, wsp_…. The id of a Workspace.

Response

204 No Content, with no body.

Errors

Any operation can also answer with the codes Conventions lists.

The WorkspaceWithMembership object

Name Type Present Description
workspace Workspace Always
membership Membership When set

The Workspace object

Name Type Present Description
id string Always A workspace ID, wsp_….
name string Always
status "active" or "archived" Always
metadata object Always
createdAt string Always An ISO 8601 date and time.
createdBy string Always A principal ID, prn_…, or "trusted_caller".
updatedAt string Always An ISO 8601 date and time.
archivedAt string When set An ISO 8601 date and time.