👨‍🔬Create a New Client

Step 1: Generate an API Key

  1. Go to: {{workspaceUrl}}/workspace-config?tab=api-keyGenerate

  2. Copy the API key.

Step 2: Get Company ID

📍 Endpoint:

{{URL}}/accounts/companies

🛠️ Set Headers:

x-api-key: <API_KEY>

📥 Response Example:

{
  "message": "Companies associated with API token.",
  "companies": [
    {
      "_id": "6525994184e9ddd79853450e",
      "name": "onethread123",
      "logo": "",
      "extraSmallLogo": "",
      "largeLogo": ""
    }
  ]
}

📝 What to Do:

  • Extract the Company ID from the response: companies[0]._id.

  • Store the ID for later use:

    const companyId = "COMPANY_ID_HERE"; // Replace with actual ID

Step 3: Create a New Client

📍 Endpoint:

{{URL}}/company/{{companyId}}/members/bulk-client

🛠️ Set Headers:

x-api-key: <API_KEY>
companyId: <COMPANY_ID>

📦 Request Body:

[
    {
      "firstName": "John",
      "lastName": "Doe",
      "email": "[email protected]",
      "isConvertedClient": false,
      "status": "New",
      "contactNo": "1234567890",
      "source": "website",
      "positionInBoard": 1
    }
]

✅ Success Response:

{
  "message": "Lea created successfully",
  "createdMembers": [
    {
      "_id": "NEW_MEMBER_ID",
      "name": "John Doe",
      "status": "New",
      "role": "client"
    }
  ]
}

Last updated

Was this helpful?