World · Invites
3 operations tagged world.invites.
world_invites_get
GET /api/v1/world/invites
List pending world invites received by or sent from the caller. Lists pending world invites, newest first. perspective=received (default) returns invites addressed to the caller; perspective=sent returns invites the caller issued for the given world and requires the caller to own it. Before listing, overdue pending invites in scope are marked expired (and their inbox rows synced), so this GET can mutate invite state.
Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key (X-Api-Key, or Authorization: Bearer; when both are sent, Authorization is used) or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.
Authorization (ROUTE_AUTH_POLICIES; GET /api/v1/account lists the operations your credential passes):
world_invites_get: callershuman,external_agent; scopesworld:read; mutation classnone.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
perspective | query | no | "received" | "sent" | |
worldId | query | no | string | Required when perspective=sent; ignored for received. |
Responses
-
200: Pending invites with invitedDisplayName; subject is not included.
application/json{ "type": "object", "required": [ "invites" ], "properties": { "invites": { "type": "array", "items": { "$ref": "#/components/schemas/WorldInviteRow" } } } } -
400: Invalid perspective, or worldId missing for sent.
application/json{ "type": "object", "properties": { "error": { "type": "string" } } } -
401: Also returned by the handler when the identity has no user id.
application/json{ "oneOf": [ { "$ref": "#/components/schemas/AesErrorEnvelope" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "const": "unauthorized" } } } ] } -
403: perspective=sent and caller is not the world owner.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: perspective=sent and world not found. Error codes:
world_not_found.application/json{ "type": "object", "properties": { "error": { "const": "World not found" }, "code": { "const": "world_not_found" } } } -
429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
500: Internal error.
application/json{ "type": "object", "properties": { "error": { "const": "Internal server error" } } }
Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, WorldInviteRow
app/api/v1/world/invites/route.ts (confidence: high).
world_invites_post
POST /api/v1/world/invites
Invite a user to a world you own. Issues a direct-user invite to a world the caller owns, proposing a viewer or editor role, with an optional message and expiry. The world may be given by worldId or by handle '@owner/worldName'; the invitee by platform user id (preferred) or by a username that is matched case-insensitively against username, display name, contact email, or user id. Creates the invite and the invitee's inbox row in one transaction. Structurally idempotent: a second pending invite for the same world, user and role returns 409.
Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key (X-Api-Key, or Authorization: Bearer; when both are sent, Authorization is used) or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.
Authorization (ROUTE_AUTH_POLICIES; GET /api/v1/account lists the operations your credential passes):
world_invites_post: callershuman,external_agent; scopesworld:write; mutation classnone.
Request body (application/json, required)
{
"type": "object",
"required": [
"proposedRole"
],
"anyOf": [
{
"required": [
"worldId"
]
},
{
"required": [
"worldHandle"
]
}
],
"allOf": [
{
"anyOf": [
{
"required": [
"invitedUsername"
]
},
{
"required": [
"invitedUserId"
]
}
]
}
],
"properties": {
"worldId": {
"type": "string",
"description": "Preferred over worldHandle."
},
"worldHandle": {
"type": "string",
"description": "@ownerUsername/worldName (leading @ optional)."
},
"invitedUserId": {
"type": "string",
"description": "Directory-resolved platform user id; tried first."
},
"invitedUsername": {
"type": "string",
"description": "Leading @ stripped; matched case-insensitively against username, display_name, contact_email, or user_id."
},
"proposedRole": {
"type": "string",
"enum": [
"viewer",
"editor"
]
},
"message": {
"type": [
"string",
"null"
]
},
"expiresAt": {
"type": [
"string",
"null"
],
"format": "date-time",
"description": "Not validated by the handler; an unparseable value fails at the database (500)."
}
}
}Responses
-
201: Invite created.
application/json{ "type": "object", "required": [ "invite" ], "properties": { "invite": { "$ref": "#/components/schemas/WorldInviteRow" } } } -
400: Invalid JSON, missing world, missing invitee, or invalid proposedRole.
application/json{ "type": "object", "properties": { "error": { "type": "string" } } } -
401: Also returned by the handler when the identity has no user id.
application/json{ "oneOf": [ { "$ref": "#/components/schemas/AesErrorEnvelope" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "const": "unauthorized" } } } ] } -
403: Caller is not the world owner.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: World or invited user not found. Error codes:
world_not_found,invited_user_not_found.application/json{ "type": "object", "properties": { "error": { "type": "string" }, "code": { "type": "string", "enum": [ "world_not_found", "invited_user_not_found" ] } } } -
409: A pending invite for this user and role already exists. Error codes:
duplicate_pending.application/json{ "type": "object", "properties": { "error": { "type": "string" }, "code": { "const": "duplicate_pending" } } } -
429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
500: Internal error (transaction rolled back).
application/json{ "type": "object", "properties": { "error": { "const": "Internal server error" } } }
Schemas used: #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, WorldInviteRow
app/api/v1/world/invites/route.ts (confidence: high).
world_invite_lifecycle_patch
PATCH /api/v1/world/invites/{inviteId}
Accept, decline, revoke or expire a world invite. Applies a lifecycle action to a world invite. accept (invitee only) closes the invite and creates or reactivates an active membership with the proposed role; decline (invitee only) closes it; revoke (issuing owner only) closes it with an optional reason; expire marks an overdue pending invite expired. Each transition also syncs the invitee's inbox row. Terminal invites return 409; a pending invite whose expiry has passed is treated as terminal 'expired' for accept/decline/revoke.
Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key (X-Api-Key, or Authorization: Bearer; when both are sent, Authorization is used) or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.
Authorization (ROUTE_AUTH_POLICIES; GET /api/v1/account lists the operations your credential passes):
world_invite_lifecycle_patch: callershuman,external_agent; scopesworld:write; mutation classnone.
Confirmation. This operation deletes data. For a request whose body action is 'revoke', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
inviteId | path | yes | string | |
X-Starholder-Confirmation | header | no | string | The confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once. |
Request body (application/json, required)
{
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"decline",
"revoke",
"expire"
]
},
"reason": {
"type": [
"string",
"null"
],
"description": "Used only for revoke."
}
}
}Responses
-
200: accept -> {membership}; decline -> {status:'declined'}; revoke -> {status:'revoked'}; expire -> {status:'expired'}.
application/json{ "oneOf": [ { "type": "object", "required": [ "membership" ], "properties": { "membership": { "$ref": "#/components/schemas/WorldMembershipRow" } } }, { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "declined", "revoked", "expired" ] } } } ] } -
400: Invalid JSON or action.
application/json{ "type": "object", "properties": { "error": { "type": "string" } } } -
401: Also returned by the handler when the identity has no user id.
application/json{ "oneOf": [ { "$ref": "#/components/schemas/AesErrorEnvelope" }, { "type": "object", "required": [ "error" ], "properties": { "error": { "const": "unauthorized" } } } ] } -
403: Caller is not the invitee (accept/decline) or not the issuer (revoke).
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
404: Invite not found. Error codes:
invite_not_found.application/json{ "type": "object", "properties": { "error": { "const": "Invite not found" }, "code": { "const": "invite_not_found" } } } -
409: Invite already terminal (currentStatus included), or expire requested before expiry. Error codes:
already_terminal,invite_not_overdue.application/json{ "type": "object", "properties": { "error": { "type": "string" }, "code": { "type": "string", "enum": [ "already_terminal", "invite_not_overdue" ] }, "currentStatus": { "type": "string", "enum": [ "accepted", "declined", "revoked", "expired" ] } } } -
428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.
application/json{ "$ref": "#/components/schemas/ConfirmationChallenge" } -
429: Per-key or per-actor quota exceeded (ERR_QUOTA_EXCEEDED). Honor Retry-After.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" } -
500: Internal error.
application/json{ "type": "object", "properties": { "error": { "const": "Internal server error" } } } -
503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.
application/json{ "$ref": "#/components/schemas/AesErrorEnvelope" }
Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/ConfirmationUnavailable, #/components/responses/Forbidden, #/components/responses/RateLimited, #/components/responses/Unauthenticated, WorldMembershipRow
app/api/v1/world/invites/[inviteId]/route.ts (confidence: high).