{
  "openapi": "3.1.0",
  "info": {
    "title": "FlowEQ - Beta API",
    "description": "FlowEQ Beta REST API",
    "version": "1.0",
    "contact": {
      "name": "FlowEQ",
      "url": "https://www.floweq.com",
      "email": "support@floweq.com"
    }
  },
  "servers": [
    {
      "url": "https://api.floweq.com/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "schemas": {
      "EventsListResponse": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "description": "Number of events retrieved in request."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "description": "List of matching events."
          }
        },
        "required": [
          "count",
          "results"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique event identifier."
          },
          "company_id": {
            "type": "string",
            "description": "Company ID the event belongs to."
          },
          "connection_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "ID of the associated connection."
          },
          "connection_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Key of the associated Sidekick connection."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 creation timestamp."
          },
          "excluded": {
            "type": "boolean",
            "description": "Whether the event is excluded from reporting."
          },
          "flow_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "ID of the associated flow."
          },
          "flow_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Key of the associated flow."
          },
          "flow_session": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Flow session number."
          },
          "like_value": {
            "type": [
              "number",
              "null"
            ],
            "description": "Like value for the event."
          },
          "seconds_active": {
            "type": [
              "number",
              "null"
            ],
            "description": "Seconds the user was active during the event."
          },
          "seconds_running": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total seconds the event was running."
          },
          "selected_decision": {
            "type": [
              "string",
              "null"
            ],
            "description": "Title of the decision branch selected on a Decision step."
          },
          "step_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Key of the associated step."
          },
          "text": {
            "type": [
              "string",
              "null"
            ],
            "description": "Text content associated with the event."
          },
          "type": {
            "type": "string",
            "description": "Event type (e.g. user_flow_session_started)."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601 last updated timestamp."
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "UUID of the user the event is related to."
          },
          "version_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "ID of the associated flow version."
          },
          "version_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Key of the associated flow version."
          },
          "version_object": {
            "description": "Snapshot of the flow version object at the time of the event."
          }
        },
        "required": [
          "id",
          "company_id",
          "connection_id",
          "connection_key",
          "created_at",
          "excluded",
          "flow_id",
          "flow_key",
          "flow_session",
          "like_value",
          "seconds_active",
          "seconds_running",
          "selected_decision",
          "step_key",
          "text",
          "type",
          "updated_at",
          "user_id",
          "version_id",
          "version_key"
        ]
      },
      "Record": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique record identifier."
          },
          "record_type": {
            "type": "string",
            "description": "Record type identifier (e.g., 'uccfiling', 'custom', 'infoleaseasset')."
          },
          "uid": {
            "description": "Record type definition UID."
          },
          "status": {
            "type": "string",
            "description": "Current status of the record."
          },
          "parent_record": {
            "description": "Parent record object, or null if none."
          },
          "child_records": {
            "type": "array",
            "items": {},
            "description": "List of child record objects."
          },
          "instance": {
            "description": "The underlying instance object (InfoleaseAsset, UCCFiling, or PurchasedLabel), if applicable."
          },
          "fields": {
            "type": "object",
            "additionalProperties": {},
            "description": "Custom field values keyed by field name."
          },
          "linked": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {}
            },
            "description": "Linked external objects, keyed by source then object name."
          },
          "created_at": {
            "type": "string",
            "description": "ISO 8601 creation timestamp."
          },
          "updated_at": {
            "type": "string",
            "description": "ISO 8601 last updated timestamp."
          },
          "views": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of view IDs this record belongs to."
          }
        },
        "required": [
          "record_type",
          "status",
          "child_records",
          "created_at",
          "updated_at",
          "views"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/events": {
      "get": {
        "summary": "List Events",
        "description": "Retrieve a list of events matching the criteria set by the query parameter. If no query parameters are set, all events affiliated with the company ID in the JWT authorization token will match the criteria.",
        "tags": [
          "Events"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "Filter by the Sidekick connection key. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`."
            },
            "required": false,
            "description": "Filter by the Sidekick connection key. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`.",
            "name": "connection_key",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by event type.",
              "example": "user_flow_session_started"
            },
            "required": false,
            "description": "Filter by event type.",
            "name": "type",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by the flow key associated with the event. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`."
            },
            "required": false,
            "description": "Filter by the flow key associated with the event. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`.",
            "name": "flow_key",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by flow session number. Supports operators: `__gt`, `__gte`, `__lt`, `__lte`."
            },
            "required": false,
            "description": "Filter by flow session number. Supports operators: `__gt`, `__gte`, `__lt`, `__lte`.",
            "name": "flow_session",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by the step key associated with the event. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`."
            },
            "required": false,
            "description": "Filter by the step key associated with the event. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`.",
            "name": "step_key",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by the title of the decision branch selected on a Decision step."
            },
            "required": false,
            "description": "Filter by the title of the decision branch selected on a Decision step.",
            "name": "selected_decision",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by the UUID of the user the event is related to."
            },
            "required": false,
            "description": "Filter by the UUID of the user the event is related to.",
            "name": "user_id",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Alias for user_id."
            },
            "required": false,
            "description": "Alias for user_id.",
            "name": "user_key",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Filter by the flow version key. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`."
            },
            "required": false,
            "description": "Filter by the flow version key. Supports operators: `__contains`, `__gt`, `__gte`, `__lt`, `__lte`.",
            "name": "version_key",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Number of events to return. Defaults to 100, maximum 10,000."
            },
            "required": false,
            "description": "Number of events to return. Defaults to 100, maximum 10,000.",
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Page number for paginated results."
            },
            "required": false,
            "description": "Page number for paginated results.",
            "name": "page",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "Field name to order results by."
            },
            "required": false,
            "description": "Field name to order results by.",
            "name": "order_by",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventsListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — invalid query parameters or limit exceeded"
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/records/{record}": {
      "get": {
        "summary": "Retrieve a Record",
        "description": "Retrieve a Workboard record with the specified record ID.",
        "tags": [
          "Records"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "description": "The Workboard record ID."
            },
            "required": true,
            "description": "The Workboard record ID.",
            "name": "record",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The requested record.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Record"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Record not found"
          }
        }
      }
    }
  },
  "webhooks": {}
}