{"components":{"schemas":{"PublicApiCreateContactBody":{"properties":{"botId":{"format":"uuid","type":"string"},"platformId":{"type":"string"},"username":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"status":{"enum":["subscribed","unsubscribed"],"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"},"description":"Optional map of contact variable name to value. Names are resolved against the application's active version. Folder variables cannot be set."}},"type":"object","required":["botId","platformId"],"description":"Request payload for creating a contact inside the authenticated application."},"PublicApiContactResponse":{"properties":{"requestId":{"type":"string"},"contact":{"$ref":"#/components/schemas/PublicApiContactDto"}},"type":"object","required":["requestId","contact"]},"PublicApiErrorResponse":{"properties":{"requestId":{"type":"string"},"error":{"type":"string"}},"type":"object","required":["requestId","error"]},"PublicApiContactsResponse":{"properties":{"requestId":{"type":"string"},"contacts":{"items":{"$ref":"#/components/schemas/PublicApiContactDto"},"type":"array"}},"type":"object","required":["requestId","contacts"]},"PublicApiUpdateContactBody":{"properties":{"username":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"status":{"enum":["subscribed","unsubscribed"],"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"},"description":"Optional map of contact variable name to value. Names are resolved against the application's active version. Folder variables cannot be set."}},"type":"object","description":"Request payload for updating an existing contact."},"PublicApiUpsertContactVariablesBody":{"properties":{"assignments":{"items":{"$ref":"#/components/schemas/PublicApiContactVariableAssignmentInput"},"type":"array","minItems":1}},"type":"object","required":["assignments"],"description":"Bulk upsert payload for contact variable values."},"PublicApiContactVariablesResponse":{"properties":{"requestId":{"type":"string"},"contactId":{"format":"uuid","type":"string"},"assignments":{"items":{"$ref":"#/components/schemas/PublicApiContactVariableAssignmentDto"},"type":"array"}},"type":"object","required":["requestId","contactId","assignments"]},"PublicApiTrackGoalEventBody":{"properties":{"botId":{"format":"uuid","type":"string"},"contactId":{"format":"uuid","type":"string"},"goalKey":{"type":"string"},"occurredAt":{"pattern":"\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+Z?","type":"string"}},"type":"object","required":["botId","contactId","goalKey"],"description":"Request payload for tracking a goal event for an existing contact."},"PublicApiGoalEventResponse":{"properties":{"requestId":{"type":"string"},"goalEvent":{"$ref":"#/components/schemas/PublicApiGoalEventDto"}},"type":"object","required":["requestId","goalEvent"]},"PublicApiSendFlowBody":{"properties":{"contactId":{"format":"uuid","type":"string"}},"type":"object","required":["contactId"],"description":"Request payload for sending a flow to an existing contact."},"PublicApiAcceptedResponse":{"properties":{"requestId":{"type":"string"},"status":{"enum":["accepted"],"type":"string"}},"type":"object","required":["requestId","status"]},"PublicApiContactDto":{"properties":{"id":{"format":"uuid","type":"string"},"botId":{"format":"uuid","type":"string"},"platformId":{"type":"string"},"username":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"status":{"enum":["subscribed","unsubscribed"],"type":"string"},"isActive":{"type":"boolean"}},"type":"object","required":["id","botId","platformId","status","isActive"]},"PublicApiContactVariableAssignmentInput":{"properties":{"contactVariablePersistentId":{"format":"uuid","type":"string"},"value":{"type":"string"}},"type":"object","required":["contactVariablePersistentId","value"],"description":"Single contact variable value assignment. Use contactVariablePersistentId for version-stable writes."},"PublicApiContactVariableAssignmentDto":{"properties":{"contactVariablePersistentId":{"format":"uuid","type":"string"},"value":{"type":"string"}},"type":"object","required":["contactVariablePersistentId","value"]},"PublicApiGoalEventDto":{"properties":{"id":{"format":"uuid","type":"string"},"applicationId":{"format":"uuid","type":"string"},"botId":{"format":"uuid","type":"string"},"contactId":{"format":"uuid","type":"string"},"goalKey":{"type":"string"},"occurredAt":{"pattern":"\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+Z?","type":"string"},"goalCreated":{"type":"boolean"}},"type":"object","required":["id","applicationId","botId","contactId","goalKey","occurredAt","goalCreated"]}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}}},"info":{"title":"Flowcastle Public API","version":"1.0.0","description":"Application-scoped REST API for contacts, contact variables, goal events, flows, and broadcasts."},"openapi":"3.0.3","paths":{"/contacts":{"post":{"operationId":"PublicApiController.createContact","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiCreateContactBody"}}},"description":"PublicApiCreateContactBody","required":false},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiContactResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Create contact","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Creates a contact inside the authenticated application."},"get":{"operationId":"PublicApiController.getContacts","parameters":[{"in":"query","name":"botId","required":false,"schema":{"$ref":"#/components/schemas/String"}},{"in":"query","name":"platformId","required":false,"schema":{"$ref":"#/components/schemas/String"}},{"in":"query","name":"email","required":false,"schema":{"$ref":"#/components/schemas/String"}},{"in":"query","name":"phone","required":false,"schema":{"$ref":"#/components/schemas/String"}},{"in":"query","name":"username","required":false,"schema":{"$ref":"#/components/schemas/String"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiContactsResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Find contacts","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Returns contacts inside the authenticated application using exact-match filters. At least one of platformId, email, phone, or username is required. botId optionally scopes the search to one bot."}},"/contacts/{contactId}":{"patch":{"operationId":"PublicApiController.updateContact","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"pattern":"[^\\/#\\?]+?","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiUpdateContactBody"}}},"description":"PublicApiUpdateContactBody","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiContactResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Update contact","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Updates mutable contact fields inside the authenticated application."}},"/contacts/{contactId}/variables":{"patch":{"operationId":"PublicApiController.upsertContactVariables","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"pattern":"[^\\/#\\?]+?","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiUpsertContactVariablesBody"}}},"description":"PublicApiUpsertContactVariablesBody","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiContactVariablesResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Create or update contact variable values","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Upserts one or more contact variable assignments for a contact. Use contact variable persistent IDs for version-stable writes."}},"/goal-events":{"post":{"operationId":"PublicApiController.trackGoalEvent","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiTrackGoalEventBody"}}},"description":"PublicApiTrackGoalEventBody","required":false},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiGoalEventResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Track goal event","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Creates a goal event for an existing contact inside the authenticated application. A new goal key is created implicitly by its first event."}},"/flows/{flowId}/send":{"post":{"operationId":"PublicApiController.sendFlow","parameters":[{"in":"path","name":"flowId","required":true,"schema":{"pattern":"[^\\/#\\?]+?","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiSendFlowBody"}}},"description":"PublicApiSendFlowBody","required":false},"responses":{"202":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiAcceptedResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"503":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Send flow to contact","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Queues a non-broadcast flow for execution for the provided contact."}},"/broadcasts/{broadcastId}/send":{"post":{"operationId":"PublicApiController.sendBroadcast","parameters":[{"in":"path","name":"broadcastId","required":true,"schema":{"pattern":"[^\\/#\\?]+?","type":"string"}}],"responses":{"202":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiAcceptedResponse"}}},"description":""},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicApiErrorResponse"}}},"description":""}},"summary":"Queue broadcast send","tags":["Public API"],"security":[{"ApiKeyAuth":[]}],"description":"Queues a broadcast for sending inside the authenticated application."}}},"servers":[{"url":"https://api.flowcastle.ai/api/public/v1"}],"security":[{"ApiKeyAuth":[]}]}