Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

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 dev secret key, sk_test_…, as Authorization: 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

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 dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.invitations.list(workspaceId, query)
  • Pages: limit, 1 to 500, default 100, with next and after. 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

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 dev secret key, sk_test_…, as Authorization: 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

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 dev secret key, sk_test_…, as Authorization: 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

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 dev secret key, sk_test_…, as Authorization: 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

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_…, as Authorization: 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

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.id string Always An invitation ID, inv_….
invitation.role string Always
invitation.channel "email" or "code" Always
invitation.email string When set
invitation.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".
invitation.status string Always One of "pending", "accepted", "revoked", or "expired".
invitation.expiresAt string Always An ISO 8601 date and time.
workspace object Always
workspace.id string Always A workspace ID, wsp_….
workspace.name string Always
invitedBy object When set
invitedBy.id string Always A principal ID, prn_….
invitedBy.displayName string When set A supplied name, 1 to 120 characters. Your app decides what to show when absent.
invitedBy.avatarUrl string When set

The InvitationAccepted object

Name Type Present Description
membership Membership Always
workspace Workspace Always