Skip to main content

Hello everyone! im a game developer and i am making a game for a client that uses klaviyo for subscriptions. now i have handled api requests through unity before but i cannot link it to my account here to see if it works.
Here is my code  through Unity that calls a Post request
 

private IEnumerator SendData()
{
WWWForm form = new WWWForm();
form.AddField("email", emailField.text); // this is the email entered in the UI of the game
form.AddField("api_key", "my_api_key_here");
UnityWebRequest www = UnityWebRequest.Post("https://a.klaviyo.com/api/v2/list/{LIST_ID}/subscribe", form);
yield return www.SendWebRequest();

if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Registered");
}
Debug.Log(emailField.text);
}
}

 like this i get a 404 and i dont know if im doing something wrong with the url. to be honest i have tried it with mailchimp since this is what i have used before and it works ok. any help would be appreciated thanks!

Hi @slaga,

Thanks for sharing with the Community! Are you defining LIST_ID anywhere? Maybe you are in your actual code but redacted it for this example? Not including the list ID could result in a 404.

Best,

Caroline


thank you for the answer i managed to fix everything but now when i upload it on my server i get blocked by cors.

 


Hi @slaga,

The CORS error is likely a result of hitting Klaviyo’s server-side Lists V2 endpoint via front-end code. Instead, I would suggest using the front-end endpoint described here.

Best,

Caroline


indeed , i did try your frontend api 

https://manage.kmail-lists.com/subscriptions/subscribe through a form in unity acting like it fills the actual form and doing it like this with only the email parameter being taken from user input
https://manage.kmail-lists.com/subscriptions/subscribe?a=W9pKM7&g=YeXzKp but still the same Cors error, the funny thing is from my computer ( in the game engine ) everything works fine, as soon as i upload it to my server or run it on localhost it gets blocked.you can try it your self in https://slaga-games.com/shoot

Hi @slaga,

Can you post the CORS error? I’m not seeing it when I test.

Thanks,

Caroline


Hi @slaga,

Just checking in here -- were you able to resolve the CORS error? If not, can you post the error here?

Best,

Caroline


Hey everyone,

I’m currently working on integrating an API with Unity Game Engine for a custom Brawl Stars APK mod . I need to fetch user data, leaderboards, and in-game purchases but running into some issues with API authentication and data retrieval.

Things I’ve tried:
✅ Setting up API keys correctly
✅ Using UnityWebRequest for API calls
✅ Debugging response errors

Still facing authentication errors and timeouts. Could this be a CORS issue, or do I need specific headers for Klaviyo API? Any Unity devs here who’ve worked on API integration? Would appreciate any insights! 🚀


Hey everyone,

I’m currently working on integrating an API with Unity Game Engine for a custom Brawl Stars APK mod . I need to fetch user data, leaderboards, and in-game purchases but running into some issues with API authentication and data retrieval.

Things I’ve tried:
✅ Setting up API keys correctly
✅ Using UnityWebRequest for API calls
✅ Debugging response errors

Still facing authentication errors and timeouts. Could this be a CORS issue, or do I need specific headers for Klaviyo API? Any Unity devs here who’ve worked on API integration? Would appreciate any insights! 🚀

You're definitely on the right track, especially for something as ambitious as integrating an API into Unity for a Brawl Stars game apk. That said, a few things stand out that might be causing those authentication errors and timeouts.

First off, Klaviyo’s API is generally meant for backend use, not direct calls from Unity or client-side apps, so CORS could definitely be an issue if you’re trying to hit the API directly from the game. Ideally, you should set up a backend server to handle the API requests, then have Unity communicate with your server instead.

Also, make sure you're including the correct Authorization header. For Klaviyo, that usually means passing a bearer token like this:


request.SetRequestHeader("Authorization", "Bearer YOUR_PRIVATE_API_KEY");

If timeouts are happening, it might be due to Unity’s default timeout settings or a network issue on mobile. Try logging the full response and error messages to pinpoint it better.


Hey @slaga, cool project! The 404 error usually means the URL is incorrect or missing something. For Klaviyo, make sure you're using their updated API endpoint (they’ve moved to a newer REST API). The /v2/list/{LIST_ID}/subscribe endpoint may be outdated—check if you need an authorization header instead of passing the API key in the form.


It looks like you're almost there, but the 404 error is happening because the URL you're using is outdated. Klaviyo’s current API doesn’t support the old /api/v2/list/{LIST_ID}/subscribe endpoint anymore. Instead, for subscribing users to a list, Klaviyo now uses a different structure where you send a POST request to /api/v2/list/{LIST_ID}/members with the user’s email in JSON format. Also, instead of including the API key as a form field, it needs to be passed in the request headers as a Bearer token. That’s likely why your Unity request is failing.

To fix this, you’ll want to build your Unity request using JSON and set the correct headers for authentication. One important note: Klaviyo's private API key should never be exposed in client-side apps like Unity games—it’s better to send the email to your own secure backend, then let your server talk to Klaviyo safely. If you're just testing, it's okay for now, but for production, definitely set up a backend endpoint. Let me know if you want help with that or want to test it in Postman first! 


starbucks partner central is the official platform where partners can manage schedules, benefits, and company updates.


 

You can easily get the latest version when you search for ag3 whatsapp download on your phone browser.


Rullakaihtimet moottorilla tuovat arkeen mukavuutta ja modernia käytettävyyttä yhdellä napin painalluksella. Ne soveltuvat erinomaisesti koteihin ja toimistoihin, joissa halutaan yhdistää tyylikäs sisustus ja älykäs toiminnallisuus.


Quick and affordable door repairs can fix issues like sticking, squeaking, or damaged hinges with ease.


Reply