Saltar al contenido

Accept an invite

Módulo Identity

POST/invites/acceptinvites.accept

Accepts an invite for the confirmed sign-in it was sent to, through `app.accept_invite`: joins the organization, or reuses the active membership, and receives the role. Refused with 422 when the token is invalid or the inviter no longer holds `org.members.invite`. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.

  • Requiere la capacidad me.account.write.
  • Alcances de OAuth: me.
  • Envía el encabezado Idempotency-Key. Una repetición con la misma clave devuelve la respuesta original.
  • Estados de error: 400, 401, 409, 422, 429. Los errores son detalles de problema RFC 9457.

Cuerpo de la solicitud: InviteTokenRequest

invites.accept: InviteTokenRequest
CampoTipoObligatorioDescripción
tokenstringSíInvite token from the invitation email. Sent in the body, never in a URL.Restricciones: length 1 to any
{
  "token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"
}

Respuesta 200: AcceptInviteResult

invites.accept: AcceptInviteResult
CampoTipoObligatorioDescripción
membership_idstring (uuid)SíIdentifier of the membership joined or reused.
{
  "membership_id": "0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
}

Ejemplos de código

curl -X POST "$XOS_BASE_URL/invites/accept" \
  -H "Authorization: Bearer $XOS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"token":"xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"}'
const { data } = await xos.invites.accept({
    "token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"
  });
response = xos.invites.accept({"token": "xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"})
xos invites accept --data '{"token":"xinv_3f9a1c0d7e2b4a6f8c1d0e9b7a5c3f1e"}'