InvitationsСоздать приглашение

Создать приглашение

Создаёт pending invitation в Vault со списком групп, в которые юзер попадёт при accept. Валидация: email свободен (нет User и активного инвайта), все группы принадлежат Vault'у. Регистрация в системе возможна ТОЛЬКО по приглашению — better-auth hook блокирует sign-up без него. Инвайты бессрочные (MVP).

curl -X POST "https://policy-engine-rest.ezig.workers.dev/api/v1/invitations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "vaultId": "example_string",
  "email": "new@user.com",
  "groupIds": [
    "example_string"
  ],
  "createdById": "example_string"
}'
{
  "id": "cmr3f41z20001psp7phmyapw3",
  "vaultId": "example_string",
  "email": "new@user.com",
  "status": "pending",
  "createdById": "example_string",
  "acceptedAt": "2026-07-02T11:25:15.134Z",
  "acceptedUserId": "example_string",
  "revokedAt": "2026-07-02T11:25:15.134Z",
  "createdAt": "2026-07-02T11:25:15.134Z",
  "updatedAt": "2026-07-02T11:25:15.134Z",
  "token": "a94aad35339dd6d3a5ca35e1b1ef2f78",
  "groupMemberships": [
    {
      "id": "cmr3f41z20001psp7phmyapw3",
      "invitationId": "example_string",
      "groupId": "example_string",
      "createdAt": "2026-07-02T11:25:15.134Z",
      "group": {
        "id": "example_string",
        "code": "traders",
        "name": "John Doe"
      }
    }
  ]
}
POST
/api/v1/invitations
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

better-auth session token. Мобилка/сервисы. Веб использует cookie.

better-auth session token. Мобилка/сервисы. Веб использует cookie.
API Key (cookie: better-auth.session_token)
Content-Typestring
Required

The media type of the request body

Options: application/json
emailstring
Required
Format: email • Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
groupIdsarray
Required

Группы, в которые юзер попадёт при accept

createdByIdstring

userId пригласившего; не указывается для system-invitations

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. better-auth session token. Мобилка/сервисы. Веб использует cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Body

application/json
emailstring
Required
Example:
new@user.com
groupIdsarray
Required

Группы, в которые юзер попадёт при accept

createdByIdstring

userId пригласившего; не указывается для system-invitations

Responses