Add Sub-Account User

Invite a user to any sub-account in your agency with a specified role.

POST

Add Sub-Account User

Invite a user to any sub-account that belongs to your agency. Creates an invitation, sends the email via your agency’s Resend config, and returns a confirmation.

Idempotent refresh: If an unaccepted invitation already exists for the same email + sub_account_id, the existing invitation is refreshed (new token, new 7-day expiry, role/name updated) rather than duplicated.

Endpoint

POST https://crmwebhook.com/functions/v1/crm-api/add-subaccount-user

Headers

HeaderValueRequired
X-API-Key or AuthorizationAgency API key (cfy_...)Required
Content-Typeapplication/jsonRequired

Request Body

{
  "email": "user@example.com",
  "role": "sub_account_user",
  "sub_account_id": "8f3b1c4d-1111-2222-3333-444455556666",
  "first_name": "Jane",
  "last_name": "Doe",
  "phone": "+15551234567"
}

Body Parameters

FieldTypeRequiredDescription
emailstringRequiredEmail address of the invitee. Stored lowercased.
rolestringRequiredOne of: sub_account_owner, sub_account_admin, sub_account_user
sub_account_idstring (UUID)RequiredTarget sub-account. Must belong to the API key’s organization.
first_namestringOptionalUsed in the invitation email
last_namestringOptionalUsed in the invitation email
phonestringOptionalStored on the invitation row

Allowed Roles

ValueDisplay Name
sub_account_ownerAccount Owner
sub_account_adminAccount Admin
sub_account_userAccount User

Example — Minimal

curl -X POST https://crmwebhook.com/functions/v1/crm-api/add-subaccount-user \
  -H "X-API-Key: cfy_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "role": "sub_account_user",
    "sub_account_id": "8f3b1c4d-1111-2222-3333-444455556666"
  }'

Example — With name and phone

curl -X POST https://crmwebhook.com/functions/v1/crm-api/add-subaccount-user \
  -H "X-API-Key: cfy_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@example.com",
    "role": "sub_account_admin",
    "sub_account_id": "8f3b1c4d-1111-2222-3333-444455556666",
    "first_name": "Jane",
    "last_name": "Doe",
    "phone": "+15551234567"
  }'

Response Shape

{
  "message": "Invitation is sent to user@example.com"
}

Response Codes

StatusMeaning
201Invitation created and email sent
400Missing required field, invalid email format, or invalid role
401Missing or invalid API key
403Sub-account belongs to a different organization, or user limit reached
404Sub-account ID not found
502Invitation created but email failed to send (invitation token still returned for retry)
© 2026 Centerfy AI. All rights reserved.