{
 "kind": "api",
 "slug": "twilio-segment",
 "path": "apis/twilio-segment/",
 "name": "Twilio Segment",
 "logo": "https://agentgid.com/media/avatars/segmentio.png",
 "maker": "Twilio",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "Business apps with APIs",
   "apis/business-apps/"
  ]
 ],
 "lead": "Collect user events once, send them everywhere.",
 "chips": [
  {
   "label": "Business apps with APIs",
   "path": "apis/business-apps/"
  },
  {
   "label": "Up · live status",
   "live": true
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Add Twilio Segment tracking: @segment/analytics-next in the browser with the source write key, analytics.identify() after sign-in and analytics.track() for Signed Up and Order Completed; send payments from the server with @segment/analytics-node and await analytics.flush() in serverless functions."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://segment.com"
  },
  {
   "label": "Pricing",
   "href": "https://www.twilio.com/en-us/products/connections/pricing"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/segmentio/analytics-next"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Free every month",
   "status": "yes",
   "sub": "Then from $120/mo",
   "quote": "Team plans includes a 14-day free trial, so you can test paid features before you commit.",
   "note": "Free tier: Free: $0/month, 1,000 visitors/mo, 2 sources. As reported on the official pricing page, checked Oct 10, 2026.",
   "src": "https://www.twilio.com/en-us/products/connections/pricing"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "With conditions",
   "status": "cond",
   "sub": null,
   "quote": "you will not transfer, resell, or make available to third parties our services, except to your end users as part of the software applications you develop or products and services you offer",
   "note": "Allowed inside your own app or product; you must give notice and have the consents needed to collect your users' data, and may not resell the service by itself.",
   "src": "https://www.twilio.com/en-us/legal/tos"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key",
   "status": "info",
   "sub": "Env var none read automatically; the libraries take writeKey in code (keep it in your own variable, for example SEGMENT_WRITE_KEY)",
   "quote": "Choose between writeKey authentication, basic authentication and OAuth to authenticate requests.",
   "note": "Source write key, in the request body (writeKey), as the Basic auth user name with an empty password, or an OAuth bearer token plus the write key",
   "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/server/http-api.md"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "info",
   "sub": "SDK",
   "quote": "Read-only: The server provides API search and documentation retrieval.",
   "note": "Read-only; it searches Twilio docs, including the Segment docs, and does not send or read your events. Our agent check: 3 of 6 (Nov 13, 2026).",
   "src": "https://www.twilio.com/docs/ai/mcp.md"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Oct 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Twilio Segment does",
   "parts": [
    {
     "t": "prose",
     "text": "Twilio Segment is an online service that collects what people do in your site or app, such as sign-ups and purchases, through one piece of tracking code. It then passes those events on to the other tools you use, like analytics, email or a data warehouse. You add or switch tools in Segment's dashboard instead of adding new tracking code for each one."
    },
    {
     "t": "list",
     "items": [
      "Twilio Segment is one of 33 APIs in the Business apps with APIs category on AgentGid.",
      "Its cheapest paid plan ($120 a month) is the 30th cheapest of the 32 here with a monthly plan.",
      "It is one of 23 that can be started for free.",
      "16 of them ship an official MCP server; Twilio Segment does not.",
      "Its official SDK is the 1st most downloaded in the category (5.4M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "One tracking code for many tools",
       "text": "Record sign-ups, page views and purchases on your website once, and send them to analytics, email and ad tools you switch on in the dashboard.",
       "idea": false
      },
      {
       "title": "Purchases recorded on the server",
       "text": "Send payments and other important events from your server, where ad blockers cannot stop them and the numbers stay reliable.",
       "idea": false
      },
      {
       "title": "All events in your data warehouse",
       "text": "Keep a full copy of every event in your own warehouse, so you can run your own reports on it later.",
       "idea": false
      },
      {
       "title": "Know when an email was opened",
       "text": "Count email opens and similar events in places where no code can run, using a tiny tracking image.",
       "idea": false
      },
      {
       "title": "Delete a user's data on request",
       "text": "When a customer asks to be forgotten, remove and block their data across all your sources with one request.",
       "idea": false
      },
      {
       "title": "Same customer across web and app",
       "text": "Recognize that the visitor on your website and the user in your mobile app are the same person, so they count once.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Twilio Segment popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "4.3M",
       "l": "SDK downloads a week",
       "d": "+52.8% on the 4-week average",
       "up": true
      },
      {
       "n": "6",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "480",
       "l": "GitHub stars, segmentio/analytics-next"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "Free: $0/month, 1,000 visitors/mo, 2 sources"
      },
      {
       "l": "Cheapest plan",
       "v": "$120 a month"
      },
      {
       "l": "Usage price",
       "v": "Team: starts at $120/month incl. 10,000 visitors/mo; extra 1,000 MTUs +$12 (10K–25K), +$11 (25K–100K), +$10 (100K+)"
      },
      {
       "l": "Plans",
       "v": "Billed by monthly tracked users (MTUs). Team includes a 14-day free trial; Business/CDP plans use custom pricing."
      }
     ]
    },
    {
     "t": "h3",
     "text": "What one action costs"
    },
    {
     "t": "table",
     "head": [
      "Action",
      "Price"
     ],
     "num": true,
     "rows": [
      [
       "10,000 monthly tracked users (Team plan)",
       "$120"
      ],
      [
       "1,000 extra monthly tracked users between 10K and 25K (Team)",
       "$12"
      ],
      [
       "1,000 extra monthly tracked users above 100K (Team)",
       "$10"
      ]
     ]
    },
    {
     "t": "more",
     "items": [
      {
       "title": "Price history",
       "items": [
        "A year of the pricing page in the Internet Archive (12 months): the lowest monthly figure went from $120 (2025-10) to $120 (2026-09)."
       ]
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Oct 10, 2026. Prices change: confirm before you buy.",
     "link": "twilio.com/en-us/products/connections/pricing",
     "href": "https://www.twilio.com/en-us/products/connections/pricing"
    }
   ]
  },
  {
   "id": "limits",
   "nav": null,
   "spy_as": "pricing",
   "h2": "Limits",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free",
       "v": "1,000 visitors (monthly tracked users) a month and 2 sources",
       "src": "https://www.twilio.com/en-us/products/connections/pricing"
      },
      {
       "l": "Team",
       "v": "10,000 monthly tracked users included, unlimited sources",
       "src": "https://www.twilio.com/en-us/products/connections/pricing"
      },
      {
       "l": "All plans",
       "v": "About 1,000 requests a second per workspace on the HTTP API; more may be queued or rejected with 429",
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/server/http-api.md"
      },
      {
       "l": "All plans",
       "v": "32 KB per request and per event; 500 KB and up to 2,500 events per batch request",
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/server/http-api.md"
      },
      {
       "l": "Plans with a throughput limit",
       "v": "A set number of API calls per paid MTU a month (for example 250)",
       "src": "https://www.twilio.com/docs/segment/guides/usage-and-billing/mtus-and-throughput.md"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official docs.",
     "link": "twilio.com/en-us/products/connections/pricing",
     "href": "https://www.twilio.com/en-us/products/connections/pricing"
    }
   ]
  },
  {
   "id": "status",
   "nav": "Status",
   "h2": "Status and incidents",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Right now",
       "v": "Up",
       "status": "yes",
       "sub": "All Systems Operational"
      },
      {
       "l": "Last 30 days",
       "v": "3 incidents, 1 of them major"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official status page, checked Nov 26, 2026.",
     "link": "status.segment.com",
     "href": "https://status.segment.com"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "Source write key, in the request body (writeKey), as the Basic auth user name with an empty password, or an OAuth bearer token plus the write key"
      },
      {
       "l": "Environment variable",
       "v": "none read automatically; the libraries take writeKey in code (keep it in your own variable, for example SEGMENT_WRITE_KEY)",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "Yes",
       "status": "yes"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Create a Segment workspace (free) and add a source for the website or server; copy its write key. Put the write key in the site config, or in .env as SEGMENT_WRITE_KEY for server code.",
      "Turn on the destinations (analytics, email, warehouse) in the Segment app and connect their accounts. No code change; the same track and identify calls reach the new tools.",
      "Add a cookie consent banner if your visitors need one; Segment's own consent tool is Business-only. Load Segment only after the visitor has agreed, where the law requires it."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "Segment is a paid online service with a free plan, and you may use it in your own products. You must give your visitors proper notice and get the consents the law requires before you collect their data."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "With conditions",
       "status": "cond",
       "sub": "Allowed inside your own app or product; you must give notice and have the consents needed to collect your users' data, and may not resell the service by itself.",
       "quote": "you will not transfer, resell, or make available to third parties our services, except to your end users as part of the software applications you develop or products and services you offer",
       "src": "https://www.twilio.com/en-us/legal/tos"
      },
      {
       "l": "inside-app-bundle",
       "v": "Yes",
       "status": "yes",
       "sub": "The browser and Node.js packages are MIT licensed; the website write key may ship in the page.",
       "quote": "\"license\":\"MIT\"",
       "src": "https://registry.npmjs.org/@segment/analytics-next/1.84.3"
      },
      {
       "l": "client-work",
       "v": "With conditions",
       "status": "cond",
       "sub": "Fine for client sites; the account owner stays responsible under the terms, so set up the workspace in the client's name.",
       "quote": "If you reassign your account to a third-party reseller, you are still responsible for your obligations under these Terms.",
       "src": "https://www.twilio.com/en-us/legal/tos"
      },
      {
       "l": "Keeps your data",
       "v": "Raw event history is kept 180 days on Free, 365 days on Team and 3 years on Business.",
       "quote": "Free | 180 days | Not applicable | 60 days | 180 days | Not applicable",
       "src": "https://www.twilio.com/docs/segment/privacy/data-retention-policy.md"
      },
      {
       "l": "Where data is stored",
       "v": "Data goes to Oregon (US) by default; Business plans can use the Dublin region.",
       "quote": "For Business plans with access to Regional Segment, you can use the host configuration parameter to send data to the desired region",
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/server/http-api.md"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "200 but the event never arrives",
       "v": "Segment answers 200 even when it drops an event, for example one with no userId or anonymousId, a Track with no event name, or too many events in a batch.",
       "sub": "Open the source's Debugger, and make sure every payload has userId or anonymousId and every Track has an event name."
      },
      {
       "l": "400 Bad Request",
       "v": "The payload is larger than 32 KB (500 KB for a batch) or the JSON is broken.",
       "sub": "Make events smaller or split the batch, and check the JSON."
      },
      {
       "l": 429,
       "v": "The workspace sent more than the rate limit allows.",
       "sub": "Wait the seconds given in the Retry-After header, then retry; ask Segment for a higher limit if it keeps happening."
      },
      {
       "l": "5xx",
       "v": "Your client is calling an old IP address of the HTTP API.",
       "sub": "Do not cache Segment's IP; resolve api.segment.io again (at least once every 24 hours) and retry."
      },
      {
       "l": "No error, no events (EU workspace)",
       "v": "An EU workspace that sends to the default US address loses events without any error.",
       "sub": "Send to the Dublin address events.eu1.segmentapis.com for EU workspaces."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "3 of 6: llms.txt no, OpenAPI no, SDK yes, MCP no, status page yes, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "Twilio MCP server (docs search, public beta)",
       "sub": "claude mcp add --transport http twilio-docs https://mcp.twilio.com/docs"
      },
      {
       "l": "npm",
       "v": "npm install @segment/analytics-node",
       "code": true
      },
      {
       "l": "PyPI",
       "v": "pip install segment-analytics-python",
       "code": true
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Twilio Segment",
       "me": true,
       "facts": [
        "from $120/month incl",
        "Free tier"
       ]
      },
      {
       "name": "PostHog",
       "why": "Pick PostHog when you want analytics, session replay and feature flags in one product instead of routing events to other tools.",
       "path": "apis/posthog/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      },
      {
       "name": "Mixpanel",
       "why": "Pick Mixpanel when what you need is product analytics with session replay and experiments, not a data router.",
       "path": "apis/mixpanel/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      },
      {
       "name": "Heap",
       "why": "Pick Heap when you want an analytics tool that records user sessions and engagement directly.",
       "path": "apis/heap/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      }
     ],
     "more": "All business apps with apis APIs",
     "more_path": "apis/business-apps/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add Twilio Segment tracking: @segment/analytics-next in the browser with the source write key, analytics.identify() after sign-in and analytics.track() for Signed Up and Order Completed; send payments from the server with @segment/analytics-node and await analytics.flush() in serverless functions."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Sign up for a free Segment account, create a workspace and add a JavaScript source; Segment gives it a write key.",
       "code": null,
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md"
      },
      {
       "text": "Install the browser package in your site.",
       "code": "npm install @segment/analytics-next",
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md"
      },
      {
       "text": "Load it with the write key, then identify signed-in users and track a few key events.",
       "code": "import { AnalyticsBrowser } from '@segment/analytics-next'\n\nexport const analytics = AnalyticsBrowser.load({ writeKey: 'YOUR_WRITE_KEY' })",
       "src": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "curl --location 'https://api.segment.io/v1/track' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"event\": \"happy-path-a3ef8a6f-0482-4694-bc4d-4afba03a0eab\",\n    \"email\": \"test@example.org\",\n    \"userId\": \"123\",\n    \"writeKey\": \"DmBXIN4JnwqBnTqXccTF0wBnLXNQmFtk\"\n}'",
       "intro": "The docs show no response body; they say Segment answers 200 to every request except too-large payloads and broken JSON (400). Check the source's Debugger to see whether the event was accepted."
      },
      {
       "tab": "Response",
       "code": "200 OK"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Calling analytics.track() in a serverless function and returning right away.",
       "fix": "Create the client per call and await analytics.flush() before the function returns.",
       "why": "The runtime freezes or stops after the response, so queued events are lost."
      },
      {
       "dont": "Treating a 200 answer from the HTTP API as proof the event was stored.",
       "fix": "Check the source's Debugger, and always send userId or anonymousId and an event name.",
       "why": "Segment answers 200 even for events it rejects."
      },
      {
       "dont": "Sending from an EU workspace to api.segment.io.",
       "fix": "Use the Dublin host events.eu1.segmentapis.com for EU workspaces.",
       "why": "Events sent to the US address from an EU workspace disappear without an error."
      },
      {
       "dont": "Keeping the old Google Analytics or ad pixel snippet next to Segment.",
       "fix": "Remove the tool's own snippet once you turn it on as a Segment destination.",
       "why": "Both would send the same data, so every event counts twice."
      },
      {
       "dont": "Base64-encoding only the write key for Basic auth.",
       "fix": "Encode the write key followed by a colon, for example 'abc123:'.",
       "why": "Encoding without the colon works only for backward compatibility and may stop working."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Is there a free plan?",
       "a": "Yes. The Free plan stays free and covers up to 1,000 visitors a month.",
       "evidence": {
        "url": "https://www.twilio.com/en-us/products/connections/pricing",
        "quote": "The Free plan stays free permanently, capped at 1,000 visitors."
       }
      },
      {
       "q": "Is it safe to put the write key in my website?",
       "a": "Yes for website sources; the key is public by design. If that is not acceptable, track from your server instead.",
       "evidence": {
        "url": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md",
        "quote": "When you use Analytics.js in device-mode, the source's Write Key is public, because it runs in a user's browser and can be accessed using the browser's developer tools."
       }
      },
      {
       "q": "Do I need to call identify for every visitor?",
       "a": "No. Anonymous visitors get an anonymous ID automatically; call identify when someone signs up or logs in.",
       "evidence": {
        "url": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md",
        "quote": "You don't need to call Identify for anonymous visitors to your site."
       }
      },
      {
       "q": "What counts as one API call?",
       "a": "Each Track, Page, Screen, Identify, Group or Alias message sent to Segment counts as one call.",
       "evidence": {
        "url": "https://www.twilio.com/docs/segment/guides/usage-and-billing/mtus-and-throughput.md",
        "quote": "Each data blob (with its properties or traits) goes through this endpoint, and is considered one API call."
       }
      },
      {
       "q": "Should I remove my old analytics snippets?",
       "a": "Yes. Once a tool is connected through Segment, remove its own snippet so events are not sent twice.",
       "evidence": {
        "url": "https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/javascript/quickstart.md",
        "quote": "You should also remove other native third-party destination code that you might have on your site."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "Twilio"
  ],
  [
   "Category",
   "Business apps with APIs"
  ],
  [
   "Status",
   "Up · 3 incidents in 30 days"
  ],
  [
   "Price",
   "from $120/month incl"
  ],
  [
   "Plans from",
   "$120/mo"
  ],
  [
   "Official SDK",
   "npm @segment/analytics-node, PyPI segment-analytics-python"
  ],
  [
   "Latest SDK",
   "1.84.3 on npm"
  ],
  [
   "Agent check",
   "3 of 6"
  ],
  [
   "Pricing checked",
   "Oct 10, 2026"
  ]
 ],
 "good": [
  "You need a Segment workspace and a write key for each source. The free plan covers 1,000 visitors a month and 2 sources.",
  "You pay by the number of different users you track each month, counting anonymous visitors too.",
  "The website write key is visible to anyone, so it only lets people send events in, not read your data."
 ],
 "checked_line": "Read by AgentGid from 27 official pages, card checked Nov 10, 2026; usage numbers update daily."
}