InvitationsПринять инвайт (debug)

Принять инвайт (debug)

Для отладки/curl-тестов. В реальном flow accept происходит автоматически в better-auth databaseHooks.user.create.after: находится pending инвайт по email, создаются PolicyGroupMembership, инвайт помечается accepted. Этот endpoint вызывает ту же логику для уже существующего User.

curl -X POST "https://policy-engine-rest.ezig.workers.dev/api/v1/invitations/accept-debug" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "user": {
    "id": "example_string",
    "email": "user@example.com"
  }
}'
{
  "invitation": {
    "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"
  },
  "membershipsCreated": 42
}
POST
/api/v1/invitations/accept-debug
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
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
userobject
Required

Responses

invitationobject
Required
membershipsCreatedinteger
Required