Invitations
Invitations into a workspace, by email or by a code you pass on yourself. A principal previews an invitation, then accepts it.
Workspaces explains invitations by email and by code.
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 an invitation
POST /workspaces/:id/invitations
Invites someone with a role. An email invitation is emailed to the principal; a code invitation answers with its token once.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.invitation:create. Only an owner, or a trusted caller, invites an owner. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.invitations.create(workspaceId, input) - 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 |
|---|---|---|---|
role |
string |
Yes | A role key from the config, such as “member”. |
channel |
"email" or "code" |
Yes | |
email |
string |
No | An email address; up to 254 characters. |
openTo |
string[] |
No | Who may accept: ["principal"], ["guest"], or both. Without it, whoever the role is open to; at least 1. Each is one of "principal" or "guest". |
Response
201 Created, with InvitationCreated.
Errors
conflict(409)forbidden(403)not_found(404)role_not_assignable(422)
Any operation can also answer with the codes Conventions lists.
List invitations
GET /workspaces/:id/invitations
A workspace’s invitations.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.invitation:view. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.invitations.list(workspaceId, query) - Pages:
limit, 1 to 500, default 100, withnextandafter. Lists has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | A workspace ID, wsp_…. The id of a Workspace. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit |
integer |
No | 1–500; default 100. |
after |
string |
No | 1–64 characters. |
status |
string |
No | One of "pending", "accepted", "revoked", or "expired". |
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
invitations |
Invitation array |
Always | |
next |
string |
When set |
Errors
forbidden(403)
Any operation can also answer with the codes Conventions lists.
Resend an invitation
POST /invitations/:id/resend
Sends a pending invitation again, with a new token.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.invitation:resend. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.invitations.resend(id) - Idempotency-Key: optional. Retrying a write has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | An invitation ID, inv_…. The id of a Invitation. |
Response
200 OK, with InvitationCreated.
Errors
conflict(409)forbidden(403)invitation_not_pending(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
Revoke an invitation
DELETE /invitations/:id
Revokes a pending invitation.
- Who may call: Your server or a signed-in principal.
- Access: Needs
identity.invitation:revoke. - Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.invitations.revoke(id) - Idempotency-Key: optional. Retrying a write has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | An invitation ID, inv_…. The id of a Invitation. |
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
invitation |
Invitation |
Always |
Errors
forbidden(403)invitation_not_pending(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
Preview an invitation
POST /invitations/preview
What an invitation token is for: the workspace and the role. Changes nothing.
- Who may call: Your server, anyone, or a signed-in principal.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.invitations.preview(token) - Idempotency-Key: not taken. This operation changes nothing, so IdentityHound runs it on every request and it takes no
Idempotency-Key.
Body
| Name | Type | Required | Description |
|---|---|---|---|
token |
string |
Yes | 16–512 characters. |
Response
200 OK, with InvitationPreviewResponse.
Errors
invitation_invalid(404)invitation_not_pending(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
Accept an invitation
POST /invitations/accept
The signed-in principal accepts an invitation. An email invitation needs that email as a verified identity. An invitation as owner is refused past workspaces.maxOwnedPerPrincipal, and stays pending.
- 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.invitations.accept(token) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
token |
string |
Yes | 16–512 characters. |
Response
200 OK, with InvitationAccepted.
Errors
conflict(409)forbidden(403)invitation_email_mismatch(403)invitation_invalid(404)invitation_not_open(403)invitation_not_pending(409)not_found(404)workspace_limit(403)role_not_assignable(422)
Any operation can also answer with the codes Conventions lists.
The InvitationCreated object
| Name | Type | Present | Description |
|---|---|---|---|
invitation |
Invitation |
Always | |
token |
string |
When set | The code channel’s token, shown once. |
The Invitation object
An invitation as the API shows it: never with its token or hash.
| Name | Type | Present | Description |
|---|---|---|---|
id |
string |
Always | An invitation ID, inv_…. |
workspaceId |
string |
Always | A workspace ID, wsp_…. |
role |
string |
Always | |
channel |
"email" or "code" |
Always | |
email |
string |
When set | |
openTo |
string[] |
When set | Who may accept: guest, principal (any principal that is not a guest), or both. Without it, whoever the role is open to. Each is one of "principal" or "guest". |
status |
string |
Always | One of "pending", "accepted", "revoked", or "expired". |
invitedBy |
string |
Always | A principal ID, prn_…, or "trusted_caller". |
createdAt |
string |
Always | An ISO 8601 date and time. |
expiresAt |
string |
Always | An ISO 8601 date and time. |
acceptedBy |
string |
When set | A principal ID, prn_…. |
acceptedAt |
string |
When set | An ISO 8601 date and time. |
revokedAt |
string |
When set | An ISO 8601 date and time. |
revokedBy |
string |
When set | A principal ID, prn_…, or "trusted_caller". |
The InvitationPreviewResponse object
| Name | Type | Present | Description |
|---|---|---|---|
invitation |
object |
Always | |
invitation. |
string |
Always | An invitation ID, inv_…. |
invitation. |
string |
Always | |
invitation. |
"email" or "code" |
Always | |
invitation. |
string |
When set | |
invitation. |
string[] |
When set | Who may accept: guest, principal (any principal that is not a guest), or both. Without it, whoever the role is open to. Each is one of "principal" or "guest". |
invitation. |
string |
Always | One of "pending", "accepted", "revoked", or "expired". |
invitation. |
string |
Always | An ISO 8601 date and time. |
workspace |
object |
Always | |
workspace. |
string |
Always | A workspace ID, wsp_…. |
workspace. |
string |
Always | |
invitedBy |
object |
When set | |
invitedBy. |
string |
Always | A principal ID, prn_…. |
invitedBy. |
string |
When set | A supplied name, 1 to 120 characters. Your app decides what to show when absent. |
invitedBy. |
string |
When set |
The InvitationAccepted object
| Name | Type | Present | Description |
|---|---|---|---|
membership |
Membership |
Always | |
workspace |
Workspace |
Always |