Skip to main content

Create/get profile consent using beta API

  • September 29, 2022
  • 1 reply
  • 128 views

Forum|alt.badge.img+2

Hello,

Can you explain (maybe JSON samples) how to create/get consent using the beta API profile endpoint?

https://developers.klaviyo.com/en/v2022-09-07.pre/reference/get_profiles

https://developers.klaviyo.com/en/v2022-09-07.pre/reference/create_profile

1 reply

Taylor Tarpley
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 2148 replies
  • October 3, 2022

Hi@Nerijusz

 

Welcome to the Community!

 

Are you looking to receive consent for email or SMS? We have some helpful documentation sharing how to get SMS consent via API in our Help center that even shares a json example! Essentially, the code will look something like this:

import requests
import json
data = {
"api_key": "PRIVATE_API_KEY",
"profiles": [
{
"phone_number": "+12345678900",
"sms_consent": True
}
]
}
headers = {
"Content-Type": "application/json",
"Cache-Control": "no-cache"
}
conv = json.dumps(data)
response = requests.request("POST", "https://a.klaviyo.com/api/v2/list/{LIST_ID}/subscribe", data=conv, headers=headers)
print(response.text)

 

Hope this helps!

-Taylor