Hello, everyone! I’d like to use mixpanel api to e...
# questions
b
Hello, everyone! I’d like to use mixpanel api to enter events that I couldn’t enter before due to an error. However, the following error occurs. How can I use the import endpoint api?
Copy code
Access is forbidden due to request missing authentication details. Please see: <https://developer.mixpanel.com/reference/ingestion-api-authentication>
I sent it as below using Typescript + axios.
Copy code
await axios({
    method: 'POST',
    url: '<https://api.mixpanel.com/import>',
    headers: {
      'Content-Type': 'application/json',
      Authorization:
        'Basic <username>:<secretkey>',
    },
    params: {
      project_id:<MIXPANEL_PROJECT_TOKEN>,
      stricts: 1,
      secret: <SECRET_KEY>,

    },
    data: {
      event: <EVENT NAME>,
      properties: {
        $distinct_id: 'item.id',
        USER_ID: 'item.id',
        $email: 'item.email',
        $phone: 'item.phone_number',
        time: 'item.created_at',
      },
    },
  }).catch((e) => {
    console.log(e);
  });
Is there a problem with the code I wrote? Thank you, everyone! TT