care-team-invite-canonical

Invite To Care Team

Invite a person to a child's care team by email.

Caller must be a family member of the child OR a clinician with active access. The server branches on the recipient's account type:

  • active clinician → grant + clinician care team row (connected_clinician)
  • non-clinician account → canonicalize + worker care team row + synthetic claimed invite code (connected_worker)
  • no account → create care team row + active invite code, dispatch email (invite_sent)

Idempotent on (email, child_id): a re-invite returns already_on_team with the existing ids. When care_team_member_id is supplied (the Connect surfaces always know it), the RPC matches the existing contact by that id first - so adding or correcting a saved contact's email re-invites the same record instead of forking a duplicate.

post/care-team/invite

Request

  • Base URL
    https://api.projectindi.com (the document declares no server; this is the origin it was published from)
  • Auth
    none declared

Request body

child_idstring required
emailstring required
first_namestring nullable
last_namestring nullable
role_valuestring nullable
care_team_member_idstring nullable
surface'wizard_panel' | 'connect_sheet' | 'resend' nullable

Response

Successful Response

outcome'connected_clinician' | 'connected_worker' | 'invite_sent' | 'already_on_team' required

Mirrors the RPC's jsonb outcome field verbatim.

Stable strings - UI copy keys off them. Adding a new branch is a migration + enum extension in lockstep.

child_care_team_idstring nullable
care_team_member_idstring nullable
clinician_access_idstring nullable
invite_codestring nullable
expires_atstring nullable
recipient_user_idstring nullable
email_status'not_applicable' | 'sent' | 'failed'

Tri-state outcome for the B3 email dispatch.

Replaces an earlier email_sent: bool that collapsed three real states into two: not_applicable (B1/B2/already_on_team, where no email is ever attempted), sent (B3 dispatch succeeded), and failed (B3 dispatch errored - the invite row still exists, so the caller can offer a re-send affordance without re-running the whole RPC). Keeps the contract explicit while the API is pre-consumer.

recipient_display_namestring nullable
recipient_organisation_namestring nullable
convertedboolean

Changes

No recorded changes to this operation across all 2 revisions of this API.