Integration with Save Leads

I’m trying to save the leads using the API. I first used the login api to generate the bearer token with the generated token I accessed api/v1/save-data but I get the below response
{
“status”: 401,
“message”: “Unauthorised Key”
}

this is my raw request

{
“module_name”: “Lead”,
“field_name_list”: {
“last_name”: “Shastri”,
“phone”: “9090667986”,
“email”: “liladhar@enjayworld.com”,
“party_comments_c” : “EchoVME”,
“party_comment_c” : “Product Name 1”,
“other_source”:“Essential Oil”,
“lead_source”:“Website”,
“assigned_user_id” : “0242db93-7908-4675-ad40-4146dd8bf018”,
“status” : “Assigned”
}
}

what is the issue here

Hello sir,

Your request format should be as follows:

{
“rest_data”: {
“module_name”: “Lead”,
“name_value_list”: {
“last_name”: “Shastri”,
“phone”: “9090667986”,
“email”: “liladhar@enjayworld.com”,
“party_comments_c”: “EchoVME”,
“party_comment_c”: “Product Name 1”,
“other_source”: “Essential Oil”,
“lead_source”: “Website”,
“assigned_user_id”: “0242db93-7908-4675-ad40-4146dd8bf018”,
“status”: “Assigned”
}
}
}

Hi Mayuri,

still the same issue after trying with your suggestion

{
“status”: 401,
“message”: “Unauthorised Key”
}

Hello sir,

Could you please verify if the login token was passed in the headers?

I created a lead using the following request on https://fnfsurplus.sangamcrm.com/

Request :

{
“rest_data”: {
“module_name”: “Lead”,
“name_value_list”: {
“last_name”: “Shastri”,
“phone_primary”: “9090667986”,
“email_primary”: “liladhar@enjayworld.com”,
“status”: “Assigned”,
“assigned_user_id”: “1”
}
}
}

Hi Mayuri,

I was using a wrong API endpoint URL. After changing it, I see the Leads are created successfully.

Thanks for your support, much appreciated

1 Like

Welcome, Sir.

And thank you so much for the update.