π Create a New Lead Using API
Step 1: Generate an API Key
Go to:
{{workspaceUrl}}/workspace-config?tab=api-keyGenerate
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: Get Client Role ID
π Endpoint:
{{URL}}/roles?type=company
π οΈ Set Headers:
x-api-key: <API_KEY>
companyId: <COMPANY_ID>
π₯ Response Example:
{
"roles": [
{
"_id": "6525994184e9ddd798534535",
"role": {
"_id": "6525994184e9ddd79853451e",
"responsibility": "",
"name": "client"
},
"company": "6525994184e9ddd79853450e",
"createdAt": "2023-10-10T18:34:41.567Z",
"updatedAt": "2024-10-01T07:28:48.340Z",
"__v": 0,
"type": "company"
}
]
}
π What to Do:
Find the role where
roles[0].role.name === "client"
.Extract and store the Client Role ID:
const clientRoleId = "ROLE_ID_HERE"; // Replace with actual ID
Important: Ensure you do not copy
_id
fromroles[0].role
, but fromroles[0]
itself.
Step 4: Create a New Lead
π 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]",
"role": "ROLE_ID_HERE",
"isConvertedClient": false,
"status": "New",
"contactNo": "1234567890",
"source": "website",
"positionInBoard": 1,
"isConvertedClient": false
}
]
β
Success Response:
{
"message": "Lead created successfully",
"createdMembers": [
{
"_id": "NEW_MEMBER_ID",
"name": "John Doe",
"status": "New",
"role": "client"
}
]
}
β Important Tips:
Ensure
"isConvertedClient": false
is set in the request.Use the correct Role ID from Step 3.
Last updated
Was this helpful?