This API was developed with the purpose of providing an asynchronous way to send leads to Zenvia Conversion, allowing you to receive a webhook containing the results. Learn about the requirements and how to use this API in your account in this article.
⚠️ Attention: Integrating an API requires advanced technical knowledge, so it's important to seek the assistance of a developer.
Authentication
Requests made to the API must include a valid API key as a header parameter. For example:
To access the API, it is important to include a valid API key in the header of requests. This helps ensure security and the correct processing of information. Here's an example:
var headers = {
'x-api-key': 'YOUR-API-KEY',
'Content-Type': 'application/json'
}
Endpoint
O Endpoint desta API está disponível em: https://conversion.zenvia.com/#tag/Leads
Request
Send Retail Lead
Production API server: https://conversion.zenvia.com/#operation/newRetailLead
Processes lead data and returns the matching prospect. If the prospect already exists previous lead data will not be returned. Retail industry only.
Send Insurance Lead
Production API server: https://conversion.zenvia.com/#operation/newInsuranceLead
Processes lead data and returns the matching prospect. If the prospect already exists, previous lead data will not be returned. Insurance industry only.
Send Automotive Lead
Production API server: https://conversion.zenvia.com/#operation/newVehicleLead
Processes lead data and returns the matching prospect. If the prospect already exists, previous lead data will not be returned. Automotive (vehicle) industry only.
Send Saving Plan Lead
Production API server: https://conversion.zenvia.com/#operation/newSavingPlanLead
Processes lead data and returns the matching prospect. If the prospect already exists, previous lead data will not be returned.Saving plan industry only.
Send Real Estate Lead
Production API server: https://conversion.zenvia.com/#operation/newRealEstateLead
Processes lead data and returns the matching prospect. If the prospect already exists, previous lead data will not be returned. Real Estate industry only.
Response
202 ACCEPTED
{
"message": "Lead accepted",
"code": "202",
"correlationId": "{Generated UUID for webhook reference}"
}
It is important the the user saves the correlationId in order to correlate the response that will be sent afterwards in the Webhook session.
403 FORBIDDEN
{
"message": "{MESSAGE}",
"error": "Forbidden",
"statusCode": 403
}
Where {MESSAGE} can be:
-
API key is missing
-
There is not any integration available with the API Key provided
-
The API Key provided is disabled
-
This route does not have a scope associated to it
-
The API Key provided has invalid scope: {SCOPE}, you need {SCOPE1} or {SCOPE2} permissions.
-
This integration does not have an assigned group
-
Invalid industry {INDUSTRY}. The API Key provided requires {INDUSTRY1} or {INDUSTRY2}.
400 BAD REQUEST
{
"message": [
"utmSource must be a string"
],
"error": "Bad Request",
"statusCode": 400
}
Webhook
When the client sends a lead successfully, a correlationId will be provided and here it will be used to correlate the response to the post the client made. It has the following format:
{
"response": "{RESPONSE}",
"correlationId": "{Generated UUID for webhook reference}"
}
Where {RESPONSE} has the same format as the response from the v1 API, with one added response:
{
"code": "500",
"message": "The server is temporarily unavailable. Please try again later.",
{RESPONSE} by Type of Lead
Retail Lead Response
Insurance Lead Response
Automotive Lead Response
Saving Plan Lead Response
Real Estate Lead Response