Run in Apidog
📖 Descrição# Cria um novo funcionário na empresa. 🎯 Exemplo Prático Detalhado # Cenário : Empresa com identify_key: "document" (CPF obrigatório){
"name" : "Ana Silva" ,
"document" : "12345678901" ,
"email" : "ana@empresa.com" ,
"phone" : "11987654321" ,
"internal_id" : "EMP001" ,
"fields" : [
{ "id" : "uuid-filter-departamento" , "value" : "TI" } ,
{ "id" : "uuid-filter-cargo" , "value" : "Desenvolvedora" }
] ,
"include_campaign" : true ,
"is_on_leave" : false
} Resultado : ✅ Status 201 Created{
"data" : {
"id" : "9c73a4aa-8094-4241-ad05-658436f471fe" ,
"name" : "Ana Silva" ,
"document" : "12345678901" ,
"email" : "ana@empresa.com" ,
"internal_id" : "EMP001" ,
"created_at" : "2024-01-01T10:00:00+00:00"
}
} ❌ BEATRIZ SOUZA - Falhará na validação # {
"name" : "Beatriz Souza" ,
"document" : "123" ,
"email" : "beatriz@empresa.com" ,
"fields" : [
{ "id" : "uuid-filter-departamento" , "value" : "RH" }
] ,
"include_campaign" : true ,
"is_on_leave" : false
} Resultado : ❌ Status 422 Validation Error{
"id" : "validation-error-uuid" ,
"status" : 422 ,
"title" : "Validation Error" ,
"detail" : "The document format is invalid" ,
"meta" : {
"errors" : {
"document" : [ "The document format is invalid." ]
}
}
} 🔑 Campos Condicionais (Identify Key) # Identify Key Campo Obrigatório Validação documentCPF (11 dígitos) Algoritmo brasileiro + unicidade global emailEmail válido RFC 5322 + unicidade global internal_idMatrícula unicidade global
🆔 UUID de Retorno # O POST retorna o UUID do funcionário criado :Use este UUID para PUT e DELETE
Exemplo: PUT /v1/employees/9c73a4aa-8094-4241-ad05-658436f471fe
Exemplo: DELETE /v1/employees/9c73a4aa-8094-4241-ad05-658436f471fe
📋 Fields Obrigatórios # Todos os filtros com is_required=true devem estar presentes. 1.
Primeiro : Liste os filtros obrigatórios:
2.
Depois : Inclua todos no array fields (escolha um formato):
Formato ID + Value (Recomendado):{
"fields" : [
{ "id" : "uuid-filter-departamento" , "value" : "TI" } ,
{ "id" : "uuid-filter-cargo" , "value" : "Desenvolvedor" }
]
} Formato Key + Value (Alternativo):{
"fields" : [
{ "key" : "departamento" , "value" : "TI" } ,
{ "key" : "cargo" , "value" : "Desenvolvedor" }
]
} 👤 Criação sem Document # Se identify_key ≠ DOCUMENT : Funcionário pode ser criado sem CPF
Se identify_key = DOCUMENT : CPF obrigatório e deve ser válido (11 dígitos)
{
"name" : "Carlos Silva" ,
"email" : "carlos@empresa.com" ,
"document" : null ,
"fields" : [ ...]
} 🔗 Links Relacionados# Requisição Forneça seu token bearer no cabeçalho Authorization
ao fazer requisições para recursos protegidos. Exemplo: Authorization: Bearer ********************
Parâmetros Body application/json
{
"name" : "Maria Santos Silva" ,
"social_name" : "Maria Santos" ,
"email" : "maria@empresa.com" ,
"phone" : "11987654321" ,
"document" : "98765432109" ,
"internal_id" : "FUNC001" ,
"birthdate" : "15/03/1985" ,
"hiring_date" : "01/06/2020" ,
"fields" : [
{
"id" : "uuid-filter-departamento" ,
"value" : "Recursos Humanos"
} ,
{
"id" : "uuid-filter-cargo" ,
"value" : "Analista"
} ,
{
"id" : "uuid-filter-cidade" ,
"value" : "São Paulo"
}
] ,
"include_campaign" : true ,
"is_on_leave" : false ,
"id_leader_key" : "98765432108"
} Exemplos de Requisição
curl --location --request POST 'https://scenic-tokyo-3bje4ahyb4rd.on-vapor.com/api/v1/employees' \
--header 'Resource-Id: 9c73a4aa-8094-4241-ad05-658436f471fe' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Maria Santos Silva",
"social_name": "Maria Santos",
"email": "maria@empresa.com",
"phone": "11987654321",
"document": "98765432109",
"internal_id": "FUNC001",
"birthdate": "15/03/1985",
"hiring_date": "01/06/2020",
"fields": [
{
"id": "uuid-filter-departamento",
"value": "Recursos Humanos"
},
{
"id": "uuid-filter-cargo",
"value": "Analista"
},
{
"id": "uuid-filter-cidade",
"value": "São Paulo"
}
],
"include_campaign": true,
"is_on_leave": false,
"id_leader_key": "98765432108"
}' Respostas application/json
✅ Funcionário criado com sucesso
{
"data" : {
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
"name" : "string" ,
"social_name" : "string" ,
"email" : "user@example.com" ,
"phone" : "string" ,
"document" : "stringstrin" ,
"internal_id" : "string" ,
"language" : "pt_br" ,
"birthdate" : "2019-08-24T14:15:22Z" ,
"hiring_date" : "2019-08-24T14:15:22Z" ,
"firing_date" : "2019-08-24T14:15:22Z" ,
"is_voluntary_firing" : true ,
"reason_firing" : "string" ,
"is_on_leave" : true ,
"fields" : [
{
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
"value" : "string"
}
] ,
"created_at" : "2019-08-24T14:15:22Z" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"id_leader_key" : "string"
}
}
Modificado em 2025-12-08 22:09:26