v1

latestOpenAPI 3.0.02026-07-14800227.2 KB
Employees

Create a new employee.

This endpoint creates a deactivated employee in Kenjo (isActive = false). To activate the employee use the put /activate method; an activation message will be sent to the employee email to complete the activation through the onboarding wizard. <br><br>Required body <br>You must send the objects account, personal and work with at least: <br>account: email (required, must be unique in the organization). <br>personal: firstName and lastName (required, non-empty strings). <br>work: companyId and weeklyHours (required). <br>If any of these are missing or invalid (e.g. empty name, duplicate email), the API returns 400 Bad Request and no employee is created. <br><br>Optional fields and defaults <br>workSchedule — Optional. If you omit it, the API uses the company's working days. If the company has no working days defined, it defaults to Monday–Friday. <br>language (inside account) — Optional. If omitted, the company's default language is assigned. <br><br>Custom fields <br>You can send custom fields for the personal, work, address, financial and home sections. Use each field's API name (prefix c_ and the field name without spaces). The value must match the type defined for that custom field in Kenjo. <br><br> Example — custom field Activity type in work (List with values "1", "2", "3"): <br>

...
{
...
  "work": {
    "c_Activitytype": "1",
    ...
  },
...
}

<br>If you send a value or type that does not match the field definition, the request returns 400. <br><br>If the operation succeeds, an inactive employee is created and the response includes the provided information and the Kenjo _id for the new employee.

post/employees

Headers

Authorizationstring required
Example:Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5rZW5qby5pbyIsInN1YiI6IjYwZjBhOTE2MjE0OTg3MjU2YmU5YzhmZiIsImF1ZCI6Imh0dHBzOi8vYXBpLmtlbmpvLmlvIiwiaWF0IjoxNjI2Mzg1MTE1LCJuYmYiOjE2MjYzODUxMTUsImV4cCI6MTYyNjU1NzkxNSwiYWNjZXNzVHlwZSI6IkFwaUFjY2VzcyIsInNfb3JnSWQiOiI2MGYwNGVhN2RmN2JhMjFlY2U0YmYzYzIifQ.cxG_7dIS-VbmDXdJuLkekoyuyCIzQG2fMcgc0nkfbWE8cihhcb5FnALbQkjU9b5-qVcEoMHZlSuUA-jMEBMMVQ

A valid bearer token.

Request body

Example request

{
  "account": {
    "email": "john@acme.io",
    "language": "es",
    "externalId": "E-000001"
  },
  "personal": {
    "firstName": "John",
    "lastName": "Doe",
    "displayName": "John Doe",
    "gender": "Male",
    "birthdate": "1980-01-28T00:00:00.000Z",
    "nationality": "Spanish"
  },
  "work": {
    "companyId": "50a2db290da29e126a187894",
    "officeId": "50a2db290da29e126a187895",
    "departmentId": "50a2db290da29e126a187896",
    "startDate": "2022-01-01T00:00:00.000Z",
    "jobTitle": "Actor",
    "workPhone": "+34 666 70 90 32",
    "workMobile": "+34 680 70 90 32",
    "probationPeriodEnd": "2022-06-01T00:00:00.000Z",
    "contractEnd": "2030-06-01T00:00:00.000Z",
    "reportsToId": "50a2db290da29e126a1878523",
    "weeklyHours": 40,
    "weeklyDays": 5
  },
  "workSchedule": {
    "mondayWorkingDay": true,
    "tuesdayWorkingDay": true,
    "wednesdayWorkingDay": true,
    "thursdayWorkingDay": true,
    "fridayWorkingDay": true,
    "saturdayWorkingDay": true,
    "sundayWorkingDay": true,
    "trackAttendance": true
  },
  "address": {
    "street": "Calle Enrique San Francisco 13",
    "postalCode": "28080",
    "city": "Madrid",
    "country": "ES",
    "houseNumber": "1-F",
    "additionalAddress": "Calle Henry Francisco 14"
  },
  "financial": {
    "accountHolderName": "Michael Corleone",
    "bankName": "Bank of Sicily",
    "accountNumber": "0093 344 2132221 3304 00",
    "iban": "DE32120222391919191911",
    "swiftCode": "12321234",
    "nationalId": "04123547X",
    "passport": "FA1234098",
    "nationalInsuranceNumber": "23123312321",
    "taxCode": "323451R",
    "taxIdentificationNumber": "T4312345"
  },
  "home": {
    "maritalStatus": "Widowed",
    "spouseFirstName": "Catherine",
    "spouseLastName": "Tramell",
    "spouseBirthdate": "2060-01-26T00:00:00.000Z",
    "spouseGender": "Female",
    "personalEmail": "john@acme.io",
    "personalPhone": "4567092323",
    "personalMobile": "3567092310",
    "children": [
      {
        "childFirstName": "John",
        "childLastName": "Doe",
        "childBirthdate": "2020-01-01T00:00:00.000Z",
        "childGender": "Male"
      }
    ]
  },
  "emergency": {
    "emergencyFirstName": "John",
    "emergencyMiddleName": "Doe",
    "emergencyLastName": "Doe",
    "relation": "Mother",
    "emergencyPhoneNumber": "+34 666 70 90 32",
    "emergencyMobileNumber": "+34 680 70 90 32"
  }
}

