{"openapi":"3.1.0","info":{"title":"Inslytic Ingestion API","description":"Privacy-first product analytics ingestion API. Send events from any language or platform.","version":"1.0.0","contact":{"name":"Inslytic","url":"https://inslytic.com"}},"servers":[{"url":"https://api.inslytic.com","description":"Production"},{"url":"http://localhost:3002","description":"Local development"}],"paths":{"/health":{"get":{"summary":"Health check","description":"Returns the health status of the API. No authentication required.","operationId":"healthCheck","security":[],"responses":{"200":{"description":"API is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}},"required":["status"]}}}}}}},"/v1/ingest":{"post":{"summary":"Ingest events","description":"Sends one or more events for ingestion. Accepts up to 1,000 events per request. Each event costs one rate limit token.","operationId":"ingestEvents","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestRequest"},"example":{"events":[{"eventName":"page_viewed","timestamp":"2026-02-16T10:30:00.000Z","anonymousId":"anon-123","sessionId":"sess-456","consentGiven":true,"properties":{"path":"/pricing"},"pageUrl":"https://example.com/pricing","pageTitle":"Pricing"}]}}}},"responses":{"202":{"description":"Events accepted for processing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"}}}},"400":{"description":"Invalid request body or event validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Invalid API key"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Failed to process events"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Project API key from the Inslytic dashboard (Settings → Project)"}},"schemas":{"IngestRequest":{"type":"object","required":["events"],"properties":{"events":{"type":"array","description":"Array of events to ingest (1-1,000)","minItems":1,"maxItems":1000,"items":{"$ref":"#/components/schemas/EventPayload"}}}},"EventPayload":{"type":"object","required":["eventName","timestamp","anonymousId","sessionId","consentGiven"],"properties":{"eventName":{"type":"string","description":"Name of the event (e.g., \"page_viewed\", \"button_clicked\")"},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 UTC timestamp"},"anonymousId":{"type":"string","description":"Anonymous device/session identifier"},"sessionId":{"type":"string","description":"Session identifier"},"consentGiven":{"type":"boolean","description":"Whether the user has given consent for tracking"},"userId":{"type":["string","null"],"description":"Identified user ID. Null for anonymous events."},"properties":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom key-value pairs"},"pageUrl":{"type":"string","description":"Full URL of the page"},"pageTitle":{"type":"string","description":"Title of the page"},"referrer":{"type":"string","description":"Referrer URL"},"utmSource":{"type":["string","null"],"description":"UTM source parameter"},"utmMedium":{"type":["string","null"],"description":"UTM medium parameter"},"utmCampaign":{"type":["string","null"],"description":"UTM campaign parameter"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet"],"description":"Device type"},"browser":{"type":"string","description":"Browser name"},"os":{"type":"string","description":"Operating system"}}},"IngestResponse":{"type":"object","required":["accepted"],"properties":{"accepted":{"type":"integer","description":"Number of events accepted for processing"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Error message"}}},"ValidationError":{"type":"object","required":["error"],"properties":{"error":{"type":"string","example":"Validation failed"},"details":{"type":"array","items":{"type":"string"},"description":"Specific validation error messages"}}}}},"security":[{"bearerAuth":[]}]}