Clients - Protected

Create client

Create a new client with proper data separation.

This endpoint follows the correct client creation pattern:

  1. Client basic info goes to Cliente table (nome, nif, contacto, etc.)
  2. Email goes to Emails table (id_modulo=12, id_modulo_id=client_id)
  3. Address goes to Moradas table (id_modulo=12, id_modulo_id=client_id)

Automatically assigns the client to the authenticated user's company. Validates NIF uniqueness within the company.

post/api/clients

Headers

x-api-tokenstring nullable

Request body

nomestring required
emailstring nullable
contactostring nullable
nifinteger nullable

Tax ID (unique per company)

ccstring nullable

ID card number

validade_ccstring date nullable

ID card validity

entidade_emissora_ccstring nullable
particularboolean

True=Individual, False=Company

recorrenteboolean

Is recurring client

carta_conducaostring nullable
data_carta_conducaostring date nullable
ibanstring nullable
iban_alimentarstring nullable
paisstring nullable
moradastring nullable
codigo_postalstring nullable
localidadestring nullable
cidadestring nullable
id_pontodevendainteger nullable
id_estado_civilinteger nullable
id_tipo_casainteger nullable
id_contrato_trabalhointeger nullable
tipo_idinteger nullable
agregado_familiarinteger nullable
creditos_ativosinteger nullable
mensalidade_casanumber nullable
antiguidade_empresainteger nullable
mensalidade_creditosnumber nullable
vencimento_liquidonumber nullable
foreign_nifstring nullable

Foreign tax ID

Response

Successful Response

idinteger required
nomestring required
emailstring nullable
contactostring nullable
nifinteger nullable
ccstring nullable
validade_ccstring date nullable
entidade_emissora_ccstring nullable
particularboolean
recorrenteboolean
carta_conducaostring nullable
data_carta_conducaostring date nullable
ibanstring nullable
iban_alimentarstring nullable
paisstring nullable
moradastring nullable
codigo_postalstring nullable
localidadestring nullable
cidadestring nullable
idcompanyinteger nullable
id_pontodevendainteger nullable
id_estado_civilinteger nullable
id_tipo_casainteger nullable
id_contrato_trabalhointeger nullable
tipo_idinteger nullable
agregado_familiarinteger nullable
creditos_ativosinteger nullable
mensalidade_casanumber nullable
antiguidade_empresainteger nullable
mensalidade_creditosnumber nullable
vencimento_liquidonumber nullable
foreign_nifstring nullable
IDinteger nullable
Nomestring nullable
NIFinteger nullable
Contactostring nullable
CCstring nullable
ValidadeCCstring nullable
EntidadeEmissoraCCstring nullable
CartaConducaostring nullable
DataCartaConducaostring nullable

Changes

No recorded changes to this endpoint across all 1 revision of this API.