GitHub project

Authentication

To use the SDK, you need a public API key (beginning with pk_) to send data to Customer.io. If you upgrade from an earlier SDK version, or use in-app messaging with an Expo plugin version before 4.2.0, you also need your Site ID.

These keys come from different places in Customer.io!

Which key goes in your app

Your app uses a public key, which starts with pk_. Public keys are safe to include in your app. Private keys start with sk_ and have much broader access to your workspace, so keep them in your backend systems where your users can’t get to them. See public and private keys.

  1. Public API key: This key starts with pk_ and is shown in code samples as cdpApiKey. You’ll get this key when you set up your mobile app as a data-in integration in Customer.io, or you can create one for an existing integration on the API Credentials page.
  2. Site ID: If you’re upgrading from a previous version of the Customer.io SDK, you set your Site ID as the migrationSiteId. In Expo plugin versions before 4.2.0, you also need it in the inApp option to support in-app messages. In 4.2.0 and later, the SDK uses your public key for in-app messages instead.

Get your public key

You’ll use your public key to initialize the SDK and send data to Customer.io; you’ll get this key from your Expo entry under Integrations. If you don’t see your app on this page, you’ll need to add a new integration.

  1. Go to Integrations.
  2. Go to the Connections tab and find the entry for your Expo app. If you don’t see Expo in the list of connections, you’ll need to add a new integration.
    the connections page, showing an expo integration connected to a journeys destination
  3. Go to Settings and find your public key. It starts with pk_. Copy this key and use it in your app configuration.
    The API keys section of your integration's Settings tab, showing your public key

Add the key to the config object in your app.json file:

JSON
{
   "expo": {
      "plugins": [
         [
            "customerio-expo-plugin",
            {
               "config": {
                  "cdpApiKey": "<CDP_API_KEY>",
                  "region": "us", // use "eu" if in EU region
                  "siteId": "<SITE_ID>", // Required for in-app messaging, unless your key starts with pk_ and inApp.enabled is true
                  "migrationSiteId": "<OLD_SITE_ID>" // Required if migrating from an earlier version
               },
               "android": {
                  "googleServicesFile": "./files/google-services.json",
                  "setHighPriorityPushHandler": true
               },
               "ios": {
                  "pushNotification": {
                     "useRichPush": true
                  }
               }
            }
         ]
      ]
   }
}

Add the key to the customerio-expo-plugin object in your app.json file and your app’s code:

In app.json:

JSON
{
   "expo": {
      "plugins": [
         [
            "customerio-expo-plugin",
            {
               "android": {
                  "googleServicesFile": "./files/google-services.json",
                  "setHighPriorityPushHandler": true
               },
               "ios": {
                  "pushNotification": {
                     "useRichPush": true,
                     "env": {
                        "cdpApiKey": "<CDP_API_KEY>",
                        "region": "us"
                     }
                  }
               }
            }
         ]
      ]
   }
}

In your app’s code:

TYPESCRIPT
import { CioRegion, CustomerIO, CioConfig } from 'customerio-reactnative';

const App = () => {
   useEffect(() => {
      const config: CioConfig = {
         cdpApiKey: 'CDP API Key', // Mandatory
         migrationSiteId: 'siteId', // Required if migrating from an earlier version
         region: CioRegion.US,
         inApp: {
            siteId: '<your_site_id>',
         },
      };
      CustomerIO.initialize(config);
   }, []);
};

Add a new integration

If you don’t already have a public key, you’ll need to set up a new connection . The connection represents your app and the stream of data that you’ll send to Customer.io.

  1. Go to Integrations and click Add integration.
  2. Select Expo.
  3. Enter a Name for the integration, like “My Expo App”.
  4. Click the Copy and paste code tab. The code sample includes your public key (beginning with pk_) as cdpApiKey. Copy this key and keep it handy; you’ll need it to initialize the SDK in your Expo app.
    The integration setup screen, with a name for your integration and a code sample that includes your public key
  5. Click Test connection to check that Customer.io receives data from your app, and then click Complete setup. If you aren’t ready to test your app yet, click Save for later.

Get your Site ID

If you’re upgrading from a previous version of the SDK, you set your Site ID as your migrationSiteId. The SDK uses it to send remaining tasks to Customer.io when your audience updates your app.

If you use an Expo plugin version before 4.2.0, you also need your Site ID in the inApp option. In 4.2.0 and later, the SDK uses your public key for in-app messages, so you can leave out the Site ID and pass an empty inApp object, or set config.inApp.enabled to true if you use auto-initialization.

  1. Go to Settings > Workspace Settings in the upper-right corner of the Customer.io app and go to API and Webhook Credentials.

  2. Copy the Site ID for the set of credentials that you want to send your in-app messages from. If you don’t have a set of credentials, click Create Tracking API Key.

    find your site ID
  3. Use this Site ID to enable in-app messaging:

Add the Site ID to your app.json configuration:

JSON
{
   "expo": {
      "plugins": [
         [
            "customerio-expo-plugin",
            {
               "config": {
                  "cdpApiKey": "<CDP_API_KEY>",
                  "region": "us",
                  "siteId": "<SITE_ID>"
               }
            }
         ]
      ]
   }
}

Use the Site ID in your app’s code to initialize the inApp package:

TYPESCRIPT
import {
  CioLogLevel, CioRegion, CustomerIO, CioConfig
} from 'customerio-reactnative';

const App = () => {

useEffect(() => {
   const config: CioConfig = {
      cdpApiKey: 'CDP API Key', // Mandatory
      migrationSiteId: 'siteId', // Required if migrating from an earlier version
      region: CioRegion.US,
      logLevel: CioLogLevel.Debug,
      trackApplicationLifecycleEvents: true,
      inApp: {
         siteId: 'site_id',
      },
   };
   CustomerIO.initialize(config)
   }, [])
}

Securing your credentials

To simplify things, code samples in our documentation sometimes show API keys directly in your code. But you don’t have to hard-code your keys in your app. You can use environment variables, management tools that handle secrets, or other methods to keep your keys secure if you’re concerned about security.

To be clear, the keys that you’ll use to initialize the SDK don’t provide read access to data in Customer.io; they only write data to Customer.io. A bad actor who found your credentials can’t use your keys to read data from our servers.

Updated October 30, 2026