Response

CREATED

Example response

{
  "account": {
    "_id": "50a2db290da29e126a187843",
    "email": "john@acme.io",
    "externalId": "E-000001",
    "language": "es"
  },
  "personal": {
    "firstName": "John",
    "lastName": "Doe",
    "displayName": "John Doe",
    "gender": "Male",
    "birthdate": "1980-01-28T00:00:00.000Z",
    "nationality": "Spanish"
  },
  "work": {
    "companyId": "50a2db290da29e126a187894",
    "officeId": "50a2db290da29e126a187895",
    "departmentId": "50a2db290da29e126a187896",
    "startDate": "2022-01-01T00:00:00.000Z",
    "jobTitle": "Actor",
    "workPhone": "+34 666 70 90 32",
    "workMobile": "+34 680 70 90 32",
    "probationPeriodEnd": "2022-06-01T00:00:00.000Z",
    "contractEnd": "2030-06-01T00:00:00.000Z",
    "reportsToId": "50a2db290da29e126a1878523",
    "weeklyHours": 40
  },
  "workSchedule": {
    "mondayWorkingDay": true,
    "tuesdayWorkingDay": true,
    "wednesdayWorkingDay": true,
    "thursdayWorkingDay": true,
    "fridayWorkingDay": true,
    "saturdayWorkingDay": true,
    "sundayWorkingDay": true,
    "trackAttendance": true
  },
  "address": {
    "street": "Calle Enrique San Francisco 13",
    "postalCode": "28080",
    "city": "Madrid",
    "country": "ES",
    "houseNumber": "1-F",
    "additionalAddress": "Calle Henry Francisco 14"
  },
  "financial": {
    "accountHolderName": "Michael Corleone",
    "bankName": "Bank of Sicily",
    "accountNumber": "0093 344 2132221 3304 00",
    "iban": "DE32120222391919191911",
    "swiftCode": "12321234",
    "nationalId": "04123547X",
    "passport": "FA1234098",
    "nationalInsuranceNumber": "23123312321",
    "taxCode": "323451R",
    "taxIdentificationNumber": "T4312345"
  },
  "home": {
    "maritalStatus": "Widowed",
    "spouseFirstName": "Catherine",
    "spouseLastName": "Tramell",
    "spouseBirthdate": "2060-01-26T00:00:00.000Z",
    "spouseGender": "Female",
    "personalEmail": "john@acme.io",
    "personalPhone": "4567092323",
    "personalMobile": "3567092310",
    "children": [
      {
        "childFirstName": "John",
        "childLastName": "Doe",
        "childBirthdate": "2020-01-01T00:00:00.000Z",
        "childGender": "Male"
      }
    ]
  },
  "emergency": {
    "emergencyFirstName": "John",
    "emergencyMiddleName": "Doe",
    "emergencyLastName": "Doe",
    "relation": "Mother",
    "emergencyPhoneNumber": "+34 666 70 90 32",
    "emergencyMobileNumber": "+34 680 70 90 32"
  }
}