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 theworkspaces.maxOwnedPerPrincipallimit when it is set. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: 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
conflict(409)forbidden(403)not_found(404)role_not_assignable(422)workspace_limit(403)
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_…, asAuthorization: Bearer <token>. - SDK:
client.workspaces.list(query) - Pages:
limit, 1 to 500, default 100, withnextandafter. 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
forbidden(403)
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:viewin the workspace. - Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: 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
devsecret key,sk_test_…, asAuthorization: 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
devsecret key,sk_test_…, asAuthorization: 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_…, asAuthorization: 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
forbidden(403)last_owner(409)not_a_member(404)
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. |