- SDK version: 3.0.0
- API Revision: 2023-02-22
This SDK is a thin wrapper around our API. See our API Reference for full documentation on behavior.
This SDK mirrors the organization and naming convention of the above language-agnostic resources, with a few namespace changes to conform to PHP idioms (details in Appendix).
This SDK is organized into the following resources:
-
Campaigns
-
Catalogs
-
Client
-
DataPrivacy
-
Events
-
Flows
-
Lists
-
Metrics
-
Profiles
-
Segments
-
Tags
-
Templates
You can install this package using our Packagist package:
composer require klaviyo/api
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use KlaviyoAPI\KlaviyoAPI;
$klaviyo = new KlaviyoAPI(
'YOUR_API_KEY',
$num_retries = 3,
$wait_seconds = 3,
$guzzle_options = []);
$response = $klaviyo->Metrics->getMetrics();
- The SDK retries on resolvable errors, namely: rate limits (common) and server errors on Klaviyo's end (rare).
- The keyword arguments in the example above define retry behavior
wait_seconds
denotes how long to wait per retry, in seconds- If you wish to disable retries, set
$num_retries = 0
- the example is populated with the default values
- non-resolvable errors and resolvable errors which have timed out throw an
ApiException
, detailed below.
This SDK throws an ApiException
error when the server returns a non resolvable response, or a resolvable non-2XX
response times out.
If you'd like to extend error handling beyond what the SDK supports natively, you can use the following methods to retrieve the corresponding attributes from the ApiException
object:
getCode() : int
getMessage() : str
getReponseBody() : bytes
getResponseHeaders() : string[]
For example:
try {
$klaviyo->Metrics->getMetrics();
} catch (Exception $e) {
if ($e->getCode() == SOME_INTEGER) {
doSomething();
}
}
- The main difference between this SDK and the language-agnostic API Docs that the below endpoints link to is that this SDK automatically adds the
revision
header corresponding to the SDK version. - Organization: Resource groups and functions are listed in alphabetical order, first by Resource name, then by OpenAPI Summary. Operation summaries are those listed in the right side bar of the API Reference. These summaries link directly to the corresponding section of the API reference.
- For example values / data types, as well as whether parameters are required/optional, please reference the corresponding API Reference link.
- Some keyword args are required for the API call to succeed, the API docs above are the source of truth regarding which keyword args are required.
- JSON payloads should be passed in as associative arrays
- A strange quirk of PHP is that default/optional arguments must be passed in in order, and MUST be included and set as
null
, at least up to the last default value you wish to use.- For example, if a given function has the following optional parameters
someFunction($a=1, $b=2, $c=3)
, and you wish to only set$b
, you MUST pass insomeFunction($a=null, $b=$YOUR_VALUE)
- Otherwise, if you pass in something such as
someFunction($b=$YOUR_VALUE)
, PHP will actually assign the$YOUR_VALUE
to parameter$a
, which is wrong.
- For example, if a given function has the following optional parameters
$api_key
is optional, as it is set at client-level. However, you can override the client key wherever by passing in$api_key
as the LAST optional param. Reminder: DO NOT use private API keys client-side / onsite.- Paging: Where applicable,
$page_cursor
can be passed in either as a parsed string, or as the entireself.link
response returned by paged API endpoints.
## Positional Arguments
# $body | associative array
$klaviyo->Campaigns->createCampaign($body);
## Positional Arguments
# $body | associative array
$klaviyo->Campaigns->createCampaignClone($body);
## Positional Arguments
# $body | associative array
$klaviyo->Campaigns->createCampaignMessageAssignTemplate($body);
## Positional Arguments
# $body | associative array
$klaviyo->Campaigns->createCampaignRecipientEstimationJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Campaigns->createCampaignSendJob($body);
## Positional Arguments
# $id | string
$klaviyo->Campaigns->deleteCampaign($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_campaign | string[]
# $fields_tag | string[]
# $include | string[]
$klaviyo->Campaigns->getCampaign($id, $fields_campaign=$fields_campaign, $fields_tag=$fields_tag, $include=$include);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_campaign_message | string[]
$klaviyo->Campaigns->getCampaignMessage($id, $fields_campaign_message=$fields_campaign_message);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_campaign_recipient_estimation | string[]
$klaviyo->Campaigns->getCampaignRecipientEstimation($id, $fields_campaign_recipient_estimation=$fields_campaign_recipient_estimation);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_campaign_recipient_estimation_job | string[]
$klaviyo->Campaigns->getCampaignRecipientEstimationJob($id, $fields_campaign_recipient_estimation_job=$fields_campaign_recipient_estimation_job);
## Positional Arguments
# $id | string
$klaviyo->Campaigns->getCampaignRelationshipsTags($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_campaign_send_job | string[]
$klaviyo->Campaigns->getCampaignSendJob($id, $fields_campaign_send_job=$fields_campaign_send_job);
## Positional Arguments
# $campaign_id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Campaigns->getCampaignTags($campaign_id, $fields_tag=$fields_tag);
## Keyword Arguments
# $fields_campaign | string[]
# $fields_tag | string[]
# $filter | string
# $include | string[]
# $page_cursor | string
# $sort | string
$klaviyo->Campaigns->getCampaigns($fields_campaign=$fields_campaign, $fields_tag=$fields_tag, $filter=$filter, $include=$include, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Campaigns->updateCampaign($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Campaigns->updateCampaignMessage($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Campaigns->updateCampaignSendJob($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->createCatalogCategory($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->createCatalogCategoryRelationshipsItems($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->createCatalogItem($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->createCatalogItemRelationshipsCategories($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->createCatalogVariant($body);
## Positional Arguments
# $id | string
$klaviyo->Catalogs->deleteCatalogCategory($id);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->deleteCatalogCategoryRelationshipsItems($id, $body);
## Positional Arguments
# $id | string
$klaviyo->Catalogs->deleteCatalogItem($id);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->deleteCatalogItemRelationshipsCategories($id, $body);
## Positional Arguments
# $id | string
$klaviyo->Catalogs->deleteCatalogVariant($id);
## Keyword Arguments
# $fields_catalog_category | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogCategories($fields_catalog_category=$fields_catalog_category, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_catalog_category | string[]
$klaviyo->Catalogs->getCatalogCategory($id, $fields_catalog_category=$fields_catalog_category);
## Positional Arguments
# $category_id | string
## Keyword Arguments
# $fields_catalog_item | string[]
# $fields_catalog_variant | string[]
# $filter | string
# $include | string[]
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogCategoryItems($category_id, $fields_catalog_item=$fields_catalog_item, $fields_catalog_variant=$fields_catalog_variant, $filter=$filter, $include=$include, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $page_cursor | string
$klaviyo->Catalogs->getCatalogCategoryRelationshipsItems($id, $page_cursor=$page_cursor);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_catalog_item | string[]
# $fields_catalog_variant | string[]
# $include | string[]
$klaviyo->Catalogs->getCatalogItem($id, $fields_catalog_item=$fields_catalog_item, $fields_catalog_variant=$fields_catalog_variant, $include=$include);
## Positional Arguments
# $item_id | string
## Keyword Arguments
# $fields_catalog_category | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogItemCategories($item_id, $fields_catalog_category=$fields_catalog_category, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $page_cursor | string
$klaviyo->Catalogs->getCatalogItemRelationshipsCategories($id, $page_cursor=$page_cursor);
## Positional Arguments
# $item_id | string
## Keyword Arguments
# $fields_catalog_variant | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogItemVariants($item_id, $fields_catalog_variant=$fields_catalog_variant, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Keyword Arguments
# $fields_catalog_item | string[]
# $fields_catalog_variant | string[]
# $filter | string
# $include | string[]
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogItems($fields_catalog_item=$fields_catalog_item, $fields_catalog_variant=$fields_catalog_variant, $filter=$filter, $include=$include, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_catalog_variant | string[]
$klaviyo->Catalogs->getCatalogVariant($id, $fields_catalog_variant=$fields_catalog_variant);
## Keyword Arguments
# $fields_catalog_variant | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Catalogs->getCatalogVariants($fields_catalog_variant=$fields_catalog_variant, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_category_bulk_create_job | string[]
# $fields_catalog_category | string[]
# $include | string[]
$klaviyo->Catalogs->getCreateCategoriesJob($job_id, $fields_catalog_category_bulk_create_job=$fields_catalog_category_bulk_create_job, $fields_catalog_category=$fields_catalog_category, $include=$include);
## Keyword Arguments
# $fields_catalog_category_bulk_create_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getCreateCategoriesJobs($fields_catalog_category_bulk_create_job=$fields_catalog_category_bulk_create_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_item_bulk_create_job | string[]
# $fields_catalog_item | string[]
# $include | string[]
$klaviyo->Catalogs->getCreateItemsJob($job_id, $fields_catalog_item_bulk_create_job=$fields_catalog_item_bulk_create_job, $fields_catalog_item=$fields_catalog_item, $include=$include);
## Keyword Arguments
# $fields_catalog_item_bulk_create_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getCreateItemsJobs($fields_catalog_item_bulk_create_job=$fields_catalog_item_bulk_create_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_variant_bulk_create_job | string[]
# $fields_catalog_variant | string[]
# $include | string[]
$klaviyo->Catalogs->getCreateVariantsJob($job_id, $fields_catalog_variant_bulk_create_job=$fields_catalog_variant_bulk_create_job, $fields_catalog_variant=$fields_catalog_variant, $include=$include);
## Keyword Arguments
# $fields_catalog_variant_bulk_create_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getCreateVariantsJobs($fields_catalog_variant_bulk_create_job=$fields_catalog_variant_bulk_create_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_category_bulk_delete_job | string[]
$klaviyo->Catalogs->getDeleteCategoriesJob($job_id, $fields_catalog_category_bulk_delete_job=$fields_catalog_category_bulk_delete_job);
## Keyword Arguments
# $fields_catalog_category_bulk_delete_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getDeleteCategoriesJobs($fields_catalog_category_bulk_delete_job=$fields_catalog_category_bulk_delete_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_item_bulk_delete_job | string[]
$klaviyo->Catalogs->getDeleteItemsJob($job_id, $fields_catalog_item_bulk_delete_job=$fields_catalog_item_bulk_delete_job);
## Keyword Arguments
# $fields_catalog_item_bulk_delete_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getDeleteItemsJobs($fields_catalog_item_bulk_delete_job=$fields_catalog_item_bulk_delete_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_variant_bulk_delete_job | string[]
$klaviyo->Catalogs->getDeleteVariantsJob($job_id, $fields_catalog_variant_bulk_delete_job=$fields_catalog_variant_bulk_delete_job);
## Keyword Arguments
# $fields_catalog_variant_bulk_delete_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getDeleteVariantsJobs($fields_catalog_variant_bulk_delete_job=$fields_catalog_variant_bulk_delete_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_category_bulk_update_job | string[]
# $fields_catalog_category | string[]
# $include | string[]
$klaviyo->Catalogs->getUpdateCategoriesJob($job_id, $fields_catalog_category_bulk_update_job=$fields_catalog_category_bulk_update_job, $fields_catalog_category=$fields_catalog_category, $include=$include);
## Keyword Arguments
# $fields_catalog_category_bulk_update_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getUpdateCategoriesJobs($fields_catalog_category_bulk_update_job=$fields_catalog_category_bulk_update_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_item_bulk_update_job | string[]
# $fields_catalog_item | string[]
# $include | string[]
$klaviyo->Catalogs->getUpdateItemsJob($job_id, $fields_catalog_item_bulk_update_job=$fields_catalog_item_bulk_update_job, $fields_catalog_item=$fields_catalog_item, $include=$include);
## Keyword Arguments
# $fields_catalog_item_bulk_update_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getUpdateItemsJobs($fields_catalog_item_bulk_update_job=$fields_catalog_item_bulk_update_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $job_id | string
## Keyword Arguments
# $fields_catalog_variant_bulk_update_job | string[]
# $fields_catalog_variant | string[]
# $include | string[]
$klaviyo->Catalogs->getUpdateVariantsJob($job_id, $fields_catalog_variant_bulk_update_job=$fields_catalog_variant_bulk_update_job, $fields_catalog_variant=$fields_catalog_variant, $include=$include);
## Keyword Arguments
# $fields_catalog_variant_bulk_update_job | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Catalogs->getUpdateVariantsJobs($fields_catalog_variant_bulk_update_job=$fields_catalog_variant_bulk_update_job, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnCreateCategoriesJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnCreateItemsJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnCreateVariantsJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnDeleteCategoriesJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnDeleteItemsJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnDeleteVariantsJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnUpdateCategoriesJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnUpdateItemsJob($body);
## Positional Arguments
# $body | associative array
$klaviyo->Catalogs->spawnUpdateVariantsJob($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->updateCatalogCategory($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->updateCatalogCategoryRelationshipsItems($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->updateCatalogItem($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->updateCatalogItemRelationshipsCategories($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Catalogs->updateCatalogVariant($id, $body);
## Positional Arguments
# $company_id | string
# $body | associative array
$klaviyo->Client->createClientEvent($company_id, $body);
## Positional Arguments
# $company_id | string
# $body | associative array
$klaviyo->Client->createClientProfile($company_id, $body);
## Positional Arguments
# $company_id | string
# $body | associative array
$klaviyo->Client->createClientSubscription($company_id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->DataPrivacy->requestProfileDeletion($body);
## Positional Arguments
# $body | associative array
$klaviyo->Events->createEvent($body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_event | string[]
# $fields_metric | string[]
# $fields_profile | string[]
# $include | string[]
$klaviyo->Events->getEvent($id, $fields_event=$fields_event, $fields_metric=$fields_metric, $fields_profile=$fields_profile, $include=$include);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_metric | string[]
$klaviyo->Events->getEventMetrics($id, $fields_metric=$fields_metric);
## Positional Arguments
# $id | string
## Keyword Arguments
# $additional_fields_profile | string[]
# $fields_profile | string[]
$klaviyo->Events->getEventProfiles($id, $additional_fields_profile=$additional_fields_profile, $fields_profile=$fields_profile);
## Positional Arguments
# $id | string
$klaviyo->Events->getEventRelationshipsMetrics($id);
## Positional Arguments
# $id | string
$klaviyo->Events->getEventRelationshipsProfiles($id);
## Keyword Arguments
# $fields_event | string[]
# $fields_metric | string[]
# $fields_profile | string[]
# $filter | string
# $include | string[]
# $page_cursor | string
# $sort | string
$klaviyo->Events->getEvents($fields_event=$fields_event, $fields_metric=$fields_metric, $fields_profile=$fields_profile, $filter=$filter, $include=$include, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_flow_action | string[]
# $fields_flow | string[]
# $include | string[]
$klaviyo->Flows->getFlow($id, $fields_flow_action=$fields_flow_action, $fields_flow=$fields_flow, $include=$include);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_flow_action | string[]
# $fields_flow_message | string[]
# $fields_flow | string[]
# $include | string[]
$klaviyo->Flows->getFlowAction($id, $fields_flow_action=$fields_flow_action, $fields_flow_message=$fields_flow_message, $fields_flow=$fields_flow, $include=$include);
## Positional Arguments
# $action_id | string
## Keyword Arguments
# $fields_flow | string[]
$klaviyo->Flows->getFlowActionFlow($action_id, $fields_flow=$fields_flow);
## Positional Arguments
# $action_id | string
## Keyword Arguments
# $fields_flow_message | string[]
# $filter | string
# $page_cursor | string
# $page_size | int
# $sort | string
$klaviyo->Flows->getFlowActionMessages($action_id, $fields_flow_message=$fields_flow_message, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $id | string
$klaviyo->Flows->getFlowActionRelationshipsFlow($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $filter | string
# $page_cursor | string
# $page_size | int
# $sort | string
$klaviyo->Flows->getFlowActionRelationshipsMessages($id, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $flow_id | string
## Keyword Arguments
# $fields_flow_action | string[]
# $filter | string
# $page_cursor | string
# $page_size | int
# $sort | string
$klaviyo->Flows->getFlowFlowActions($flow_id, $fields_flow_action=$fields_flow_action, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_flow_action | string[]
# $fields_flow_message | string[]
# $include | string[]
$klaviyo->Flows->getFlowMessage($id, $fields_flow_action=$fields_flow_action, $fields_flow_message=$fields_flow_message, $include=$include);
## Positional Arguments
# $message_id | string
## Keyword Arguments
# $fields_flow_action | string[]
$klaviyo->Flows->getFlowMessageAction($message_id, $fields_flow_action=$fields_flow_action);
## Positional Arguments
# $id | string
$klaviyo->Flows->getFlowMessageRelationshipsAction($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $filter | string
# $page_size | int
# $sort | string
$klaviyo->Flows->getFlowRelationshipsFlowActions($id, $filter=$filter, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $id | string
$klaviyo->Flows->getFlowRelationshipsTags($id);
## Positional Arguments
# $flow_id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Flows->getFlowTags($flow_id, $fields_tag=$fields_tag);
## Keyword Arguments
# $fields_flow_action | string[]
# $fields_flow | string[]
# $filter | string
# $include | string[]
# $page_cursor | string
# $page_size | int
# $sort | string
$klaviyo->Flows->getFlows($fields_flow_action=$fields_flow_action, $fields_flow=$fields_flow, $filter=$filter, $include=$include, $page_cursor=$page_cursor, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Flows->updateFlow($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Lists->createList($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Lists->createListRelationships($id, $body);
## Positional Arguments
# $id | string
$klaviyo->Lists->deleteList($id);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Lists->deleteListRelationships($id, $body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_list | string[]
$klaviyo->Lists->getList($id, $fields_list=$fields_list);
## Positional Arguments
# $list_id | string
## Keyword Arguments
# $additional_fields_profile | string[]
# $fields_profile | string[]
# $filter | string
# $page_cursor | string
# $page_size | int
$klaviyo->Lists->getListProfiles($list_id, $additional_fields_profile=$additional_fields_profile, $fields_profile=$fields_profile, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size);
## Positional Arguments
# $id | string
## Keyword Arguments
# $page_cursor | string
$klaviyo->Lists->getListRelationshipsProfiles($id, $page_cursor=$page_cursor);
## Positional Arguments
# $id | string
$klaviyo->Lists->getListRelationshipsTags($id);
## Positional Arguments
# $list_id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Lists->getListTags($list_id, $fields_tag=$fields_tag);
## Keyword Arguments
# $fields_list | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Lists->getLists($fields_list=$fields_list, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Lists->updateList($id, $body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_metric | string[]
$klaviyo->Metrics->getMetric($id, $fields_metric=$fields_metric);
## Keyword Arguments
# $fields_metric | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Metrics->getMetrics($fields_metric=$fields_metric, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $body | associative array
$klaviyo->Metrics->queryMetricAggregates($body);
## Positional Arguments
# $body | associative array
$klaviyo->Profiles->createProfile($body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $additional_fields_profile | string[]
# $fields_list | string[]
# $fields_profile | string[]
# $fields_segment | string[]
# $include | string[]
$klaviyo->Profiles->getProfile($id, $additional_fields_profile=$additional_fields_profile, $fields_list=$fields_list, $fields_profile=$fields_profile, $fields_segment=$fields_segment, $include=$include);
## Positional Arguments
# $profile_id | string
## Keyword Arguments
# $fields_list | string[]
$klaviyo->Profiles->getProfileLists($profile_id, $fields_list=$fields_list);
## Positional Arguments
# $id | string
$klaviyo->Profiles->getProfileRelationshipsLists($id);
## Positional Arguments
# $id | string
$klaviyo->Profiles->getProfileRelationshipsSegments($id);
## Positional Arguments
# $profile_id | string
## Keyword Arguments
# $fields_segment | string[]
$klaviyo->Profiles->getProfileSegments($profile_id, $fields_segment=$fields_segment);
## Keyword Arguments
# $additional_fields_profile | string[]
# $fields_profile | string[]
# $filter | string
# $page_cursor | string
# $page_size | int
# $sort | string
$klaviyo->Profiles->getProfiles($additional_fields_profile=$additional_fields_profile, $fields_profile=$fields_profile, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size, $sort=$sort);
## Positional Arguments
# $body | associative array
$klaviyo->Profiles->subscribeProfiles($body);
## Positional Arguments
# $body | associative array
$klaviyo->Profiles->suppressProfiles($body);
## Positional Arguments
# $body | associative array
$klaviyo->Profiles->unsubscribeProfiles($body);
## Positional Arguments
# $body | associative array
$klaviyo->Profiles->unsuppressProfiles($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Profiles->updateProfile($id, $body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_segment | string[]
$klaviyo->Segments->getSegment($id, $fields_segment=$fields_segment);
## Positional Arguments
# $segment_id | string
## Keyword Arguments
# $additional_fields_profile | string[]
# $fields_profile | string[]
# $filter | string
# $page_cursor | string
# $page_size | int
$klaviyo->Segments->getSegmentProfiles($segment_id, $additional_fields_profile=$additional_fields_profile, $fields_profile=$fields_profile, $filter=$filter, $page_cursor=$page_cursor, $page_size=$page_size);
## Positional Arguments
# $id | string
## Keyword Arguments
# $page_cursor | string
$klaviyo->Segments->getSegmentRelationshipsProfiles($id, $page_cursor=$page_cursor);
## Positional Arguments
# $id | string
$klaviyo->Segments->getSegmentRelationshipsTags($id);
## Positional Arguments
# $segment_id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Segments->getSegmentTags($segment_id, $fields_tag=$fields_tag);
## Keyword Arguments
# $fields_segment | string[]
# $filter | string
# $page_cursor | string
$klaviyo->Segments->getSegments($fields_segment=$fields_segment, $filter=$filter, $page_cursor=$page_cursor);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Segments->updateSegment($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Tags->createTag($body);
## Positional Arguments
# $body | associative array
$klaviyo->Tags->createTagGroup($body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->createTagRelationshipsCampaigns($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->createTagRelationshipsFlows($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->createTagRelationshipsLists($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->createTagRelationshipsSegments($id, $body);
## Positional Arguments
# $id | string
$klaviyo->Tags->deleteTag($id);
## Positional Arguments
# $id | string
$klaviyo->Tags->deleteTagGroup($id);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->deleteTagRelationshipsCampaigns($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->deleteTagRelationshipsFlows($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->deleteTagRelationshipsLists($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->deleteTagRelationshipsSegments($id, $body);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Tags->getTag($id, $fields_tag=$fields_tag);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_tag_group | string[]
$klaviyo->Tags->getTagGroup($id, $fields_tag_group=$fields_tag_group);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagGroupRelationshipsTags($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_tag | string[]
$klaviyo->Tags->getTagGroupTags($id, $fields_tag=$fields_tag);
## Keyword Arguments
# $fields_tag_group | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Tags->getTagGroups($fields_tag_group=$fields_tag_group, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagRelationshipsCampaigns($id);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagRelationshipsFlows($id);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagRelationshipsLists($id);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagRelationshipsSegments($id);
## Positional Arguments
# $id | string
$klaviyo->Tags->getTagRelationshipsTagGroup($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_tag_group | string[]
$klaviyo->Tags->getTagTagGroup($id, $fields_tag_group=$fields_tag_group);
## Keyword Arguments
# $fields_tag | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Tags->getTags($fields_tag=$fields_tag, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->updateTag($id, $body);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Tags->updateTagGroup($id, $body);
## Positional Arguments
# $body | associative array
$klaviyo->Templates->createTemplate($body);
## Positional Arguments
# $body | associative array
$klaviyo->Templates->createTemplateClone($body);
## Positional Arguments
# $body | associative array
$klaviyo->Templates->createTemplateRender($body);
## Positional Arguments
# $id | string
$klaviyo->Templates->deleteTemplate($id);
## Positional Arguments
# $id | string
## Keyword Arguments
# $fields_template | string[]
$klaviyo->Templates->getTemplate($id, $fields_template=$fields_template);
## Keyword Arguments
# $fields_template | string[]
# $filter | string
# $page_cursor | string
# $sort | string
$klaviyo->Templates->getTemplates($fields_template=$fields_template, $filter=$filter, $page_cursor=$page_cursor, $sort=$sort);
## Positional Arguments
# $id | string
# $body | associative array
$klaviyo->Templates->updateTemplate($id, $body);
NOTES:
- These are arguments that you can apply to any endpoint call, and which are unique to the SDK.
- They come LAST, AFTER ALL the endpoint-specific keyword args listed above, in the same order they are listed below.
- They are subject to the same quirks as any other PHP keyword args, in that to be included, they need to be preceeded by all keyword args listed before them. This includes all endpoint-specific keyword args for a given endpoint, along with any preceeding global keyword args listed below, if applicable. This holds even if those other keyword args are not being used; in that case, set those to
null
, but again, they must be included.
We currently support the following global keyword args:
$apiKey
: use this to override the client-levelapi_key
, which you define upon client instantiation.
In the interest of making the SDK conform to PHP idioms, we made the following namespace changes relative to the language agnostic resources up top (API Docs, Guides, etc).
- Underscores are stripped from function names (operation IDs)
- Function names use camelCase (e.g.
getMetrics
) - Resource names use PascalCase (e.g.
Metrics
) - Parameter names remain unchanged
We stick to the following convention for parameters/arguments
- All parameters are passed as function args.
- All optional params, as well as all Body and Form Data params (including required ones), are passed as keyword args.
- All query and path params that are tagged as
required
in the docs are passed as positional args. $api_key
is optional, as it is set at client level. However, you can override the client key wherever by passing in$api_key
as the LAST optional param. Reminder: don't do this client-side.