How to get data back from OpenAI API using javascript and display it on my website

I have simple form on my website with text input. We want to make a call to OpenAI API to ask ChatGPT to find some similar companies based on a job description that a user pastes in the text box. So far, haven’t been able to get the return data to work. It is correctly sending the job description data, but not able to list a list of companies. Please look at the javascript code and help.

const form = document.querySelector('form');
const generateButton = document.querySelector('#generate-button');
const companiesOutput = document.querySelector('#output-companies');

function generateCampaign(event) {
  event.preventDefault();
  const jobDescription = document.querySelector('#job-description').value;

  fetch('https://api.openai.com/v1/engines/davinci-codex/completions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiKey}`
    },
    body: JSON.stringify({
      prompt: `Give me 20 top-tier VC backed startup companies in the same space as the company in this job description:nn ${jobDescription}`,
      max_tokens: 50,
      temperature: 0.7
    })
  })
  .then(response => response.json())
  .then(data => {
    const companiesList = data.choices[0].text;
    companiesOutput.innerHTML = `<li>${companiesList}</li>`;
  })
  .catch(error => console.error(error));
};

form.addEventListener('submit', generateCampaign);