Skip to main content

    Troubleshoot API-related issues

    Course overview
    Lesson
    1 min read

    Interpret API calls with logs

    Learn how to monitor your API calls to ensure everything is working as expected.

    Monitor your API calls

    In this lesson, we'll learn how to keep track of all of the API calls made to your account directly from Klaviyo.

    Check out this video to see a walkthrough of navigating the API logs tool.

    Elements of API logs

    Click on each dropdown below for detailed information on the elements that comprise an API log.

    Method

    You can see the method of the API call in the log overview:

    API logs dashboard

    Method is also seen in the details of each call:

    Log of a GET request
    Headers

    You can see Headers from within the details of each API call. This includes headers that are set in each Klaviyo API call, like Authorization and revision, as well as headers that are automatically set:

    Request headers shown in API log

    You may be surprised by how many headers are automatically set. These are put in place to set the request metadata, such as information about the format of the request and response body. You typically don't need to worry about these when troubleshooting, as they are rarely the cause of an API error.

    Body

    The Body can be seen in the details of each API call. This is how most data will be passed into your account via the Klaviyo API. For example, in a Placed Order event, use the body to pass in the products a customer ordered, how much each item was, the customer's shipping address, etc.

    The request body shown in the log is the exact body that was passed through as part of the corresponding API request:

    Body of an API request

    Any requests that do not have a body (like GET requests) will show "This request does not have a body."

    Query parameters

    You can see query parameters from within the details of each API call:

    Query parameters shown in API log

    Query parameters will generally be used for GET requests, when we are requesting information from Klaviyo instead of passing information into Klaviyo.

    Path parameters

    Path parameters do not have a specific section called "path parameters," but you can see them as part of the request URL from both the overview and the details under Request path. In this example, the POST request does not have any path parameters, but the GET request includes RcFaQ5, a path parameter representing the list to get information about:

    Requests with path parameters

    In this case, the Get List endpoint has a request URL of https://a.klaviyo.com/api/lists/{id}/, where {id} is the ID of the list in question.

    Response

    The response code shows up in the log overview:

    API logs showing response codes

    For more detailed information and the response body, click the Response tab to view the data that was returned from an API call. This can include more detailed information on why a call failed:

    Response body of API log

    Developer tools

    Klaviyo also offers an API dashboard, audit tool, and sample data generator that can be accessed from the Developer Tools page. Read on to learn more about these tools.

    Dashboard

    The dashboard shows an overview of all API calls being made into your account.

    You can filter by type of endpoint, status of the call, and timeframe. The graph will show the number of successful and unsuccessful calls, as well as the rate at which API calls run into errors.

    Use this page to monitor high-level trends and quickly check to see if any major issues are occurring.

    API endpoint audit tool

    Use the API endpoint audit tool to see a more detailed view of all of the API calls being made from your Klaviyo account.

    Exporting the API Report will download a CSV of the last 14 days of API usage data. This includes the endpoints being used, information about the private API keys used with each call, the number of requests made to each endpoint, and maybe most importantly, to review the current Klaviyo API revisions being used in your account.

    Use this report to make sure you are on the most recent version of Klaviyo's APIs, review API keys and labels, and get a deeper understanding of the most common endpoints being used.

    Sample data

    The sample data tab allows you to generate example marketing, ecommerce, and/or catalog data in your test account. This includes sample events, profiles, and catalog items.

    Use this sample data to practice retrieving and manipulating data from your test account.

    You can only generate each type of sample data (marketing, ecommerce, and catalog) once in each account.

    Interpret API calls with logs