members.dev
Docs
Portal auth

Verify portal login code

Public. Verifies the Magic Auth code with WorkOS, provisions a local Account when needed, and returns a Members access JWT plus an opaque refresh token (tok_…). organization_id selects the tenant (WorkOS org) for the session. Open-signup orgs grant member access automatically; closed orgs require invite_token. Missing org role alone is not an error for new signups.

POST
/v1/auth/verify-code

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://api.members.dev/portal/v1/auth/verify-code" \  -H "Content-Type: application/json" \  -d '{    "email": "user@example.com",    "code": "string",    "organization_id": "org_01KKSMB47VYGW97GFE67VGDK7M"  }'
{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "Bearer",
  "expires_in": 0,
  "expires_at": 0,
  "account": {
    "id": "string",
    "short_id": "string",
    "email": "user@example.com",
    "first_name": "string",
    "last_name": "string",
    "created_at": null,
    "updated_at": null
  }
}
{
  "type": "https://api.members.dev/errors/invalid_credentials",
  "title": "Invalid credentials",
  "status": 401,
  "detail": "Invalid API Key or token.",
  "code": "invalid_credentials"
}
{
  "type": "https://api.members.dev/errors/not_linked_to_tenant",
  "title": "Not linked to tenant",
  "status": 403,
  "detail": "Not linked to this tenant",
  "code": "not_linked_to_tenant"
}
{
  "type": "https://api.members.dev/errors/member_not_found",
  "title": "Member not found",
  "status": 404,
  "detail": "No member exists with the given id in this organization.",
  "code": "member_not_found"
}
{
  "type": "https://api.members.dev/errors/members_context_required",
  "title": "Members context required",
  "status": 422,
  "detail": "This client has multiple organizations. Send the Members-Context header with the organization id (org_…) for this request.",
  "code": "members_context_required"
}
{
  "type": "https://api.members.dev/errors/rate_limit_exceeded",
  "title": "Rate limit exceeded",
  "status": 429,
  "detail": "Rate limit exceeded",
  "code": "rate_limit_exceeded"
}