Skip to content

API Reference

REST API reference for the Kitbase SDK endpoints.

Base URL

https://api.kitbase.dev

Authentication

SDK endpoints use the x-sdk-key header:

x-sdk-key: <YOUR_SDK_KEY>

Events

Track Event

Track an event in your application.

POST /sdk/v1/logs

Headers

HeaderRequiredDescription
x-sdk-keyYesYour Kitbase SDK key
Content-TypeYesapplication/json

Request Body

json
{
  "event": "New Subscription",
  "channel": "payments",
  "user_id": "user-123",
  "anonymous_id": "550e8400-e29b-41d4-a716-446655440000",
  "icon": "💰",
  "notify": true,
  "description": "User subscribed to premium plan",
  "timestamp": 1705321800000,
  "tags": {
    "plan": "premium",
    "amount": 9.99
  }
}

Parameters

FieldTypeRequiredDescription
eventstringYesEvent name
channelstringYesEvent channel/category
user_idstringNoIdentified user ID
anonymous_idstringNoAnonymous user ID (UUID)
iconstringNoEmoji icon
notifybooleanNoSend real-time notification
descriptionstringNoEvent description
timestampnumberNoUnix timestamp in ms
tagsobjectNoKey-value metadata

Response

Status: 202 Accepted

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "event": "New Subscription",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Errors

StatusDescription
400Invalid parameters
401Invalid SDK key
503Queue full

Identify User

Link an anonymous user to an identified user.

POST /sdk/v1/identify

Request Body

json
{
  "anonymous_id": "550e8400-e29b-41d4-a716-446655440000",
  "user_id": "user-123",
  "traits": {
    "email": "user@example.com",
    "plan": "premium"
  }
}

Parameters

FieldTypeRequiredDescription
anonymous_idstringYesAnonymous user ID to link
user_idstringYesIdentified user ID
traitsobjectNoUser properties

Response

Status: 200 OK

json
{
  "success": true
}

Tag Enrichment

Events are automatically enriched with these tags:

TagDescription
__browserBrowser name
__browser_versionBrowser version
__osOperating system
__os_versionOS version
__deviceDevice type
__countryCountry code
__regionRegion/State
__cityCity
__session_idSession ID
__pathPage path
__referrerReferrer URL
__utm_sourceUTM source
__utm_mediumUTM medium
__utm_campaignUTM campaign

HTTP Status Codes

CodeDescription
200Success
202Accepted (queued)
400Invalid parameters
401Invalid SDK key
404Not found
429Rate limited
503Service unavailable

Rate Limits

  • Standard: 1,000 requests per minute
  • Burst: 100 requests per second

When rate limited, retry after the Retry-After header value.

Released under the MIT License.