Currently, I am using API revision v2023-06-15, and everything works fine for me in this revision.
However, I want to upgrade my service to use the latest stable revision (v2024-02-15), but it seems it does not work as expected.
The functionality of the APIs (Client and API) to create new events in Klaviyo within revision v2023-06-15 is particularly advantageous. In this version, a single request can achieve the following actions:
- Create or update a profile based on External ID, Email, and/or Phone Number.
- Create an event and link it with the respective profile.
However, it's worth noting that with the newer API revisions, despite the request returning a successful status code 202 Accepted, the event and profile are not created or updated as expected.
Example using revision v2023-06-15 (working):
curl --request POST \
--url https://a.klaviyo.com/api/events/ \
--header 'Accept: application/json' \
--header 'Authorization: Klaviyo-API-Key XXXXXXXXXX' \
--header 'Content-Type: application/json' \
--header 'revision: 2023-06-15' \
--data '{
"data": {
"type": "event",
"attributes": {
"metric": {
"name": "Custom Event Name"
},
"properties": {
"custom": "Custom Event Property",
"value_currency": "USD"
},
"value": 10,
"profile": {
"$email": "email@example.com",
"$id": "ExternalProfileID",
"$first_name": "John",
"$last_name": "Doe",
"any": "Custom Profile Property"
}
}
}
}'
Example using the latest revision v2024-02-15 (not working):
curl --request POST \
--url https://a.klaviyo.com/api/events/ \
--header 'Accept: application/json' \
--header 'Authorization: Klaviyo-API-Key XXXXXXXXXX' \
--header 'Content-Type: application/json' \
--header 'revision: 2024-02-15' \
--data '{
"data": {
"type": "event",
"attributes": {
"metric": {
"data": {
"type": "metric",
"attributes": {
"name": "Custom Event Name"
}
}
},
"properties": {
"custom": "Custom Event Property"
},
"value": 10,
"value_currency": "USD",
"profile": {
"data": {
"type": "profile",
"attributes": {
"email": "email@example.com",
"external_id": "ExternalProfileID",
"first_name": "John",
"last_name": "Doe",
"properties": {
"any": "Custom Profile Property"
}
}
}
}
}
}
}'
API documentation:
Am I doing something wrong with the new API revisions or misunderstanding about its concepts and usages?
Please help!