### Example Authorization Header Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md An example of a valid Authorization header value for lead submission. ```http Authorization = Bearer sk3bnOJVGQy7LTECXLE_tfCXc8XFeppOL4qoomMBVzCpVjH4ifgFNX064CxCT6wRCN5Z1adnQyev2-S_WqRrojTE_SrfnGsBh2_6Q0rf0xf9shTMx0RgzMVKfGekpNyZ7DAMSIFRpEngxdnH_CF69feDc2gqS675tZtkGVl_0wq3hXutEQrenFzh6LszlVIG ``` -------------------------------- ### POST Request Example for Token Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This example demonstrates the structure of a POST request to obtain an access token. Ensure the Authorization header is correctly formatted with Base64 encoded credentials and the request body includes the grant type, username, and password. ```http POST http://{endpoint}/token Authorization = Basic {api_user:api_password pair in Base64 format} Content-Type = application/x-www-form-urlencoded grant_type = password username = {client_user in Base64 format} password = {client_password in Base64 format} ``` -------------------------------- ### Example Request Body for Leads Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md A populated example of the JSON request body for submitting lead data. This demonstrates how to fill in the fields. ```json { "LeadSource_Name": "Chat", "CompanyName": "Grupo vNext", "DealerName": "Ford vNext", "DealerStoreName": "Ford vNext Perdizes", "ProductType": 1, "ProductBrandName": "Ford", "ProductModelName": "Ecosport", "ProductFullName": "Ford Ecosport 1.6 8V XLT FREESTYLE", "ProductModelYear": "2018", "ProductManufactoringYear":"2018", "ProductColor": "PRETO", "ProductLicencePlate": "ABC-1234", "ProductPrice": "R$ 99.900,00", "CustomerName": "Customer Name", "CustomerEmail": "customeremail@gmail.com", "CustomerPhone": "11 5555 5555", "CustomerMobilePhone": "11 9 9999 9999", "CustomerCity": "São Paulo", "CustomerState": "SP", "CustomerRegion": "Grande São Paulo", "CustomerIPAddress": "127.0.0.1", "CustomerLatitude": "-23.4505519", "CustomerLongiture": "-46.4197219", "CustomerFiscalDocument":"29929929999", "CustomerMessage": "Customer message and other informations", "SellerName": "Nome do vendedor", "SellerEmail": "emaildovendedor@mailserver.com", "SellerErpId": "Código do vendedor no ERP", "SellerStore": "Loja do vendedor", "SellerNotes": "Observações sobre o vendedor", "SellerFiscalDocument":"999999999977", "ChannelName": "Internet", "PrivacyPolicyAccepted" : true, "MarketingContact": "optout", "MarketingContactPreferences": "SMS,EMAIL,WHATSAPP", "TrafficCampaign": "GOOGLE_AD_MAY_OFFERS", "TrafficContent" : "logolink", "TrafficMedium" : "cpc", "TrafficSource" : "google", "TrafficTerm" : "ofertas+de+maio", "TrafficTrackingIdKey": "gclid", "TrafficTrackingIdValue":"CsKCAiAu5agBhBzEiwAdiR5tJxhiZ9qQrmx7t6c5x7sedhtvytluiPR5ZhFgAldMIRPbhJB1JphoCa6IQAvD_BwE" } ``` -------------------------------- ### Base64 Encoded Credentials Example Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Illustrates the Base64 encoding format for API user and password credentials used in the Authorization header and request body. ```text Authorization = Basic dXNlcjpwYXNzd29yZA== username = dXNlcg== password = cGFzc3dvcmQ= ``` -------------------------------- ### Successful Token Response (200 OK) Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Example of a successful response when requesting an access token. It includes the access token, token type, and expiration time. ```json { "access_token": "sk3bnOJVGQy7LTECXLE_tfCXc8XFeppOL4qoomMBVzCpVjH4ifgFNX064CxCT6wRCN5Z1adnQyev2-S_WqRrojTE_SrfnGsBh2_6Q0rf0xf9shTMx0RgzMVKfGekpNyZ7DAMSIFRpEngxdnH_CF69feDc2gqS675tZtkGVl_0wq3hXutEQrenFzh6LszlVIG", "token_type": "bearer", "expires_in": 604799 } ``` -------------------------------- ### Get Dealer Store List Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Retrieves a list of permitted stores for a given dealer. These are used to create leads via the DealerStoreName field. ```APIDOC ## GET /dealerstore/list/{dealer_id} ### Description Retrieves a list of permitted stores for a given dealer (`dealer_id`). These are used to create leads via the DealerStoreName field. ### Method GET ### Endpoint http://{endpoint}/dealerstore/list/{dealer_id} ### Parameters #### Path Parameters - **dealer_id** (integer) - Required - The ID of the dealer to retrieve stores for. ### Request Headers - Authorization: Bearer {token gerado anteriormente em api/token} - Content-Type: application/json ### Response #### Success Response (200) - **id** (integer) - Description - **dealer_Id** (integer) - Description - **company_Id** (integer) - Description - **nickName** (string) - Description #### Response Example ```json [ { "id": 1, "dealer_Id": 1, "company_Id": 27, "nickName": "Turing Jaguar" }, { "id": 2, "dealer_Id": 2, "company_Id": 19, "nickName": "Turing Aston Martin Curitiba" }, { "id": 2, "dealer_Id": 2, "company_Id": 19, "nickName": "Turing Aston Martin Blumenau" } ] ``` #### Error Response (401) - **message** (string) - Description of the error, e.g., invalid or expired token. #### Response Example ```json { "message": "Authorization has been denied for this request." } ``` ``` -------------------------------- ### Get Dealer List Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Retrieves a list of permitted dealerships (brands). These are used to create leads via the DealerName field. ```APIDOC ## GET /dealer/list ### Description Retrieves a list of permitted dealerships (brands). These are used to create leads via the DealerName field. ### Method GET ### Endpoint http://{endpoint}/dealer/list ### Request Headers - Authorization: Bearer {token gerado anteriormente em api/token} - Content-Type: application/json ### Response #### Success Response (200) - **id** (integer) - Description - **company_Id** (integer) - Description - **name** (string) - Description - **brandName** (string) - Description #### Response Example ```json [ { "id": 1, "company_Id": 27, "name": "Turing", "brandName": "Jaguar" }, { "id": 2, "company_Id": 27, "name": "Turing", "brandName": "Aston Martin" } ] ``` #### Error Response (401) - **message** (string) - Description of the error, e.g., invalid or expired token. #### Response Example ```json { "message": "Authorization has been denied for this request." } ``` ``` -------------------------------- ### Unsupported Grant Type Response (400 Bad Request) Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Example of an error response indicating an unsupported grant type was used in the request. This typically occurs if the 'grant_type' parameter is not recognized. ```json { "error": "unsupported_grant_type" } ``` -------------------------------- ### Invalid Grant Response (400 Bad Request) Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Example of an error response when the provided username or password is incorrect. The error code 'invalid_grant' indicates authentication failure. ```json { "error": "invalid_grant", "error_description": "The user name or password is incorrect." } ``` -------------------------------- ### Submit Lead Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Allows the submission of new leads to the system. Requires authentication and specific content type. ```APIDOC ## POST /lead ### Description Allows the submission of new leads to the system. Requires authentication and specific content type. ### Method POST ### Endpoint http://{endpoint}/lead ### Request Headers - **Authorization** (string) - Required - Bearer {token gerado anteriormente em api/token} - **Content-Type** (string) - Required - application/json ### Request Body - **LeadSource_Name** (string) - Required - Origem do lead (consulte [LeadSource (get)](#leadsource)). Max length: 100. - **CompanyName** (string) - Required - Organização ou nome do grupo. Max length: 100. - **DealerName** (string) - Required - Concessionária escolhida pelo cliente (consulte [Dealer (get)](#dealer)). Max length: 100. - **DealerStoreName** (string) - Required - Loja escolhida pelo cliente (consulte [DealerStore (get)](#dealerstore)). Max length: 100. - **ProductType** (integer) - Required - Tipo do produto (consulte a tabela [Tipos de Produtos](#tipos-de-produtos)). - **ProductBrandName** (string) - Optional - Marca do produto. Max length: 50. - **ProductModelName** (string) - Optional - Modelo do produto. Max length: 50. - **ProductFullName** (string) - Optional - Nome completo do produto incluindo marca, modelo e versão. Max length: 100. - **ProductModelYear** (string) - Optional - Ano do modelo do produto. Max length: 4. - **ProductManufactoringYear** (string) - Optional - Ano de fabricação do produto. Max length: 4. - **ProductColor** (string) - Optional - Cor do produto. Max length: 50. - **ProductLicencePlate** (string) - Optional - Placa do produto. Max length: 20. - **ProductPrice** (string) - Optional - Preço do produto. Max length: 50. - **CustomerName** (string) - Optional - Nome do cliente. Max length: 100. - **CustomerEmail** (string) - Optional - Email do cliente. Max length: 100. - **CustomerPhone** (string) - Optional - Telefone do cliente. Max length: 20. - **CustomerMobilePhone** (string) - Optional - Celular do cliente. Max length: 20. - **CustomerCity** (string) - Optional - Cidade do cliente. Max length: 50. - **CustomerState** (string) - Optional - Estado do cliente. Max length: 50. - **CustomerRegion** (string) - Optional - Região do cliente. Max length: 50. - **CustomerIPAddress** (string) - Optional - Endereço IP do cliente. Max length: 45. - **CustomerLatitude** (string) - Optional - Latitude do cliente. Max length: 20. - **CustomerLongiture** (string) - Optional - Longitude do cliente. Max length: 20. - **CustomerFiscalDocument** (string) - Optional - Documento fiscal do cliente. Max length: 20. - **CustomerMessage** (string) - Optional - Mensagem do cliente. Max length: 500. - **SellerName** (string) - Optional - Nome do vendedor. Max length: 100. - **SellerEmail** (string) - Optional - Email do vendedor. Max length: 100. - **SellerErpId** (string) - Optional - Código do vendedor no ERP. Max length: 50. - **SellerStore** (string) - Optional - Loja do vendedor. Max length: 100. - **SellerNotes** (string) - Optional - Observações sobre o vendedor. Max length: 500. - **SellerFiscalDocument** (string) - Optional - Documento fiscal do vendedor. Max length: 20. - **ChannelName** (string) - Optional - Nome do canal. Max length: 50. - **PrivacyPolicyAccepted** (boolean) - Optional - Indica se a política de privacidade foi aceita. - **MarketingContact** (string) - Optional - Contato de marketing. Max length: 50. - **MarketingContactPreferences** (string) - Optional - Preferências de contato de marketing. Max length: 100. - **TrafficCampaign** (string) - Optional - Campanha de tráfego. Max length: 100. - **TrafficContent** (string) - Optional - Conteúdo de tráfego. Max length: 100. - **TrafficMedium** (string) - Optional - Mídia de tráfego. Max length: 50. - **TrafficSource** (string) - Optional - Fonte de tráfego. Max length: 50. - **TrafficTerm** (string) - Optional - Termo de tráfego. Max length: 100. - **TrafficTrackingIdKey** (string) - Optional - Chave de ID de rastreamento de tráfego. Max length: 50. - **TrafficTrackingIdValue** (string) - Optional - Valor de ID de rastreamento de tráfego. Max length: 255. **Note:** A lead must have at least one of the contact fields filled: CustomerEmail, CustomerPhone, CustomerMobilePhone. ### Request Example ```json { "LeadSource_Name": "Chat", "CompanyName": "Grupo vNext", "DealerName": "Ford vNext", "DealerStoreName": "Ford vNext Perdizes", "ProductType": 1, "ProductBrandName": "Ford", "ProductModelName": "Ecosport", "ProductFullName": "Ford Ecosport 1.6 8V XLT FREESTYLE", "ProductModelYear": "2018", "ProductManufactoringYear":"2018", "ProductColor": "PRETO", "ProductLicencePlate": "ABC-1234", "ProductPrice": "R$ 99.900,00", "CustomerName": "Customer Name", "CustomerEmail": "customeremail@gmail.com", "CustomerPhone": "11 5555 5555", "CustomerMobilePhone": "11 9 9999 9999", "CustomerCity": "São Paulo", "CustomerState": "SP", "CustomerRegion": "Grande São Paulo", "CustomerIPAddress": "127.0.0.1", "CustomerLatitude": "-23.4505519", "CustomerLongiture": "-46.4197219", "CustomerFiscalDocument":"29929929999", "CustomerMessage": "Customer message and other informations", "SellerName": "Nome do vendedor", "SellerEmail": "emaildovendedor@mailserver.com", "SellerErpId": "Código do vendedor no ERP", "SellerStore": "Loja do vendedor", "SellerNotes": "Observações sobre o vendedor", "SellerFiscalDocument":"999999999977", "ChannelName": "Internet", "PrivacyPolicyAccepted" : true, "MarketingContact": "optout", "MarketingContactPreferences": "SMS,EMAIL,WHATSAPP", "TrafficCampaign": "GOOGLE_AD_MAY_OFFERS", "TrafficContent" : "logolink", "TrafficMedium" : "cpc", "TrafficSource" : "google", "TrafficTerm" : "ofertas+de+maio", "TrafficTrackingIdKey": "gclid", "TrafficTrackingIdValue":"CsKCAiAu5agBhBzEiwAdiR5tJxhiZ9qQrmx7t6c5x7sedhtvytluiPR5ZhFgAldMIRPbhJB1JphoCa6IQAvD_BwE" } ``` ### Response #### Success Response (200) - **message** (string) - Description of the success message. #### Response Example ```json { "message": "Lead created successfully." } ``` #### Error Response (400) - **message** (string) - Description of the error. #### Error Response Example ```json { "message": "Invalid input data." } ``` ``` -------------------------------- ### Successful Lead Creation Response Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This JSON object represents a successful lead creation. It includes a success status, a confirmation message with the new lead's ID, and type information. ```json { "success": true, "message": "Lead created successfully id: 9999999", "type": "info", "apiType": "LeadCreated" } ``` -------------------------------- ### Lead Source List Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Retrieves a list of allowed lead sources, including their names and categories. This information is used to populate lead source fields when creating new leads. ```APIDOC ## LeadSource List ### Description Retrieves a list of allowed lead sources, including their names and categories. This information is used to populate lead source fields when creating new leads. ### Method GET ### Endpoint http://{endpoint}/leadsource/list ### Request Headers - **Authorization** (string) - Required - Bearer {token gerado anteriormente em api/token} - **Content-Type** (string) - Required - application/json ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the lead source. - **name** (string) - The name of the lead source. - **categories** (array) - A list of categories associated with the lead source. - **id** (integer) - The unique identifier for the category. - **name** (string) - The name of the category. #### Response Example (200) ```json [ { "id": 1, "name": "Webmotors", "categories": [ { "id": 11, "name": "Webmotors Proposta" }, { "id": 12, "name": "Webmotors Financiamento" } ] }, { "id": 2, "name": "iCarros", "categories": [ { "id": 21, "name": "iCarros Proposta" }, { "id": 22, "name": "iCarros Financiamento" } ] }, { "id": 3, "name": "Mercado Livre", "categories": [ { "id": 31, "name": "Mercado Livre Pergunta" } ] } ] ``` #### Error Response (401) - **message** (string) - Description of the error, e.g., "Authorization has been denied for this request." #### Response Example (401) ```json { "message": "Authorization has been denied for this request." } ``` ``` -------------------------------- ### POST Request Method for Leads Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md The HTTP method required for sending lead data. ```http POST ``` -------------------------------- ### POST Request URL for Leads Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Use this URL to send lead data via a POST request. Ensure you replace {endpoint} with your actual endpoint. ```http http://{endpoint}/lead ``` -------------------------------- ### Bad Request Error Response (400) - Missing Contact Information Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This JSON object indicates a bad request because no contact information was provided for the lead. The message lists the acceptable contact fields. ```json { "success": false, "message": "", "type": "error", "apiType": "ModelIsNull" } ``` -------------------------------- ### Successful Lead Source List Response (200) Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This JSON array represents a successful retrieval of lead sources. Each source includes an ID, name, and a list of associated categories, each with its own ID and name. ```json [ { "id": 1, "name": "Webmotors", "categories": [ { "id": 11, "name": "Webmotors Proposta" }, { "id": 12, "name": "Webmotors Financiamento" } ] }, { "id": 2, "name": "iCarros", "categories": [ { "id": 21, "name": "iCarros Proposta" }, { "id": 22, "name": "iCarros Financiamento" } ] }, { "id": 3, "name": "Mercado Livre", "categories": [ { "id": 31, "name": "Mercado Livre Pergunta" } ] } ] ``` -------------------------------- ### Token Generation Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This endpoint is used to generate an OAUTH token for API authentication. The token is valid for 24 hours. Basic Authentication is used in the header for origin validation, and the request body specifies the domain for data integration. ```APIDOC ## POST /token ### Description Generates an OAUTH token for API authentication. ### Method POST ### Endpoint `http://{endpoint}/token` ### Parameters #### Request Headers - **Authorization** (string) - Required - `Basic {api_user:api_password pair in Base64 format}` - **Content-Type** (string) - Required - `application/x-www-form-urlencoded` #### Request Body - **grant_type** (string) - Required - `password` - **username** (string) - Required - `{client_user in Base64 format}` - **password** (string) - Required - `{client_password in Base64 format}` ### Request Example ``` { "Authorization": "Basic dXNlcjpwYXNzd29yZA==", "Content-Type": "application/x-www-form-urlencoded" } ``` ``` { "grant_type": "password", "username": "dXNlcg==", "password": "cGFzc3dvcmQ=" } ``` ### Response #### Success Response (200) - **access_token** (string) - The generated access token. - **token_type** (string) - The type of token, usually 'bearer'. - **expires_in** (integer) - The token's validity period in seconds. #### Response Example ```json { "access_token": "sk3bnOJVGQy7LTECXLE_tfCXc8XFeppOL4qoomMBVzCpVjH4ifgFNX064CxCT6wRCN5Z1adnQyev2-S_WqRrojTE_SrfnGsBh2_6Q0rf0xf9shTMx0RgzMVKfGekpNyZ7DAMSIFRpEngxdnH_CF69feDc2gqS675tZtkGVl_0wq3hXutEQrenFzh6LszlVIG", "token_type": "bearer", "expires_in": 604799 } ``` #### Error Response (400) - **error** (string) - Description of the error (e.g., `invalid_grant`, `unsupported_grant_type`). - **error_description** (string) - More detailed explanation of the error. #### Error Response Example ```json { "error": "invalid_grant", "error_description": "The user name or password is incorrect." } ``` ``` -------------------------------- ### List Allowed Dealer Stores Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Retrieves a list of permitted dealer stores for a specific dealer, used for creating leads. Requires a valid Bearer token and the dealer's ID in the URL. ```json [ { "id": 1, "dealer_Id": 1, "company_Id": 27, "nickName": "Turing Jaguar" }, { "id": 2, "dealer_Id": 2, "company_Id": 19, "nickName": "Turing Aston Martin Curitiba" }, { "id": 2, "dealer_Id": 2, "company_Id": 19, "nickName": "Turing Aston Martin Blumenau" } ] ``` -------------------------------- ### List Allowed Dealerships Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Retrieves a list of permitted dealerships (brands) used for creating leads. Requires a valid Bearer token for authorization. ```json [ { "id": 1, "company_Id": 27, "name": "Turing", "brandName": "Jaguar" }, { "id": 2, "company_Id": 27, "name": "Turing", "brandName": "Aston Martin" } ] ``` -------------------------------- ### Request Body Structure for Leads Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md The JSON structure for the request body when submitting lead data. This defines all available fields. ```json { "LeadSource_Name": "", "CompanyName": "", "DealerName": "", "DealerStoreName": "", "ProductType": 1, "ProductBrandName": "", "ProductModelName": "", "ProductFullName": "", "ProductModelYear": "", "ProductManufactoringYear": "", "ProductColor": "", "ProductLicencePlate": "", "ProductPrice": "", "CustomerName": "", "CustomerEmail":"", "CustomerPhone":"", "CustomerMobilePhone": "", "CustomerCity": "", "CustomerState": "", "CustomerFiscalDocument": "", "CustomerMessage": "", "SellerName": "", "SellerEmail": "", "SellerErpId": "", "SellerStore": "", "SellerNotes": "", "SellerFiscalDocument":"", "ChannelName": "", "PrivacyPolicyAccepted" : true, "MarketingContact": "", "MarketingContactPreferences": "" } ``` -------------------------------- ### POST Request Headers for Leads Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md Required headers for the lead submission POST request. The Authorization header requires a Bearer token. ```http Authorization = Bearer {token gerado anteriormente em api/token} Content-Type = application/json ``` -------------------------------- ### Bad Request Error Response (400) - Missing Required Fields Source: https://github.com/lead-hub/api-documentation/blob/master/Readme.md This JSON object signifies a bad request due to missing mandatory fields. The message specifies which field is required. ```json { "success": false, "message": "