Skip to content

Add Employee

Request URL

POST /customer/add-employee

Description

This endpoint can be used to add an employee to a business customer. The term "employee" refers to an individual entity who is employed by the business customer. The term "business representative" refers to an entity that is specifically designated as a principal owner or authorized signer for the business.

Before an individual can be added to a business as an employee, the potential employee must first exist in the connectFi system as an individual customer entity. Therefore, a /customer/init request with "customerType": "individual" and the potential employee's details in the customer personal object is a pre-requisite to making a /customer/add-employee request.

After adding the potential employee to the connectFi system using /customer/init, the individual customerId that is returned will be included as the "employeeId" in the /customer/add-employee request. The business customerId will be included as the "companyId" in the /customer/add-employee request.

Schema

Property table for customer/add-employee

Property Description Required Schema
companyId Business customer ID in connectFi Yes {
  "type": "string",
  "pattern": "^[0-9a-zA-Z_]+$",
  "minLength": 1,
  "maxLength": 36,
  "description": "common-id"
}
employeeId Individual customer ID in connectFi Yes {
  "type": "string",
  "pattern": "^[0-9a-zA-Z_]+$",
  "minLength": 1,
  "maxLength": 36,
  "description": "common-id"
}
position The employee's position within the company Yes {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 1,
  "maxLength": 50,
  "isNotOnlyWhitespace": true,
  "description": "common-commonStr50Req"
}

Request Body

{
    "companyId": "cstab_7BX5DO49J48VeWKsJ6gWNb",
    "position": "Engineer 1",
    "employeeId": "cstap_5XVGshc9neQlcWlslzN8H0"
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "companyId": "cstab_7BX5DO49J48VeWKsJ6gWNb",
    "position": "Engineer 1",
    "employeeId": "cstap_5XVGshc9neQlcWlslzN8H0"
};
const config = {
  method: 'POST',
  url: '${CONNECTFI_BASE_URL}/customer/add-employee',
  headers: {
    'Content-Type': "application/json",
    'x-connectfi-token': "A long random string token received from /auth/get-token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "CONNECTFI_BASE_URL/customer/add-employee" --data "{    \"companyId\":\"cstab_7BX5DO49J48VeWKsJ6gWNb\",   \"position\":\"Engineer 1\",   \"employeeId\":\"cstap_5XVGshc9neQlcWlslzN8H0\"}" --header "Content-Type: application/json" --header "x-connectfi-token: A long random string token received from /auth/get-token request" 

Successful Response Examples

200 SUCCESSFUL RESPONSE

HEADERS

Header Value
Content-Type application/json
x-connectfi-token A long random string token received from /auth/get-token request

REQUEST BODY

{
    "companyId": "cstab_7BX5DO49J48VeWKsJ6gWNb",
    "position": "Engineer 1",
    "employeeId": "cstap_6reGTr3k8vpAu8uFV7EdiN"
}

RESPONSE BODY

{
    "code": "0",
    "data": {
        "reference": "ExtRefBCust100",
        "customerId": "cstab_7BX5DO49J48VeWKsJ6gWNb",
        "customerType": "business",
        "employees": [
            {
                "id": "cstap_6reGTr3k8vpAu8uFV7EdiN",
                "position": "Engineer 1"
            }
        ]
    },
    "requestId": "266a92107fe911ee9b7427220cc6c212"
}