Skip to main content
Creates a Firebase Authentication user and writes a document to the u_clients Firestore collection. Clients represent organizations or individuals that own events on the platform.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/create_client

Request body

All parameters are nested under a data key.

Identity fields

data.name
string
required
Full legal name of the client.
data.email
string
required
Email address. Used as the Firebase Authentication login credential.
data.password
string
required
Initial password for the Firebase Authentication account. Not stored in Firestore.
data.phone
string
Contact phone number.
data.status
string
Account status (for example, active or inactive).
data.id
string
Government-issued identification number.
data.id_type
string
Type of identification document (for example, passport, national_id, rif).
data.account_type
string
Account classification used for access control and billing.

Address fields

data.city
string
City. Stored under address.city in Firestore.
data.country
string
Country. Stored under address.country in Firestore.
data.line
string
Street address line. Stored under address.line in Firestore.
data.zip_code
string
Postal code. Stored under address.zipcode in Firestore.

Commercial and fiscal fields

data.name_commercial
string
Trading or commercial name of the organization.
data.commercial_registry
string
Company registration number.
data.commercial_license
string
Commercial operating license identifier.
data.last_assembly_minutes
string
Reference to the most recent shareholders’ meeting minutes document.
data.fiscal_info
string
Tax identification or fiscal registry information.
data.taxpayer_type
string
Taxpayer classification (for example, ordinary, special).
Name or identifier of the legal representative.
data.contact_person
string
Primary contact person for the account.
data.bank_accounts
array
List of bank account objects associated with the client.

Example

curl -X POST https://{region}-{project}.cloudfunctions.net/create_client \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "name": "Acme Events S.A.",
      "email": "[email protected]",
      "password": "SecurePass123!",
      "phone": "+58-212-555-0100",
      "status": "active",
      "id": "J-12345678-9",
      "id_type": "rif",
      "account_type": "business",
      "city": "Caracas",
      "country": "Venezuela",
      "line": "Av. Principal, Edificio Centro, Piso 3",
      "zip_code": "1060",
      "name_commercial": "Acme Events",
      "commercial_registry": "RM-2024-00123",
      "commercial_license": "LIC-2024-456",
      "fiscal_info": "J-12345678-9",
      "taxpayer_type": "ordinary",
      "legal_representative": "María González",
      "contact_person": "Carlos Pérez",
      "bank_accounts": []
    }
  }'

Response

message
string
Confirmation message including the new UID.
status
number
200 on success, 400 on error.
data
object
Success (200):
{
  "message": " Ingresado con el ID: abc123xyz .",
  "status": 200,
  "data": {
    "uid": "abc123xyz"
  }
}
Error (400):
{
  "message": "Error creando nuevo usuario:",
  "status": 400,
  "data": {
    "error": {
      "code": "auth/email-already-exists",
      "message": "The email address is already in use by another account."
    }
  }
}
If auth.createUser() fails, no Firestore document is written. The function returns 400 and stops. Check for duplicate email addresses before calling this endpoint.

Firestore document

On success, a document is written to u_clients/{uid} with the following structure:
{
  "name": "Acme Events S.A.",
  "email": "[email protected]",
  "name_commercial": "Acme Events",
  "phone": "+58-212-555-0100",
  "status": "active",
  "id": "J-12345678-9",
  "id_type": "rif",
  "address": {
    "city": "Caracas",
    "country": "Venezuela",
    "line": "Av. Principal, Edificio Centro, Piso 3",
    "zipcode": "1060"
  },
  "account_type": "business",
  "commercial_registry": "RM-2024-00123",
  "commercial_license": "LIC-2024-456",
  "last_assembly_minutes": null,
  "fiscal_info": "J-12345678-9",
  "taxpayer_type": "ordinary",
  "legal_representative": "María González",
  "contact_person": "Carlos Pérez",
  "bank_accounts": [],
  "date": {
    "create": "<Firestore Timestamp>",
    "last_access": "",
    "last_update": ""
  },
  "data": {
    "collaborators": 0,
    "contracts": 0,
    "events": 0
  }
}
The password field is never written to Firestore. The data counters (collaborators, contracts, events) are initialized to 0 and updated by other platform functions as the client’s activity grows.

Build docs developers (and LLMs) love