create_collaborator function creates a Firebase Authentication user and writes a document to the u_collaborators Firestore collection. Collaborators are users who operate under a parent client account.
Endpoint
Request body
All fields are nested under a top-leveldata key.
Required fields
Full name of the collaborator.
Email address. Used as the Firebase Authentication login credential.
Initial password for the Firebase Authentication account. Not stored in Firestore.
UID of the parent client (
u_clients document ID) this collaborator belongs to.Optional fields
Contact phone number.
Account status. Set to
true (boolean) by the validate_user_email function when the collaborator confirms their email.Account classification used for role-based access checks by
validate_user_type.Government-issued identification number.
Type of identification document.
Address fields
City. Stored under
address.city in Firestore.Country. Stored under
address.country in Firestore.Street address line. Stored under
address.line in Firestore.Postal code. Stored under
address.zipcode in Firestore.Example request
What is written to Firestore
The function writes a document tou_collaborators/{uid} with the following structure:
The document ID in Firestore is the Firebase Authentication UID. The
client field stores the UID of the parent client document in u_clients. The password field is never written to Firestore.Response
Success
Confirmation message including the new UID.
200 on success.Error
Account activation
Collaborator accounts are typically created with an inactive status and activated through email confirmation. After creation, callvalidate_user_email with the collaborator’s uid and email to verify the address and set status to true in Firestore.