Package: klaviyo-api
Klaviyo Python SDKSDK version: 7.0.0API revision: 2024-02-15Helpful ResourcesAPI ReferenceAPI GuidesPostman WorkspaceInteractive Guide (Jupyter Notebook)Design & ApproachThis SDK is a thin wrapper around our API. See our API Reference for full documentation on behavior.This SDK exactly mirrors the organization and naming convention of the above language-agnostic resources, with a few namespace changes to make it Pythonic (details in Appendix).OrganizationThis SDK is organized into the following resources:AccountsCampaignsCatalogsCouponsData_PrivacyEventsFlowsImagesListsMetricsProfilesReportingSegmentsTagsTemplatesInstallationYou can install this library usingour pip package here.Depending on your system configuration, you will need to runoneof the following shell commands:pipinstallklaviyo-apiORpip3installklaviyo-apiUsage ExampleTo instantiate the clientNOTE:The SDK retries on resolvable errors, namely: rate limits (common) and server errors (rare).The keyword arguments define some advanced settings; the example is populated with the default values.max_delaydenotes total delay (in seconds) across all attempts.fromklaviyo_apiimportKlaviyoAPIklaviyo=KlaviyoAPI("YOUR_API_KEY_HERE",max_delay=60,max_retries=3,test_host=None)Example requestklaviyo.Metrics.get_metrics()Use Case ExamplesHow to use filtering, sorting, and spare fieldset JSON API featuresUse Case: Get events associated with a specific metric, then return just the event properties sorted by oldest to newest datetime.klaviyo.Events.get_events(fields_event=['event_properties'],filter="equals(metric_id,\"aBc123\")",sort='-datetime')How to filter based on datetimeUse Case: Get profiles that have been updated between two datetimes.klaviyo.Profiles.get_profiles(filter='less-than(updated,2023-04-26T00:00:00Z),greater-than(updated,2023-04-19T00:00:00Z)')How to use pagination and the page[size] paramUse Case: Use cursor-based pagination to get the next 20 profile records.klaviyo.Profiles.get_profiles(page_cursor="https://a.klaviyo.com/api/profiles/?page%5Bcursor%5D=bmV4dDo6aWQ6OjAxRjNaWk5ITlRYMUtFVEhQMzJTUzRBN0ZY",page_size=20)NOTE: This page cursor value is exactly what is returned in theself/next/prevresponse valuesHow to add additional information to your API response via additional-fields and theincludesparameterUse Case: Get a specific profile, return an additional predictive analytics field, and also return the list objects associated with the profile.klaviyo.Profiles.get_profile('01GDDKASAP8TKDDA2GRZDSVP4H',additional_fields_profile=['predictive_analytics'],include=['lists'])How to use our relationship endpoints to see related resourcesUse Case: Get all list memberships for a profile with the givenprofile_id.klaviyo.Profiles.get_profile_relationships_lists('01GDDKASAP8TKDDA2GRZDSVP4H')How to see what Klaviyo objects are associated with a specific tagUse Case: Get all campaigns associated with the giventag_id.klaviyo.Tags.get_tag_relationships_campaigns('9c8db7a0-5ab5-4e3c-9a37-a3224fd14382')Uploading Image From FileWhen usingImages.upload_image_from_file(file, name=name), `file`` can be either a file path string OR a bytearray.NOTE: when file is a bytearray, you will need to use the optionalnameparameter to specify the file name, else name will default tounnamed_image_from_python_sdkas a file pathfilepath='/path/to/image.png'klaviyo.Images.upload_image_from_file(file,name=name)as a bytearrayfilepath='/path/to/image.png'withopen(filepath,'rb')asf:file=f.read()klaviyo.Images.upload_image_from_file(file,name=name)Error HandlingThis SDK throws anApiExceptionerror when the server returns a non-2XXresponse.AnApiExceptionconsists of the following attributes:status:intreason:strbody:bytesthis can be decoded into a native python dictionary as follows:# to decode to a dictionaryimportjsonBODY_DICT=json.loads(YOUR_EXCEPTION.body)# to decode to a stringBODY_STRING=YOUR_EXCEPTION.body.decode('utf-8')headers:class 'urllib3._collections.HTTPHeaderDict'This can be interacted with as a normal dictionary:ex:date = YOUR_EXCEPTION.headers['Date']
keys = YOUR_EXCEPTION.headers.keys()
values = YOUR_EXCEPTION.headers.values()Important NotesThe main difference between this SDK and the language-agnostic API Docs that the below endpoints link to is that this SDK automatically adds therevisionheader corresponding to the SDK version.Organization: Resource groups and operation_ids are listed below in alphabetical order, first by Resource name, then byOpenAPI Summary. Operation summaries are those listed in the right side bar of theAPI Reference.For example values / data types, as well as whether parameters are required/optional, please reference the corresponding API Reference link.Some keyword args may potentially be required for the API call to succeed, the linked API docs are the source of truth regarding which keyword params are required.JSON payloads should be passed in as native python dictionaries.You can override the client private key by passing in an optional_request_authkeyword arg to any API call that takes a private key. As a reminder: do NOT do this client-side/onsite.Comprehensive list of Operations & ParametersAccountsGet Account## Positional Arguments# id | str## Keyword Arguments# fields_account | List[str]klaviyo.Accounts.get_account(id,fields_account=fields_account)Get Accounts## Keyword Arguments# fields_account | List[str]klaviyo.Accounts.get_accounts(fields_account=fields_account)CampaignsCreate Campaign## Positional Arguments# body | dictklaviyo.Campaigns.create_campaign(body)Create Campaign Clone## Positional Arguments# body | dictklaviyo.Campaigns.create_campaign_clone(body)Assign Campaign Message Template## Positional Arguments# body | dictklaviyo.Campaigns.create_campaign_message_assign_template(body)Create Campaign Recipient Estimation Job## Positional Arguments# body | dictklaviyo.Campaigns.create_campaign_recipient_estimation_job(body)Create Campaign Send Job## Positional Arguments# body | dictklaviyo.Campaigns.create_campaign_send_job(body)Delete Campaign## Positional Arguments# id | strklaviyo.Campaigns.delete_campaign(id)Get Campaign## Positional Arguments# id | str## Keyword Arguments# fields_campaign_message | List[str]# fields_campaign | List[str]# fields_tag | List[str]# include | List[str]klaviyo.Campaigns.get_campaign(id,fields_campaign_message=fields_campaign_message,fields_campaign=fields_campaign,fields_tag=fields_tag,include=include)Get Campaign Campaign Messages## Positional Arguments# id | str## Keyword Arguments# fields_campaign_message | List[str]# fields_campaign | List[str]# fields_template | List[str]# include | List[str]klaviyo.Campaigns.get_campaign_campaign_messages(id,fields_campaign_message=fields_campaign_message,fields_campaign=fields_campaign,fields_template=fields_template,include=include)Get Campaign Message## Positional Arguments# id | str## Keyword Arguments# fields_campaign_message | List[str]# fields_campaign | List[str]# fields_template | List[str]# include | List[str]klaviyo.Campaigns.get_campaign_message(id,fields_campaign_message=fields_campaign_message,fields_campaign=fields_campaign,fields_template=fields_template,include=include)Get Campaign Message Campaign## Positional Arguments# id | str## Keyword Arguments# fields_campaign | List[str]klaviyo.Campaigns.get_campaign_message_campaign(id,fields_campaign=fields_campaign)Get Campaign Message Relationships Campaign## Positional Arguments# id | strklaviyo.Campaigns.get_campaign_message_relationships_campaign(id)Get Campaign Message Relationships Template## Positional Arguments# id | strklaviyo.Campaigns.get_campaign_message_relationships_template(id)Get Campaign Message Template## Positional Arguments# id | str## Keyword Arguments# fields_template | List[str]klaviyo.Campaigns.get_campaign_message_template(id,fields_template=fields_template)Get Campaign Recipient Estimation## Positional Arguments# id | str## Keyword Arguments# fields_campaign_recipient_estimation | List[str]klaviyo.Campaigns.get_campaign_recipient_estimation(id,fields_campaign_recipient_estimation=fields_campaign_recipient_estimation)Get Campaign Recipient Estimation Job## Positional Arguments# id | str## Keyword Arguments# fields_campaign_recipient_estimation_job | List[str]klaviyo.Campaigns.get_campaign_recipient_estimation_job(id,fields_campaign_recipient_estimation_job=fields_campaign_recipient_estimation_job)Get Campaign Relationships Campaign Messages## Positional Arguments# id | strklaviyo.Campaigns.get_campaign_relationships_campaign_messages(id)Get Campaign Relationships Tags## Positional Arguments# id | strklaviyo.Campaigns.get_campaign_relationships_tags(id)Get Campaign Send Job## Positional Arguments# id | str## Keyword Arguments# fields_campaign_send_job | List[str]klaviyo.Campaigns.get_campaign_send_job(id,fields_campaign_send_job=fields_campaign_send_job)Get Campaign Tags## Positional Arguments# id | str## Keyword Arguments# fields_tag | List[str]klaviyo.Campaigns.get_campaign_tags(id,fields_tag=fields_tag)Get Campaigns## Positional Arguments# filter | str## Keyword Arguments# fields_campaign_message | List[str]# fields_campaign | List[str]# fields_tag | List[str]# include | List[str]# page_cursor | str# sort | strklaviyo.Campaigns.get_campaigns(filter,fields_campaign_message=fields_campaign_message,fields_campaign=fields_campaign,fields_tag=fields_tag,include=include,page_cursor=page_cursor,sort=sort)Update Campaign## Positional Arguments# id | str# body | dictklaviyo.Campaigns.update_campaign(id,body)Update Campaign Message## Positional Arguments# id | str# body | dictklaviyo.Campaigns.update_campaign_message(id,body)Update Campaign Send Job## Positional Arguments# id | str# body | dictklaviyo.Campaigns.update_campaign_send_job(id,body)CatalogsCreate Back In Stock Subscription## Positional Arguments# body | dictklaviyo.Catalogs.create_back_in_stock_subscription(body)Create Catalog Category## Positional Arguments# body | dictklaviyo.Catalogs.create_catalog_category(body)Create Catalog Category Relationships Items## Positional Arguments# id | str# body | dictklaviyo.Catalogs.create_catalog_category_relationships_items(id,body)Create Catalog Item## Positional Arguments# body | dictklaviyo.Catalogs.create_catalog_item(body)Create Catalog Item Relationships Categories## Positional Arguments# id | str# body | dictklaviyo.Catalogs.create_catalog_item_relationships_categories(id,body)Create Catalog Variant## Positional Arguments# body | dictklaviyo.Catalogs.create_catalog_variant(body)Delete Catalog Category## Positional Arguments# id | strklaviyo.Catalogs.delete_catalog_category(id)Delete Catalog Category Relationships Items## Positional Arguments# id | str# body | dictklaviyo.Catalogs.delete_catalog_category_relationships_items(id,body)Delete Catalog Item## Positional Arguments# id | strklaviyo.Catalogs.delete_catalog_item(id)Delete Catalog Item Relationships Categories## Positional Arguments# id | str# body | dictklaviyo.Catalogs.delete_catalog_item_relationships_categories(id,body)Delete Catalog Variant## Positional Arguments# id | strklaviyo.Catalogs.delete_catalog_variant(id)Get Catalog Categories## Keyword Arguments# fields_catalog_category | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_categories(fields_catalog_category=fields_catalog_category,filter=filter,page_cursor=page_cursor,sort=sort)Get Catalog Category## Positional Arguments# id | str## Keyword Arguments# fields_catalog_category | List[str]klaviyo.Catalogs.get_catalog_category(id,fields_catalog_category=fields_catalog_category)Get Catalog Category Items## Positional Arguments# id | str## Keyword Arguments# fields_catalog_item | List[str]# fields_catalog_variant | List[str]# filter | str# include | List[str]# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_category_items(id,fields_catalog_item=fields_catalog_item,fields_catalog_variant=fields_catalog_variant,filter=filter,include=include,page_cursor=page_cursor,sort=sort)Get Catalog Category Relationships Items## Positional Arguments# id | str## Keyword Arguments# page_cursor | strklaviyo.Catalogs.get_catalog_category_relationships_items(id,page_cursor=page_cursor)Get Catalog Item## Positional Arguments# id | str## Keyword Arguments# fields_catalog_item | List[str]# fields_catalog_variant | List[str]# include | List[str]klaviyo.Catalogs.get_catalog_item(id,fields_catalog_item=fields_catalog_item,fields_catalog_variant=fields_catalog_variant,include=include)Get Catalog Item Categories## Positional Arguments# id | str## Keyword Arguments# fields_catalog_category | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_item_categories(id,fields_catalog_category=fields_catalog_category,filter=filter,page_cursor=page_cursor,sort=sort)Get Catalog Item Relationships Categories## Positional Arguments# id | str## Keyword Arguments# page_cursor | strklaviyo.Catalogs.get_catalog_item_relationships_categories(id,page_cursor=page_cursor)Get Catalog Item Variants## Positional Arguments# id | str## Keyword Arguments# fields_catalog_variant | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_item_variants(id,fields_catalog_variant=fields_catalog_variant,filter=filter,page_cursor=page_cursor,sort=sort)Get Catalog Items## Keyword Arguments# fields_catalog_item | List[str]# fields_catalog_variant | List[str]# filter | str# include | List[str]# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_items(fields_catalog_item=fields_catalog_item,fields_catalog_variant=fields_catalog_variant,filter=filter,include=include,page_cursor=page_cursor,sort=sort)Get Catalog Variant## Positional Arguments# id | str## Keyword Arguments# fields_catalog_variant | List[str]klaviyo.Catalogs.get_catalog_variant(id,fields_catalog_variant=fields_catalog_variant)Get Catalog Variants## Keyword Arguments# fields_catalog_variant | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Catalogs.get_catalog_variants(fields_catalog_variant=fields_catalog_variant,filter=filter,page_cursor=page_cursor,sort=sort)Get Create Categories Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_category_bulk_create_job | List[str]# fields_catalog_category | List[str]# include | List[str]klaviyo.Catalogs.get_create_categories_job(job_id,fields_catalog_category_bulk_create_job=fields_catalog_category_bulk_create_job,fields_catalog_category=fields_catalog_category,include=include)Get Create Categories Jobs## Keyword Arguments# fields_catalog_category_bulk_create_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_create_categories_jobs(fields_catalog_category_bulk_create_job=fields_catalog_category_bulk_create_job,filter=filter,page_cursor=page_cursor)Get Create Items Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_item_bulk_create_job | List[str]# fields_catalog_item | List[str]# include | List[str]klaviyo.Catalogs.get_create_items_job(job_id,fields_catalog_item_bulk_create_job=fields_catalog_item_bulk_create_job,fields_catalog_item=fields_catalog_item,include=include)Get Create Items Jobs## Keyword Arguments# fields_catalog_item_bulk_create_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_create_items_jobs(fields_catalog_item_bulk_create_job=fields_catalog_item_bulk_create_job,filter=filter,page_cursor=page_cursor)Get Create Variants Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_variant_bulk_create_job | List[str]# fields_catalog_variant | List[str]# include | List[str]klaviyo.Catalogs.get_create_variants_job(job_id,fields_catalog_variant_bulk_create_job=fields_catalog_variant_bulk_create_job,fields_catalog_variant=fields_catalog_variant,include=include)Get Create Variants Jobs## Keyword Arguments# fields_catalog_variant_bulk_create_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_create_variants_jobs(fields_catalog_variant_bulk_create_job=fields_catalog_variant_bulk_create_job,filter=filter,page_cursor=page_cursor)Get Delete Categories Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_category_bulk_delete_job | List[str]klaviyo.Catalogs.get_delete_categories_job(job_id,fields_catalog_category_bulk_delete_job=fields_catalog_category_bulk_delete_job)Get Delete Categories Jobs## Keyword Arguments# fields_catalog_category_bulk_delete_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_delete_categories_jobs(fields_catalog_category_bulk_delete_job=fields_catalog_category_bulk_delete_job,filter=filter,page_cursor=page_cursor)Get Delete Items Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_item_bulk_delete_job | List[str]klaviyo.Catalogs.get_delete_items_job(job_id,fields_catalog_item_bulk_delete_job=fields_catalog_item_bulk_delete_job)Get Delete Items Jobs## Keyword Arguments# fields_catalog_item_bulk_delete_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_delete_items_jobs(fields_catalog_item_bulk_delete_job=fields_catalog_item_bulk_delete_job,filter=filter,page_cursor=page_cursor)Get Delete Variants Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_variant_bulk_delete_job | List[str]klaviyo.Catalogs.get_delete_variants_job(job_id,fields_catalog_variant_bulk_delete_job=fields_catalog_variant_bulk_delete_job)Get Delete Variants Jobs## Keyword Arguments# fields_catalog_variant_bulk_delete_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_delete_variants_jobs(fields_catalog_variant_bulk_delete_job=fields_catalog_variant_bulk_delete_job,filter=filter,page_cursor=page_cursor)Get Update Categories Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_category_bulk_update_job | List[str]# fields_catalog_category | List[str]# include | List[str]klaviyo.Catalogs.get_update_categories_job(job_id,fields_catalog_category_bulk_update_job=fields_catalog_category_bulk_update_job,fields_catalog_category=fields_catalog_category,include=include)Get Update Categories Jobs## Keyword Arguments# fields_catalog_category_bulk_update_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_update_categories_jobs(fields_catalog_category_bulk_update_job=fields_catalog_category_bulk_update_job,filter=filter,page_cursor=page_cursor)Get Update Items Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_item_bulk_update_job | List[str]# fields_catalog_item | List[str]# include | List[str]klaviyo.Catalogs.get_update_items_job(job_id,fields_catalog_item_bulk_update_job=fields_catalog_item_bulk_update_job,fields_catalog_item=fields_catalog_item,include=include)Get Update Items Jobs## Keyword Arguments# fields_catalog_item_bulk_update_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_update_items_jobs(fields_catalog_item_bulk_update_job=fields_catalog_item_bulk_update_job,filter=filter,page_cursor=page_cursor)Get Update Variants Job## Positional Arguments# job_id | str## Keyword Arguments# fields_catalog_variant_bulk_update_job | List[str]# fields_catalog_variant | List[str]# include | List[str]klaviyo.Catalogs.get_update_variants_job(job_id,fields_catalog_variant_bulk_update_job=fields_catalog_variant_bulk_update_job,fields_catalog_variant=fields_catalog_variant,include=include)Get Update Variants Jobs## Keyword Arguments# fields_catalog_variant_bulk_update_job | List[str]# filter | str# page_cursor | strklaviyo.Catalogs.get_update_variants_jobs(fields_catalog_variant_bulk_update_job=fields_catalog_variant_bulk_update_job,filter=filter,page_cursor=page_cursor)Spawn Create Categories Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_create_categories_job(body)Spawn Create Items Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_create_items_job(body)Spawn Create Variants Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_create_variants_job(body)Spawn Delete Categories Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_delete_categories_job(body)Spawn Delete Items Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_delete_items_job(body)Spawn Delete Variants Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_delete_variants_job(body)Spawn Update Categories Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_update_categories_job(body)Spawn Update Items Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_update_items_job(body)Spawn Update Variants Job## Positional Arguments# body | dictklaviyo.Catalogs.spawn_update_variants_job(body)Update Catalog Category## Positional Arguments# id | str# body | dictklaviyo.Catalogs.update_catalog_category(id,body)Update Catalog Category Relationships Items## Positional Arguments# id | str# body | dictklaviyo.Catalogs.update_catalog_category_relationships_items(id,body)Update Catalog Item## Positional Arguments# id | str# body | dictklaviyo.Catalogs.update_catalog_item(id,body)Update Catalog Item Relationships Categories## Positional Arguments# id | str# body | dictklaviyo.Catalogs.update_catalog_item_relationships_categories(id,body)Update Catalog Variant## Positional Arguments# id | str# body | dictklaviyo.Catalogs.update_catalog_variant(id,body)CouponsCreate Coupon## Positional Arguments# body | dictklaviyo.Coupons.create_coupon(body)Create Coupon Code## Positional Arguments# body | dictklaviyo.Coupons.create_coupon_code(body)Delete Coupon## Positional Arguments# id | strklaviyo.Coupons.delete_coupon(id)Delete Coupon Code## Positional Arguments# id | strklaviyo.Coupons.delete_coupon_code(id)Get Coupon## Positional Arguments# id | str## Keyword Arguments# fields_coupon | List[str]klaviyo.Coupons.get_coupon(id,fields_coupon=fields_coupon)Get Coupon Code## Positional Arguments# id | str## Keyword Arguments# fields_coupon_code | List[str]# fields_coupon | List[str]# include | List[str]klaviyo.Coupons.get_coupon_code(id,fields_coupon_code=fields_coupon_code,fields_coupon=fields_coupon,include=include)Get Coupon Code Bulk Create Job## Positional Arguments# job_id | str## Keyword Arguments# fields_coupon_code_bulk_create_job | List[str]# fields_coupon_code | List[str]# include | List[str]klaviyo.Coupons.get_coupon_code_bulk_create_job(job_id,fields_coupon_code_bulk_create_job=fields_coupon_code_bulk_create_job,fields_coupon_code=fields_coupon_code,include=include)Get Coupon Code Bulk Create Jobs## Keyword Arguments# fields_coupon_code_bulk_create_job | List[str]# filter | str# page_cursor | strklaviyo.Coupons.get_coupon_code_bulk_create_jobs(fields_coupon_code_bulk_create_job=fields_coupon_code_bulk_create_job,filter=filter,page_cursor=page_cursor)Get Coupon Code Relationships Coupon## Positional Arguments# id | str## Keyword Arguments# page_cursor | strklaviyo.Coupons.get_coupon_code_relationships_coupon(id,page_cursor=page_cursor)Get Coupon Codes## Keyword Arguments# fields_coupon_code | List[str]# fields_coupon | List[str]# filter | str# include | List[str]# page_cursor | strklaviyo.Coupons.get_coupon_codes(fields_coupon_code=fields_coupon_code,fields_coupon=fields_coupon,filter=filter,include=include,page_cursor=page_cursor)Get Coupon Codes For Coupon## Positional Arguments# id | str## Keyword Arguments# fields_coupon_code | List[str]# filter | str# page_cursor | strklaviyo.Coupons.get_coupon_codes_for_coupon(id,fields_coupon_code=fields_coupon_code,filter=filter,page_cursor=page_cursor)Get Coupon For Coupon Code## Positional Arguments# id | str## Keyword Arguments# fields_coupon | List[str]klaviyo.Coupons.get_coupon_for_coupon_code(id,fields_coupon=fields_coupon)Get Coupon Relationships Coupon Codes## Positional Arguments# id | strklaviyo.Coupons.get_coupon_relationships_coupon_codes(id)Get Coupons## Keyword Arguments# fields_coupon | List[str]# page_cursor | strklaviyo.Coupons.get_coupons(fields_coupon=fields_coupon,page_cursor=page_cursor)Spawn Coupon Code Bulk Create Job## Positional Arguments# body | dictklaviyo.Coupons.spawn_coupon_code_bulk_create_job(body)Update Coupon## Positional Arguments# id | str# body | dictklaviyo.Coupons.update_coupon(id,body)Update Coupon Code## Positional Arguments# id | str# body | dictklaviyo.Coupons.update_coupon_code(id,body)Data_PrivacyRequest Profile Deletion## Positional Arguments# body | dictklaviyo.Data_Privacy.request_profile_deletion(body)EventsCreate Event## Positional Arguments# body | dictklaviyo.Events.create_event(body)Get Event## Positional Arguments# id | str## Keyword Arguments# fields_event | List[str]# fields_metric | List[str]# fields_profile | List[str]# include | List[str]klaviyo.Events.get_event(id,fields_event=fields_event,fields_metric=fields_metric,fields_profile=fields_profile,include=include)Get Event Metric## Positional Arguments# id | str## Keyword Arguments# fields_metric | List[str]klaviyo.Events.get_event_metric(id,fields_metric=fields_metric)Get Event Profile## Positional Arguments# id | str## Keyword Arguments# additional_fields_profile | List[str]# fields_profile | List[str]klaviyo.Events.get_event_profile(id,additional_fields_profile=additional_fields_profile,fields_profile=fields_profile)Get Event Relationships Metric## Positional Arguments# id | strklaviyo.Events.get_event_relationships_metric(id)Get Event Relationships Profile## Positional Arguments# id | strklaviyo.Events.get_event_relationships_profile(id)Get Events## Keyword Arguments# fields_event | List[str]# fields_metric | List[str]# fields_profile | List[str]# filter | str# include | List[str]# page_cursor | str# sort | strklaviyo.Events.get_events(fields_event=fields_event,fields_metric=fields_metric,fields_profile=fields_profile,filter=filter,include=include,page_cursor=page_cursor,sort=sort)FlowsGet Flow## Positional Arguments# id | str## Keyword Arguments# fields_flow_action | List[str]# fields_flow | List[str]# fields_tag | List[str]# include | List[str]klaviyo.Flows.get_flow(id,fields_flow_action=fields_flow_action,fields_flow=fields_flow,fields_tag=fields_tag,include=include)Get Flow Action## Positional Arguments# id | str## Keyword Arguments# fields_flow_action | List[str]# fields_flow_message | List[str]# fields_flow | List[str]# include | List[str]klaviyo.Flows.get_flow_action(id,fields_flow_action=fields_flow_action,fields_flow_message=fields_flow_message,fields_flow=fields_flow,include=include)Get Flow For Flow Action## Positional Arguments# id | str## Keyword Arguments# fields_flow | List[str]klaviyo.Flows.get_flow_action_flow(id,fields_flow=fields_flow)Get Flow Action Messages## Positional Arguments# id | str## Keyword Arguments# fields_flow_message | List[str]# filter | str# page_size | int# sort | strklaviyo.Flows.get_flow_action_messages(id,fields_flow_message=fields_flow_message,filter=filter,page_size=page_size,sort=sort)Get Flow Action Relationships Flow## Positional Arguments# id | strklaviyo.Flows.get_flow_action_relationships_flow(id)Get Flow Action Relationships Messages## Positional Arguments# id | str## Keyword Arguments# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Flows.get_flow_action_relationships_messages(id,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get Flow Flow Actions## Positional Arguments# id | str## Keyword Arguments# fields_flow_action | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Flows.get_flow_flow_actions(id,fields_flow_action=fields_flow_action,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get Flow Message## Positional Arguments# id | str## Keyword Arguments# fields_flow_action | List[str]# fields_flow_message | List[str]# fields_template | List[str]# include | List[str]klaviyo.Flows.get_flow_message(id,fields_flow_action=fields_flow_action,fields_flow_message=fields_flow_message,fields_template=fields_template,include=include)Get Flow Action For Message## Positional Arguments# id | str## Keyword Arguments# fields_flow_action | List[str]klaviyo.Flows.get_flow_message_action(id,fields_flow_action=fields_flow_action)Get Flow Message Relationships Action## Positional Arguments# id | strklaviyo.Flows.get_flow_message_relationships_action(id)Get Flow Message Relationships Template## Positional Arguments# id | strklaviyo.Flows.get_flow_message_relationships_template(id)Get Flow Message Template## Positional Arguments# id | str## Keyword Arguments# fields_template | List[str]klaviyo.Flows.get_flow_message_template(id,fields_template=fields_template)Get Flow Relationships Flow Actions## Positional Arguments# id | str## Keyword Arguments# filter | str# page_size | int# sort | strklaviyo.Flows.get_flow_relationships_flow_actions(id,filter=filter,page_size=page_size,sort=sort)Get Flow Relationships Tags## Positional Arguments# id | strklaviyo.Flows.get_flow_relationships_tags(id)Get Flow Tags## Positional Arguments# id | str## Keyword Arguments# fields_tag | List[str]klaviyo.Flows.get_flow_tags(id,fields_tag=fields_tag)Get Flows## Keyword Arguments# fields_flow_action | List[str]# fields_flow | List[str]# fields_tag | List[str]# filter | str# include | List[str]# page_cursor | str# page_size | int# sort | strklaviyo.Flows.get_flows(fields_flow_action=fields_flow_action,fields_flow=fields_flow,fields_tag=fields_tag,filter=filter,include=include,page_cursor=page_cursor,page_size=page_size,sort=sort)Update Flow Status## Positional Arguments# id | str# body | dictklaviyo.Flows.update_flow(id,body)ImagesGet Image## Positional Arguments# id | str## Keyword Arguments# fields_image | List[str]klaviyo.Images.get_image(id,fields_image=fields_image)Get Images## Keyword Arguments# fields_image | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Images.get_images(fields_image=fields_image,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Update Image## Positional Arguments# id | str# body | dictklaviyo.Images.update_image(id,body)Upload Image From File## Positional Arguments# file | bytearray## Keyword Arguments# name | str# hidden | boolklaviyo.Images.upload_image_from_file(file,name=name,hidden=hidden)Upload Image From URL## Positional Arguments# body | dictklaviyo.Images.upload_image_from_url(body)ListsCreate List## Positional Arguments# body | dictklaviyo.Lists.create_list(body)Add Profile To List## Positional Arguments# id | str# body | dictklaviyo.Lists.create_list_relationships(id,body)Delete List## Positional Arguments# id | strklaviyo.Lists.delete_list(id)Remove Profile From List## Positional Arguments# id | str# body | dictklaviyo.Lists.delete_list_relationships(id,body)Get List## Positional Arguments# id | str## Keyword Arguments# additional_fields_list | List[str]# fields_list | List[str]# fields_tag | List[str]# include | List[str]klaviyo.Lists.get_list(id,additional_fields_list=additional_fields_list,fields_list=fields_list,fields_tag=fields_tag,include=include)Get List Profiles## Positional Arguments# id | str## Keyword Arguments# additional_fields_profile | List[str]# fields_profile | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Lists.get_list_profiles(id,additional_fields_profile=additional_fields_profile,fields_profile=fields_profile,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get List Relationships Profiles## Positional Arguments# id | str## Keyword Arguments# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Lists.get_list_relationships_profiles(id,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get List Relationships Tags## Positional Arguments# id | strklaviyo.Lists.get_list_relationships_tags(id)Get List Tags## Positional Arguments# id | str## Keyword Arguments# fields_tag | List[str]klaviyo.Lists.get_list_tags(id,fields_tag=fields_tag)Get Lists## Keyword Arguments# fields_list | List[str]# fields_tag | List[str]# filter | str# include | List[str]# page_cursor | strklaviyo.Lists.get_lists(fields_list=fields_list,fields_tag=fields_tag,filter=filter,include=include,page_cursor=page_cursor)Update List## Positional Arguments# id | str# body | dictklaviyo.Lists.update_list(id,body)MetricsGet Metric## Positional Arguments# id | str## Keyword Arguments# fields_metric | List[str]klaviyo.Metrics.get_metric(id,fields_metric=fields_metric)Get Metrics## Keyword Arguments# fields_metric | List[str]# filter | str# page_cursor | strklaviyo.Metrics.get_metrics(fields_metric=fields_metric,filter=filter,page_cursor=page_cursor)Query Metric Aggregates## Positional Arguments# body | dictklaviyo.Metrics.query_metric_aggregates(body)ProfilesCreate or Update Profile## Positional Arguments# body | dictklaviyo.Profiles.create_or_update_profile(body)Create Profile## Positional Arguments# body | dictklaviyo.Profiles.create_profile(body)Create or Update Push Token## Positional Arguments# body | dictklaviyo.Profiles.create_push_token(body)Get Bulk Profile Import Job## Positional Arguments# job_id | str## Keyword Arguments# fields_list | List[str]# fields_profile_bulk_import_job | List[str]# include | List[str]klaviyo.Profiles.get_bulk_profile_import_job(job_id,fields_list=fields_list,fields_profile_bulk_import_job=fields_profile_bulk_import_job,include=include)Get Bulk Profile Import Job Errors## Positional Arguments# id | str## Keyword Arguments# fields_import_error | List[str]# page_cursor | str# page_size | intklaviyo.Profiles.get_bulk_profile_import_job_import_errors(id,fields_import_error=fields_import_error,page_cursor=page_cursor,page_size=page_size)Get Bulk Profile Import Job Lists## Positional Arguments# id | str## Keyword Arguments# fields_list | List[str]klaviyo.Profiles.get_bulk_profile_import_job_lists(id,fields_list=fields_list)Get Bulk Profile Import Job Profiles## Positional Arguments# id | str## Keyword Arguments# additional_fields_profile | List[str]# fields_profile | List[str]# page_cursor | str# page_size | intklaviyo.Profiles.get_bulk_profile_import_job_profiles(id,additional_fields_profile=additional_fields_profile,fields_profile=fields_profile,page_cursor=page_cursor,page_size=page_size)Get Bulk Profile Import Job Relationships Lists## Positional Arguments# id | strklaviyo.Profiles.get_bulk_profile_import_job_relationships_lists(id)Get Bulk Profile Import Job Relationships Profiles## Positional Arguments# id | str## Keyword Arguments# page_cursor | str# page_size | intklaviyo.Profiles.get_bulk_profile_import_job_relationships_profiles(id,page_cursor=page_cursor,page_size=page_size)Get Bulk Profile Import Jobs## Keyword Arguments# fields_profile_bulk_import_job | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Profiles.get_bulk_profile_import_jobs(fields_profile_bulk_import_job=fields_profile_bulk_import_job,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get Profile## Positional Arguments# id | str## Keyword Arguments# additional_fields_profile | List[str]# fields_list | List[str]# fields_profile | List[str]# fields_segment | List[str]# include | List[str]klaviyo.Profiles.get_profile(id,additional_fields_profile=additional_fields_profile,fields_list=fields_list,fields_profile=fields_profile,fields_segment=fields_segment,include=include)Get Profile Lists## Positional Arguments# id | str## Keyword Arguments# fields_list | List[str]klaviyo.Profiles.get_profile_lists(id,fields_list=fields_list)Get Profile Relationships Lists## Positional Arguments# id | strklaviyo.Profiles.get_profile_relationships_lists(id)Get Profile Relationships Segments## Positional Arguments# id | strklaviyo.Profiles.get_profile_relationships_segments(id)Get Profile Segments## Positional Arguments# id | str## Keyword Arguments# fields_segment | List[str]klaviyo.Profiles.get_profile_segments(id,fields_segment=fields_segment)Get Profiles## Keyword Arguments# additional_fields_profile | List[str]# fields_profile | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Profiles.get_profiles(additional_fields_profile=additional_fields_profile,fields_profile=fields_profile,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Merge Profiles## Positional Arguments# body | dictklaviyo.Profiles.merge_profiles(body)Spawn Bulk Profile Import Job## Positional Arguments# body | dictklaviyo.Profiles.spawn_bulk_profile_import_job(body)Subscribe Profiles## Positional Arguments# body | dictklaviyo.Profiles.subscribe_profiles(body)Suppress Profiles## Positional Arguments# body | dictklaviyo.Profiles.suppress_profiles(body)Unsubscribe Profiles## Positional Arguments# body | dictklaviyo.Profiles.unsubscribe_profiles(body)Unsuppress Profiles## Positional Arguments# body | dictklaviyo.Profiles.unsuppress_profiles(body)Update Profile## Positional Arguments# id | str# body | dictklaviyo.Profiles.update_profile(id,body)ReportingQuery Campaign Values## Positional Arguments# body | dict## Keyword Arguments# page_cursor | strklaviyo.Reporting.query_campaign_values(body,page_cursor=page_cursor)Query Flow Series## Positional Arguments# body | dict## Keyword Arguments# page_cursor | strklaviyo.Reporting.query_flow_series(body,page_cursor=page_cursor)Query Flow Values## Positional Arguments# body | dict## Keyword Arguments# page_cursor | strklaviyo.Reporting.query_flow_values(body,page_cursor=page_cursor)SegmentsGet Segment## Positional Arguments# id | str## Keyword Arguments# additional_fields_segment | List[str]# fields_segment | List[str]# fields_tag | List[str]# include | List[str]klaviyo.Segments.get_segment(id,additional_fields_segment=additional_fields_segment,fields_segment=fields_segment,fields_tag=fields_tag,include=include)Get Segment Profiles## Positional Arguments# id | str## Keyword Arguments# additional_fields_profile | List[str]# fields_profile | List[str]# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Segments.get_segment_profiles(id,additional_fields_profile=additional_fields_profile,fields_profile=fields_profile,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get Segment Relationships Profiles## Positional Arguments# id | str## Keyword Arguments# filter | str# page_cursor | str# page_size | int# sort | strklaviyo.Segments.get_segment_relationships_profiles(id,filter=filter,page_cursor=page_cursor,page_size=page_size,sort=sort)Get Segment Relationships Tags## Positional Arguments# id | strklaviyo.Segments.get_segment_relationships_tags(id)Get Segment Tags## Positional Arguments# id | str## Keyword Arguments# fields_tag | List[str]klaviyo.Segments.get_segment_tags(id,fields_tag=fields_tag)Get Segments## Keyword Arguments# fields_segment | List[str]# fields_tag | List[str]# filter | str# include | List[str]# page_cursor | strklaviyo.Segments.get_segments(fields_segment=fields_segment,fields_tag=fields_tag,filter=filter,include=include,page_cursor=page_cursor)Update Segment## Positional Arguments# id | str# body | dictklaviyo.Segments.update_segment(id,body)TagsCreate Tag## Positional Arguments# body | dictklaviyo.Tags.create_tag(body)Create Tag Group## Positional Arguments# body | dictklaviyo.Tags.create_tag_group(body)Create Tag Relationships Campaigns## Positional Arguments# id | str# body | dictklaviyo.Tags.create_tag_relationships_campaigns(id,body)Create Tag Relationships Flows## Positional Arguments# id | str# body | dictklaviyo.Tags.create_tag_relationships_flows(id,body)Create Tag Relationships Lists## Positional Arguments# id | str# body | dictklaviyo.Tags.create_tag_relationships_lists(id,body)Create Tag Relationships Segments## Positional Arguments# id | str# body | dictklaviyo.Tags.create_tag_relationships_segments(id,body)Delete Tag## Positional Arguments# id | strklaviyo.Tags.delete_tag(id)Delete Tag Group## Positional Arguments# id | strklaviyo.Tags.delete_tag_group(id)Delete Tag Relationships Campaigns## Positional Arguments# id | str# body | dictklaviyo.Tags.delete_tag_relationships_campaigns(id,body)Delete Tag Relationships Flows## Positional Arguments# id | str# body | dictklaviyo.Tags.delete_tag_relationships_flows(id,body)Delete Tag Relationships Lists## Positional Arguments# id | str# body | dictklaviyo.Tags.delete_tag_relationships_lists(id,body)Delete Tag Relationships Segments## Positional Arguments# id | str# body | dictklaviyo.Tags.delete_tag_relationships_segments(id,body)Get Tag## Positional Arguments# id | str## Keyword Arguments# fields_tag_group | List[str]# fields_tag | List[str]# include | List[str]klaviyo.Tags.get_tag(id,fields_tag_group=fields_tag_group,fields_tag=fields_tag,include=include)Get Tag Group## Positional Arguments# id | str## Keyword Arguments# fields_tag_group | List[str]klaviyo.Tags.get_tag_group(id,fields_tag_group=fields_tag_group)Get Tag Group Relationships Tags## Positional Arguments# id | strklaviyo.Tags.get_tag_group_relationships_tags(id)Get Tag Group Tags## Positional Arguments# id | str## Keyword Arguments# fields_tag | List[str]klaviyo.Tags.get_tag_group_tags(id,fields_tag=fields_tag)Get Tag Groups## Keyword Arguments# fields_tag_group | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Tags.get_tag_groups(fields_tag_group=fields_tag_group,filter=filter,page_cursor=page_cursor,sort=sort)Get Tag Relationships Campaigns## Positional Arguments# id | strklaviyo.Tags.get_tag_relationships_campaigns(id)Get Tag Relationships Flows## Positional Arguments# id | strklaviyo.Tags.get_tag_relationships_flows(id)Get Tag Relationships Lists## Positional Arguments# id | strklaviyo.Tags.get_tag_relationships_lists(id)Get Tag Relationships Segments## Positional Arguments# id | strklaviyo.Tags.get_tag_relationships_segments(id)Get Tag Relationships Tag Group## Positional Arguments# id | strklaviyo.Tags.get_tag_relationships_tag_group(id)Get Tag Tag Group## Positional Arguments# id | str## Keyword Arguments# fields_tag_group | List[str]klaviyo.Tags.get_tag_tag_group(id,fields_tag_group=fields_tag_group)Get Tags## Keyword Arguments# fields_tag_group | List[str]# fields_tag | List[str]# filter | str# include | List[str]# page_cursor | str# sort | strklaviyo.Tags.get_tags(fields_tag_group=fields_tag_group,fields_tag=fields_tag,filter=filter,include=include,page_cursor=page_cursor,sort=sort)Update Tag## Positional Arguments# id | str# body | dictklaviyo.Tags.update_tag(id,body)Update Tag Group## Positional Arguments# id | str# body | dictklaviyo.Tags.update_tag_group(id,body)TemplatesCreate Template## Positional Arguments# body | dictklaviyo.Templates.create_template(body)Create Template Clone## Positional Arguments# body | dictklaviyo.Templates.create_template_clone(body)Create Template Render## Positional Arguments# body | dictklaviyo.Templates.create_template_render(body)Delete Template## Positional Arguments# id | strklaviyo.Templates.delete_template(id)Get Template## Positional Arguments# id | str## Keyword Arguments# fields_template | List[str]klaviyo.Templates.get_template(id,fields_template=fields_template)Get Templates## Keyword Arguments# fields_template | List[str]# filter | str# page_cursor | str# sort | strklaviyo.Templates.get_templates(fields_template=fields_template,filter=filter,page_cursor=page_cursor,sort=sort)Update Template## Positional Arguments# id | str# body | dictklaviyo.Templates.update_template(id,body)AppendixGlobal Keyword ArgsNOTE: These are arguments that you can apply to any endpoint call, and which are unique to the SDKWe currently support the following global keyword args:_request_auth: use this to override the client-level api_key which you define upon client instantiationRefresher on catching exceptions:try:YOUR_CALLexceptExceptionase:print(e.status)print(e.reason)print(e.body)print(e.headers)Parameters & ArgumentsThe parameters follow the same naming conventions as the resource groups and operations.We stick to the following convention for parameters/argumentsAll parameters are passed as function args.All query and path params that are tagged asrequiredin the docs are passed as positional args.All optional query params are passed as keyword args.Where applicable, thebodyparam is passed in as a positional arg, and is expected to be a native python dictionary. Within that dictionary, refer to the API docs to see which fields are required/optional, along with valid values.There is no need to pass in your privateapi_keyfor any operations, as it is defined upon client instantiation; public key is still required where applicable. However, you can pass in an optional_request_authkwarg to override the client private key for a specific call (REMINDER: don't do this client-side).NamespaceIn the interest of making the SDK Pythonic, we made the following namespace changesrelativeto the language agnostic resources up top (API Docs, Guides, etc).Resource names use Title + Snake Casing, (e.g.Data_Privacy)function names and parameter names use snake case (e.g.get_metrics, andprofile_id)