{"openapi":"3.1.0","info":{"title":"Client API (SDK)","version":"1.0.0","description":"Customer-facing API (SDK key)."},"servers":[{"url":"https://api.motisig.ai/client","description":"API base (Firebase Hosting)"}],"components":{"securitySchemes":{"sdkKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Project SDK key (customer-facing)."}},"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string"},"timestamp":{"type":"string"}},"required":["status","service","timestamp"]},"RegisterUserResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"userId":{"type":"string"}},"required":["success","userId"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"RegisterUserBody":{"type":"object","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"timezone":{"type":"string"},"locale":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"customAttributes":{"type":"object","additionalProperties":{}},"pushTokens":{"type":"object","properties":{"expo":{"type":"array","items":{"type":"string"}},"fcm":{"type":"array","items":{"type":"string"}},"apns":{"type":"array","items":{"type":"string"}}}},"pushSubscriptions":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"object","properties":{"platform":{"type":"string","enum":["ios","android","web"]},"type":{"type":"string","enum":["expo","fcm","apns"]},"token":{"type":"string"},"permission":{"type":"string","enum":["granted","declined","unknown"]},"enabled":{"type":"boolean"},"state":{"type":"string","enum":["valid","invalid"]}},"required":["platform","type","token"]}}}},"required":["id"]},"UserResponse":{"type":"object","properties":{"user":{}}},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]},"UpdateUserBody":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"timezone":{"type":"string"},"locale":{"type":"string"}},"additionalProperties":false},"TagsBody":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"}}}},"AttributesBody":{"type":"object","properties":{"attributes":{"type":"object","additionalProperties":{}}}},"AttributeKeysBody":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"string"}}}},"LegacyPushTokenBody":{"type":"object","properties":{"platform":{"type":"string","enum":["expo","fcm","apns"]},"token":{"type":"string","minLength":1}},"required":["platform","token"]},"PushSubscriptionUpsertBody":{"type":"object","properties":{"devicePlatform":{"type":"string","enum":["ios","android","web"]},"pushType":{"type":"string","enum":["expo","fcm","apns"]},"token":{"type":"string","minLength":1},"permission":{"type":"string","enum":["granted","declined","unknown"]},"enabled":{"type":"boolean"}},"required":["devicePlatform","pushType","token"]},"PushSubscriptionPatchBody":{"type":"object","properties":{"devicePlatform":{"type":"string","enum":["ios","android","web"]},"pushType":{"type":"string","enum":["expo","fcm","apns"]},"token":{"type":"string","minLength":1},"enabled":{"type":"boolean"},"permission":{"type":"string","enum":["granted","declined","unknown"]}},"required":["devicePlatform","pushType","token"],"additionalProperties":false},"PushSubscriptionRemoveBody":{"type":"object","properties":{"devicePlatform":{"type":"string","enum":["ios","android","web"]},"pushType":{"type":"string","enum":["expo","fcm","apns"]},"token":{"type":"string","minLength":1}},"required":["devicePlatform","pushType","token"]},"TriggerEventResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"}},"required":["success","message"]},"TriggerEventBody":{"type":"object","properties":{"userId":{"type":"string"},"eventName":{"type":"string"},"eventData":{}},"required":["userId","eventName"]},"TrackClickBody":{"type":"object","properties":{"userId":{"type":"string"},"messageId":{"type":"string"},"isForeground":{"type":"boolean"}},"required":["userId","messageId"]}},"parameters":{}},"paths":{"/health":{"get":{"tags":["Health"],"summary":"Health check","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/users":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterUserBody"}}}},"responses":{"200":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterUserResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/users/{userId}":{"get":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/users/{userId}/tags":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/users/{userId}/attributes":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributesBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeKeysBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/users/{userId}/push-tokens":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyPushTokenBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyPushTokenBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/users/{userId}/push-subscriptions":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionUpsertBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"patch":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionPatchBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionRemoveBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/users/{userId}/ping":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/events":{"post":{"tags":["Events"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerEventBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerEventResponse"}}}}}}},"/track/click":{"post":{"tags":["Track"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackClickBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterUserBody"}}}},"responses":{"200":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterUserResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}":{"get":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}/tags":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}/attributes":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributesBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttributeKeysBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}/push-tokens":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyPushTokenBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyPushTokenBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}/push-subscriptions":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionUpsertBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"patch":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionPatchBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}},"delete":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscriptionRemoveBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/users/{userId}/ping":{"post":{"tags":["Users"],"security":[{"sdkKeyHeader":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/events":{"post":{"tags":["Events"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerEventBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerEventResponse"}}}}}}},"/organizations/{orgId}/projects/{projectId}/track/click":{"post":{"tags":["Track"],"security":[{"sdkKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackClickBody"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}}}}}},"webhooks":{}}