SegOps AIDocs

SDKs Overview

Official SegOps client libraries for server-side event ingest and client-side tracking. All SDKs share the same interface: track, identify, flush, and shutdown.

Available SDKs#

LanguagePackageMinimum Runtime
TypeScript / JavaScript@segops/sdkNode 18 / modern browser
Gogithub.com/segops/sdk-goGo 1.22
SwiftSegOps (Swift Package)iOS 16, macOS 13
Kotlinio.github.segops:segops-kotlinJVM 17, Android API 26

Common Event Schema#

All SDKs use the same canonical event schema:

FieldTypeRequiredDescription
userId / user_idstringYesUnique user identifier (email, UUID, etc.)
eventType / event_typestringYesSnake-case event name, e.g. page_viewed
occurredAt / occurred_atISO 8601 string / DateNoDefaults to current time
payloadobjectNoArbitrary event properties

Batching#

All SDKs buffer events locally and flush them in batches for efficiency:

SettingDefault
Batch size (auto-flush)20 events
Flush interval5 seconds
Max retries on 5xx3

Events are never dropped on shutdown — all SDKs guarantee a final flush before the process exits.

User Identification#

Use identify to set or update user-level traits (email, plan, company, etc.). This emits a context_identified event whose payload becomes queryable as user_property conditions in segment rules.

Authentication#

All SDKs authenticate with an API key passed in the Authorization: ApiKey sk_... header. Create keys in the dashboard under Settings → API Keys.

Choosing an SDK#

  • Node.js / Next.js / browser — use the TypeScript SDK. It works in both environments and handles page-visibility flushes for browsers automatically.
  • Go microservices — use the Go SDK. It is goroutine-safe and has zero external dependencies.
  • iOS / macOS apps — use the Swift SDK via Swift Package Manager.
  • Android / JVM services — use the Kotlin SDK via Gradle.
  • Any other language — use the REST API directly.