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. Find out the requirements and how to use this API in your account in this article.
⚠️ Attention: API integration requires advanced technical knowledge, therefore, it's important to have the help 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's important to include a valid API key in the request header. This helps to ensure the security and correct processing of the information. See an example:
var headers = {
'x-api-key': 'YOUR-API-KEY',
'Content-Type': 'application/json'
}
Endpoint
The Endpoint for this API is available at: 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 corresponding prospect. If the prospect already exists, the previous lead data will not be returned. For the retail industry only.
Send Insurance Lead
Production API server: https://conversion.zenvia.com/#operation/newInsuranceLead
Processes lead data and returns the corresponding prospect. If the prospect already exists, the previous lead data will not be returned. For the insurance industry only.
Send Automotive Lead
Production API server: https://conversion.zenvia.com/#operation/newVehicleLead
Processes lead data and returns the corresponding prospect. If the prospect already exists, the previous lead data will not be returned. For the automotive (vehicles) industry only.
Send Saving Plan Lead
Production API server: https://conversion.zenvia.com/#operation/newSavingPlanLead
Processes lead data and returns the corresponding prospect. If the prospect already exists, the previous lead data will not be returned. For the savings/investment plan industry only.
Send Real Estate Lead
Production API server: https://conversion.zenvia.com/#operation/newRealEstateLead
Processes lead data and returns the corresponding prospect. If the prospect already exists, the previous lead data will not be returned. For the real estate industry only.
Response
202 ACCEPTED
{
"message": "Lead accepted",
"code": "202",
"correlationId": "{Generated UUID for webhook reference}"
}
It is important for the user to save the **correlationId** to correlate the response that will be sent later 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 successfully sends a lead, a correlationId will be provided and here it will be used to correlate the response to the post made by the client. 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.",