// Example JS code structure for integrating an API in Webflow document.addEventListener('DOMContentLoaded', function() { // Function to call the ZeroGPT API function callZeroGPTAPI(inputText) { var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://api.zerogpt.com/v1/endpoint', true); // Use the correct API endpoint URL xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Authorization', '9446345d-a918-4966-b83d-c71edb513a36'); // Replace with your actual API key xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { var response = JSON.parse(xhr.responseText); // Handle the response from the API console.log(response); } }; var data = JSON.stringify({ "input": inputText }); xhr.send(data); } // Example of how you might call the above function // Perhaps when a button is clicked document.getElementById('your-button-id').addEventListener('click', function() { var userInput = document.getElementById('your-input-id').value; callZeroGPTAPI(userInput); }); });