# Create a Client

`POST /lokta-lms/api/v1/clients`

Note:

1. You can enter either:firstname/middlename/lastname - for a person (middlename is optional) OR fullname - for a business or organisation (or person known by one name).

2.If address is enable(enable-address=true), then additional field called address has to be passed.

Mandatory Fields: firstname and lastname OR fullname, officeId, active=true and activationDate OR active=false, if(address enabled) address

Optional Fields: groupId, externalId, accountNo, staffId, mobileNo, savingsProductId, genderId, clientTypeId, clientClassificationId

## Request body (application/json)
- `activationDate` (string)
- `active` (boolean)
- `address` (array of ClientAddressRequest): Address requests
- `datatables` (array of PostClientsDatatable): List of PostClientsDatatable
- `dateFormat` (string)
- `dateOfBirth` (string)
- `emailAddress` (string)
- `externalId` (string)
- `firstname` (string)
- `fullname` (string)
- `groupId` (integer)
- `lastname` (string)
- `legalFormId` (integer)
- `locale` (string)
- `middlename` (string)
- `mobileNo` (string)
- `officeId` (integer)
- `submittedOnDate` (string)

## Responses
- `200`: OK

## Response fields
- `clientId` (integer)
- `groupId` (integer)
- `officeId` (integer)
- `resourceExternalId` (string)
- `resourceId` (integer)

## Example request (cURL)
```bash
curl -X POST \
  'http://localhost:8080/lokta-lms/api/v1/clients' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "activationDate": "04 March 2009",
  "active": true,
  "address": [
    {
      "addressId": 1,
      "addressLine1": "string",
      "addressLine2": "string",
      "addressLine3": "string"
    }
  ],
  "datatables": [
    {
      "data": "data",
      "registeredTableName": "Client Beneficiary information"
    }
  ],
  "dateFormat": "dd MMMM yyyy",
  "dateOfBirth": "19 August 2026",
  "emailAddress": "test@test.com",
  "externalId": "123",
  "firstname": "Client_FirstName",
  "fullname": "Client of group"
}'
```

## Example response
```json
{
  "clientId": 2,
  "groupId": 1,
  "officeId": 1,
  "resourceExternalId": "123-456"
}
```

Interactive: https://developer.lokta.ai/reference.html#operation/createClient
