How to Export Klaviyo Profiles to an SFTP Server as CSV

Export Klaviyo list members, segment members or recently updated profiles to a CSV file and deliver it to an SFTP server every night, for your ERP, a loyalty platform, a mail house or an agency.

What This Integration Does

Klaviyo exports lists and segments to CSV from its interface, but someone has to click the button and send the file. Partners that receive data over SFTP, such as a POS or loyalty provider, an ERP's import folder or a direct mail house, need that file delivered automatically and in a fixed format. This Spojit workflow reads the profiles from the Klaviyo API, keeps the columns the receiver expects in the order they expect, writes the CSV, and uploads it to the partner's SFTP server with a dated name.

Each run creates a new file and changes nothing in Klaviyo. You choose whether a run exports everyone in a list or segment (a full file) or only profiles updated since the last run (a delta file), depending on what the receiving system can handle.

Prerequisites

  • A Klaviyo connection with read access to Profiles, Lists and Segments.
  • An FTP / SFTP connection to the destination server (password or private key).
  • The receiver's file specification: column names, order, date format, and folder.

Step 1: Schedule Trigger

Add a Trigger node with type Schedule and cron 0 2 * * *.

Step 2: Read the Profiles

Add a Klaviyo step in Direct Mode. Pick the source:

  • A list or segment: raw-api-request with GET and path /lists/YOUR_LIST_ID/profiles or /segments/YOUR_SEGMENT_ID/profiles.
  • Recently updated profiles: first a Date & Time subtract step named since (the trigger time minus 25 hours), then list-profiles with filter greater-than(updated,{{ since.iso }}).

Klaviyo returns up to 100 profiles per page with a links.next link. Wrap the step in a Loop in While mode that follows it, and collect the profiles. Name the result profiles.

Step 3: Shape the Columns

Add a Transform with Iterate over set to the profiles, using the receiver's column names in the order they want:

{
  "customer_email": "{{ item.attributes.email }}",
  "first_name": "{{ item.attributes.first_name }}",
  "last_name": "{{ item.attributes.last_name }}",
  "phone": "{{ item.attributes.phone_number }}",
  "postcode": "{{ item.attributes.location.zip }}",
  "loyalty_tier": "{{ item.attributes.properties.loyalty_tier }}",
  "klaviyo_id": "{{ item.id }}"
}

Reformat dates to the receiver's format with the Date & Time format tool if they do not accept ISO 8601.

Step 4: Build the CSV

Add CSV Tools from-json with data the shaped rows and header on. If the receiver needs a fixed column order, pass the column list in columns. Use the delimiter the receiver expects (some ERPs want ; or a tab). Name the output csv.

Step 5: Upload the File

Add an FTP / SFTP step with upload-file:

  • path: /inbound/klaviyo-profiles-{{ run_date.result }}.csv
  • content: the CSV text.

If the receiver polls the folder, upload to a temporary name first and then use rename to the final name, so they never pick up a half-written file.

Tips

  • Consent status: if the receiver must only contact subscribed people, request subscriptions with additional-fields[profile]=subscriptions and filter rows in the Transform or with CSV Tools filter.
  • Keep a copy: also save the file with a File Store node so you can resend it if the partner asks.
  • Delta files with a full weekly file: send changes nightly and a full file once a week, so the receiver can resynchronise if they miss a delta.
  • Character encoding: names with accents need UTF-8. Confirm the receiver reads UTF-8, especially older ERP imports.

Common Pitfalls

  • Segment versus list: segments are recalculated by Klaviyo, so their membership can change during a long export. Export at a quiet time.
  • Missing nested fields: profiles without a location or custom property leave those columns empty, which is usually fine; check the receiver does not reject empty values.
  • Folder permissions: an SFTP user that can read but not write the inbound folder fails at upload. Test with verify-connection and a small file first.
  • Personal data: this file is personal data leaving Klaviyo. Send only the columns the receiver needs and only over SFTP.

Testing

Export a small test list of five profiles, open the file on the SFTP server (or download it with download-file), and check it against the receiver's specification: columns, order, delimiter and encoding. Send the sample to the receiver for approval, then switch the source to the real list and turn on the schedule.

Learn More

Ready to build this?

Start on the free plan: 500 AI credits a month, no card needed.

Start free

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.