How to create Lead via API

πŸš€ Create a New Lead Using API

Step 1: Generate an API Key

  1. Go to:

Copy

{{workspaceUrl}}/workspace-config?tab=api-key
  1. Generate and Copy the API key.


Step 2: Get Company ID

πŸ“ Endpoint:

Copy

{{URL}}/accounts/companies

πŸ› οΈ Set Headers:

Copy

x-api-key = api Key

You'll get a response like this

Copy

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

πŸ“ What to Do:

  • Get the company ID from the response:

Copy

  • Store the ID for later:

Copy


Step 3: Get Client Role ID

πŸ“ Endpoint:

Copy

πŸ› οΈ Set Headers:

Copy

You'll get a response like this

Copy

πŸ“ What to Do:

  • Find the role with "client" name:

Copy

  • Store the Client Role ID:

Copy

Make sure that you did not copy the _id of roles[0].role object


Step 4: Create a New Lead

πŸ“ Endpoint:

Copy

πŸ› οΈ Headers:

Copy

πŸ“¦ Request Body:

Copy


βœ… Success Response:

Copy


❗ Important Tips:

  • Make sure "isConvertedClient": false is set in the request.

  • Use the correct Role ID from Step 3.

Last updated

Was this helpful?