Skip to main content

invitations

Creates, updates, deletes, gets or lists an invitations resource.

Overview

Nameinvitations
TypeResource
Idclickhouse.members.invitations

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uuid)Unique invitation ID.
assigned_rolesarrayCustom roles and System roles that will be assigned to the user when they accept the invitation (wire: assignedRoles)
created_atstring (date-time)Invitation creation timestamp. ISO-8601. (wire: createdAt)
emailstring (email)Email of the invited user. Only a user with this email can join using the invitation. The email is stored in a lowercase form.
expire_atstring (date-time)Timestamp the invitation expires. ISO-8601. (wire: expireAt)
rolestringDEPRECATED. Use assignedRoles instead. Role of the invited user in the organization. For organizations that have migrated to custom roles, this field is frozen at the pre-migration value and does not reflect the role assignment that will be applied. (admin, developer)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinvitation_id, organization_idReturns details for a single organization invitation.
listselectorganization_idReturns list of all organization invitations.
createinsertorganization_idCreates organization invitation.
deletedeleteinvitation_id, organization_idDeletes a single organization invitation.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
invitation_idstring (uuid)ID of the requested organization. (wire: invitationId)
organization_idstringClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID)

SELECT examples

Returns details for a single organization invitation.

SELECT
id,
assigned_roles,
created_at,
email,
expire_at,
role
FROM clickhouse.members.invitations
WHERE invitation_id = '{{ invitation_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
;

INSERT examples

Creates organization invitation.

INSERT INTO clickhouse.members.invitations (
email,
role,
assigned_role_ids,
organization_id
)
SELECT
'{{ email }}',
'{{ role }}',
'{{ assigned_role_ids }}',
'{{ organization_id }}'
RETURNING
request_id,
result,
status
;

DELETE examples

Deletes a single organization invitation.

DELETE FROM clickhouse.members.invitations
WHERE invitation_id = '{{ invitation_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
;