> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instantcampaign.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Segment

> Send identify, track and page calls from Segment to create and update contacts, record events and start Website Event journeys.

With the Segment integration, InstantCampaign becomes a destination in your Segment workspace:

* **identify** calls create or update contacts.
* **track** and **page** calls are recorded as events and can start journeys.

<Note>
  Segment needs the **Pro** or **Enterprise** plan. Only **Owners** and **Admins** can connect, pause, regenerate or disconnect it.
</Note>

## Connect

<Steps>
  <Step title="Create a write key">
    Go to **Settings → Developers → Integrations**. Under **Segment CDP**, click **Connect Segment**.
  </Step>

  <Step title="Copy the write key now">
    The write key is shown once, with the warning "Save your write key now — it will not be shown again." Copy it somewhere safe. Afterwards the card shows only its **Write key prefix**.
  </Step>

  <Step title="Copy the ingest URL">
    Copy the **Ingest URL** shown on the card. This is where Segment sends events.
  </Step>

  <Step title="Add the destination in Segment">
    Click **How to configure in Segment dashboard** for these steps:

    1. In your Segment workspace, go to **Connections → Destinations**.
    2. Click **Add Destination** and search for **Webhooks (Actions)** or **HTTP API**.
    3. Set the **Endpoint URL** to the ingest URL.
    4. Add a header named `X-Write-Key` with your write key as its value.
    5. Enable the destination and map your **identify**, **track** and **page** calls.
  </Step>
</Steps>

## What each call does

| Call       | Effect in InstantCampaign                                                                                                                                                                                        |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `identify` | Uses `traits.email` to create a contact, or updates the existing one. `traits.firstName` / `traits.first_name` and `traits.lastName` / `traits.last_name` set the name. Calls without a valid email are ignored. |
| `track`    | Records a custom event named after `event`, with its `properties`.                                                                                                                                               |
| `page`     | Records an event named `page`, with its `properties`.                                                                                                                                                            |

For `track` and `page`, the contact is found by `traits.email`, then `properties.email`, then `userId` if it's an email address. The event is recorded even when no contact matches, but a journey can only start for a known contact.

New contacts created by `identify` have the **Active** status and the source `segment`.

<Warning>
  Only send `identify` calls for people who have agreed to receive your email. Contacts created from Segment are **Active** and can be mailed straight away.
</Warning>

## Start journeys from Segment events

Create a journey with the **Website Event** trigger and enter the Segment event name exactly, for example `Order Completed`. For page calls, use `page`. When a matching `track` or `page` call arrives for a known contact whose status is **Active**, the contact enters the journey, and the event's properties are available to later steps. See [Automation triggers](/guides/audience-and-campaigns/automation-triggers#website-event).

## Manage the connection

* **Pause** stops accepting events and shows the card as **Paused**. **Resume** turns it back on.
* **Regenerate Key** creates a new write key and shows it once. The old key stops working, so update the header in Segment straight away.
* **Disconnect** invalidates the write key and stops receiving events. Existing contacts and events aren't affected.

## Limits

Each write key can send up to **200 requests per minute**. Requests over the limit are refused with HTTP 429.

## Troubleshooting

| What you see                         | What to do                                                                                                                                                                             |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Segment reports 401 errors           | The `X-Write-Key` header is missing or has an old key. Paste the current key, or regenerate one.                                                                                       |
| Segment reports 403 errors           | The integration is paused. Click **Resume**.                                                                                                                                           |
| Segment reports 429 errors           | You're sending more than 200 requests a minute. Reduce the volume, or send only the events you use.                                                                                    |
| Events arrive, but no journey starts | Check that the journey is active with a **Website Event** trigger, that the event name matches exactly, that the call carries the contact's email, and that the contact is **Active**. |
| `identify` doesn't create a contact  | The call has no `traits.email`, or the value isn't an email address.                                                                                                                   |
