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();
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!
Page 1 / 1
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.
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:
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!
Unity game engine is the best in the game version to develop it and based on the updation process.
Hi everyone, I’m integrating a custom backend API with Unity for a Brawl Stars–style APK mod and I’m stuck on a few things:
Auth: API returns 401/403 intermittently when using UnityWebRequest with Bearer tokens (JWT). Tokens work fine in Postman. Could Unity’s clock skew or header casing be the issue?
Leaderboards: Large JSON payloads sometimes fail with “Response code 200 but empty body” on Android builds (Editor works). Could this be compression/Content-Encoding or HTTP/2?
In-game purchases: Receipt validation endpoint times out only on mobile data; Wi-Fi is fine. Maybe DNS/SSL chain or certificate pinning mismatch?
CORS/preflight: On WebGL test, OPTIONS preflight is rejected (server expects only GET/POST). Any best practices to configure this cleanly?
What I’ve tried so far:
Forced HTTP/1.1, disabled chunked transfer, set explicit Content-Type and Authorization headers.
Added retry with exponential backoff and refreshed JWT 2 minutes before expiry.
Verified server time (NTP) to avoid exp/nbf drift.
Limited leaderboard page size and enabled gzip.
If anyone has a reliable pattern for UnityWebRequest + JWT (or HMAC) with mobile builds, I’d appreciate tips—especially around compression, redirects, and TLS settings. I’m also documenting my test notes and fixes here: https://nulls-brawll.com.br
Thanks!
I’ve been working on a small project in Unity and since updating my device to Android 14 I’m facing a couple of problems:
Authentication requests sometimes fail even though tokens are valid.
JSON data for leaderboards loads fine in Editor but comes back empty on mobile build.
Purchase validation randomly times out on mobile data but works on Wi-Fi.
I tried disabling chunked transfer, forcing HTTP/1.1, and refreshing tokens earlier, but the issue still happens on my ASUS device.
While testing, I also checked performance using different builds like Brawl Stars APK mod
and noticed the same behavior, so it feels more like a Unity + Android 14 compatibility problem rather than just one game.
Has anyone else run into this with Unity networking on Android 14? Any clean fixes that worked for you?
Totally agree, Unity is one of the most flexible engines for building and updating game versions. I’ve also been testing it with different builds and mods — for anyone interested, here’s a helpful resource on that: Brawl Stars APK mod
Unity is definitely one of the easiest engines for updates and testing. I also checked with a custom build of brawl stars and noted some performance changes. For reference I had used this site: nullsbrawl-apk-indir.com.tr