Skip to main content

    Make API calls to retrieve and manipulate data in your Klaviyo account

    Course overview
    Lesson
    3 min read

    Prepare your development environment

    Set up a test account where you can practice making API calls.

    Practice with a test account

    A big worry when starting to make API calls is fear of making a mistake that will affect the data in your Klaviyo account. To freely make API calls without impacting your real customer data, you can create a test account.

    Test accounts are great for practicing anything you do not want to affect your live account and data. Creating a test account is free, and you can label it as a test account to keep your learning playground clearly separate from your production account. You can safely use the same login for both accounts, and easily switch between them without fear of your actions in one account impacting the other.

    The following terminology will be used throughout this lesson:

    • Production account: your live Klaviyo account that contains all catalog and customer data.
    • Development environment: a custom setup created specifically for the purpose of testing out code.

    It's worth noting that this concept can be further connected to any development or sandbox environments you use in other platforms. For example, you may have access to a staging account in your ecommerce platform which allows you to test and experiment safely without risking your live data or customer experience.

    In this course, our development environment will be made up of a Klaviyo test account and the private API keys we generate for it.

    Create a test account and private API key

    Watch the following video to set up your development environment by creating a test account and private API key. These steps will ensure you are ready to start making API calls.

    Private API keys are confidential and allow you to authorize your API calls to interact with your Klaviyo account. You should treat your private API keys like passwords. Never reveal them to anyone not authorized to develop or integrate into your account. You can copy private API keys from your Klaviyo account without revealing the keys, as demonstrated in the following video. Please note that you can only copy your private API key when you first set it up.

    Use your test account throughout this course and any time you would like to try anything in Klaviyo without affecting your production data.

    Generate sample data

    Finally, let's populate your new test account with some sample data. Follow the steps below to generate sample data:

    1. Navigate to the sample data generation tool. Note: make sure you are logged into your new test account!
    2. Check the boxes for Marketing Data, Ecommerce Data, and Catalog data.
    3. Click Add Data.
    Klaviyo's sample data generator tool

    This will generate sample profiles, ecommerce events, and catalog data in your test account. This is not mandatory, but will be helpful when we start examining the data in your account with APIs. Please note that you can only generate each kind of sample data once. Read more about generating sample data.

    Resources

    Reference these guides for more information on setting up your development environment:

    Prepare your development environment