{
  "openapi": "3.1.0",
  "info": {
    "title": "Real Connect Pro Zapier API",
    "version": "1.0.1",
    "description": "Public OpenAPI documentation for the Real Connect Pro Zapier integration endpoints."
  },
  "servers": [
    {
      "url": "https://realconnectpro.com/api/zapier/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Authentication"
    },
    {
      "name": "Connections"
    },
    {
      "name": "Groups"
    },
    {
      "name": "Todos"
    },
    {
      "name": "Transactions"
    },
    {
      "name": "Polling Triggers"
    },
    {
      "name": "Webhook Subscriptions"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "tags": ["Authentication"],
        "summary": "Test the API token and return the connected Real Connect Pro user.",
        "operationId": "getZapierMe",
        "responses": {
          "200": {
            "description": "Connected user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/connections": {
      "get": {
        "tags": ["Connections"],
        "summary": "List or search connections for the authenticated user.",
        "operationId": "listZapierConnections",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/CreatedSince"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "phone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated connections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionCollection"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Connections"],
        "summary": "Create a connection.",
        "operationId": "createZapierConnection",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/connections/{connection}": {
      "get": {
        "tags": ["Connections"],
        "summary": "Get one connection.",
        "operationId": "getZapierConnection",
        "parameters": [
          {
            "$ref": "#/components/parameters/ConnectionId"
          }
        ],
        "responses": {
          "200": {
            "description": "Connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": ["Connections"],
        "summary": "Update a connection.",
        "operationId": "updateZapierConnection",
        "parameters": [
          {
            "$ref": "#/components/parameters/ConnectionId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated connection.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/connections/{connection}/notes": {
      "post": {
        "tags": ["Connections"],
        "summary": "Add a note to a connection.",
        "operationId": "createZapierConnectionNote",
        "parameters": [
          {
            "$ref": "#/components/parameters/ConnectionId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["note"],
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 10000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created note.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionNoteResponse"
                }
              }
            }
          }
        }
      }
    },
    "/groups": {
      "get": {
        "tags": ["Groups"],
        "summary": "List or search groups.",
        "operationId": "listZapierGroups",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated groups.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupCollection"
                }
              }
            }
          }
        }
      }
    },
    "/todos": {
      "post": {
        "tags": ["Todos"],
        "summary": "Create a todo.",
        "operationId": "createZapierTodo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created todo.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoResponse"
                }
              }
            }
          }
        }
      }
    },
    "/transactions": {
      "get": {
        "tags": ["Transactions"],
        "summary": "List or search transactions.",
        "operationId": "listZapierTransactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/CreatedSince"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated transactions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionCollection"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Transactions"],
        "summary": "Create a transaction.",
        "operationId": "createZapierTransaction",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created transaction.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/connections": {
      "get": {
        "tags": ["Polling Triggers"],
        "summary": "Polling trigger for new or updated connections.",
        "operationId": "pollZapierConnections",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/CreatedSince"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["connection.created", "connection.updated"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated trigger records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionCollection"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/todos": {
      "get": {
        "tags": ["Polling Triggers"],
        "summary": "Polling trigger for new or completed todos.",
        "operationId": "pollZapierTodos",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/CreatedSince"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["todo.created", "todo.completed"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated trigger records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoCollection"
                }
              }
            }
          }
        }
      }
    },
    "/triggers/transactions": {
      "get": {
        "tags": ["Polling Triggers"],
        "summary": "Polling trigger for new transactions.",
        "operationId": "pollZapierTransactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PerPage"
          },
          {
            "$ref": "#/components/parameters/CreatedSince"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["transaction.created"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated trigger records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionCollection"
                }
              }
            }
          }
        }
      }
    },
    "/hooks": {
      "post": {
        "tags": ["Webhook Subscriptions"],
        "summary": "Subscribe Zapier to an instant trigger webhook event.",
        "operationId": "createZapierHook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookSubscriptionInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscriptionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/hooks/{zapierWebhookSubscription}": {
      "delete": {
        "tags": ["Webhook Subscriptions"],
        "summary": "Disable a webhook subscription.",
        "operationId": "deleteZapierHook",
        "parameters": [
          {
            "name": "zapierWebhookSubscription",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Subscription disabled."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Sanctum API token"
      }
    },
    "parameters": {
      "PerPage": {
        "name": "per_page",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "CreatedSince": {
        "name": "created_since",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "UpdatedSince": {
        "name": "updated_since",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "date-time"
        }
      },
      "ConnectionId": {
        "name": "connection",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid API token."
      },
      "Forbidden": {
        "description": "API token does not include the required Zapier ability."
      },
      "NotFound": {
        "description": "Record not found or not owned by the authenticated user."
      },
      "ValidationError": {
        "description": "Validation failed."
      }
    },
    "schemas": {
      "UserResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/User"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "first_name": {
            "type": ["string", "null"]
          },
          "last_name": {
            "type": ["string", "null"]
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "is_on_pro_plan": {
            "type": "boolean"
          },
          "zapier": {
            "type": "object",
            "properties": {
              "api_version": {
                "type": "string",
                "example": "v1"
              },
              "available_events": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/WebhookEvent"
                }
              }
            }
          }
        }
      },
      "ConnectionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Connection"
          }
        }
      },
      "ConnectionCollection": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connection"
            }
          },
          "links": {
            "type": "object"
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "Connection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "first_name": {
            "type": ["string", "null"]
          },
          "last_name": {
            "type": ["string", "null"]
          },
          "full_name": {
            "type": "string"
          },
          "email": {
            "type": ["string", "null"],
            "format": "email"
          },
          "mobile_phone": {
            "type": ["string", "null"]
          },
          "work_phone": {
            "type": ["string", "null"]
          },
          "website": {
            "type": ["string", "null"]
          },
          "title": {
            "type": ["string", "null"]
          },
          "company": {
            "type": ["string", "null"]
          },
          "industry": {
            "type": ["string", "null"]
          },
          "rating": {
            "type": ["integer", "null"],
            "minimum": 1,
            "maximum": 5
          },
          "contact_type": {
            "type": ["string", "null"],
            "enum": ["contact", "partner", null]
          },
          "service_category": {
            "type": ["string", "null"],
            "enum": ["lender", "inspector", "title", "photographer", "cleaner", "stager", "insurance", "contractor", "other", null]
          },
          "service_category_other": {
            "type": ["string", "null"]
          },
          "preferred_vendor": {
            "type": "boolean"
          },
          "address": {
            "type": ["string", "null"]
          },
          "address2": {
            "type": ["string", "null"]
          },
          "city": {
            "type": ["string", "null"]
          },
          "state": {
            "type": ["string", "null"]
          },
          "zip": {
            "type": ["string", "null"]
          },
          "business_address": {
            "type": ["string", "null"]
          },
          "business_address2": {
            "type": ["string", "null"]
          },
          "business_city": {
            "type": ["string", "null"]
          },
          "business_state": {
            "type": ["string", "null"]
          },
          "business_zip": {
            "type": ["string", "null"]
          },
          "mailing_address": {
            "type": ["string", "null"],
            "enum": ["personal", "business", null]
          },
          "birth_month": {
            "type": ["integer", "null"],
            "minimum": 1,
            "maximum": 12
          },
          "birth_day": {
            "type": ["integer", "null"],
            "minimum": 1,
            "maximum": 31
          },
          "birth_year": {
            "type": ["integer", "null"]
          },
          "house_anniversary_date": {
            "type": ["string", "null"],
            "format": "date"
          },
          "license_renewal_date": {
            "type": ["string", "null"],
            "format": "date"
          },
          "lead_source": {
            "type": ["string", "null"]
          },
          "created_from_lead_form": {
            "type": "boolean"
          },
          "created_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "updated_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "group_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "ConnectionInput": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "last_name": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "email": {
            "type": ["string", "null"],
            "format": "email",
            "maxLength": 255
          },
          "mobile_phone": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "work_phone": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "company": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "title": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "rating": {
            "type": ["integer", "null"],
            "minimum": 1,
            "maximum": 5
          },
          "contact_type": {
            "type": ["string", "null"],
            "enum": ["contact", "partner", null]
          },
          "service_category": {
            "type": ["string", "null"],
            "enum": ["lender", "inspector", "title", "photographer", "cleaner", "stager", "insurance", "contractor", "other", null]
          },
          "house_anniversary_date": {
            "type": ["string", "null"],
            "format": "date"
          },
          "license_renewal_date": {
            "type": ["string", "null"],
            "format": "date"
          },
          "lead_source": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "group_ids": {
            "type": ["array", "null"],
            "items": {
              "type": "integer"
            }
          }
        },
        "description": "Create requires at least one of first_name, last_name, email, mobile_phone, work_phone, or company."
      },
      "ConnectionNoteResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "connection_id": {
                "type": "integer"
              },
              "note": {
                "type": "string"
              },
              "created_at": {
                "type": ["string", "null"],
                "format": "date-time"
              }
            }
          }
        }
      },
      "GroupCollection": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Group"
            }
          },
          "links": {
            "type": "object"
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "Group": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "type": {
            "type": ["string", "null"]
          },
          "connection_count": {
            "type": ["integer", "null"]
          },
          "created_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "updated_at": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        }
      },
      "TodoResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Todo"
          }
        }
      },
      "TodoCollection": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Todo"
            }
          },
          "links": {
            "type": "object"
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "Todo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "connection_id": {
            "type": ["integer", "null"]
          },
          "action": {
            "type": "string",
            "enum": ["pop_by", "note", "phone_call"]
          },
          "complete_by": {
            "type": ["string", "null"],
            "format": "date"
          },
          "completed_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "is_generated": {
            "type": "boolean"
          },
          "created_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "updated_at": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        }
      },
      "TodoInput": {
        "type": "object",
        "required": ["action"],
        "properties": {
          "connection_id": {
            "type": ["integer", "null"]
          },
          "action": {
            "type": "string",
            "enum": ["pop_by", "note", "phone_call"]
          },
          "complete_by": {
            "type": ["string", "null"],
            "format": "date"
          },
          "completed_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "is_generated": {
            "type": ["boolean", "null"]
          }
        }
      },
      "TransactionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Transaction"
          }
        }
      },
      "TransactionCollection": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          },
          "links": {
            "type": "object"
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "Transaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "amount": {
            "type": ["number", "null"]
          },
          "commission": {
            "type": ["number", "null"]
          },
          "type": {
            "type": ["string", "null"],
            "enum": ["buy", "sell", "lease", "buy_sell", null]
          },
          "status": {
            "type": "integer",
            "enum": [0, 1]
          },
          "status_label": {
            "type": "string",
            "enum": ["pending", "completed"]
          },
          "closed_at": {
            "type": ["string", "null"],
            "format": "date"
          },
          "lead_source": {
            "type": ["string", "null"]
          },
          "created_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "updated_at": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "connection_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "TransactionInput": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "amount": {
            "type": ["number", "null"],
            "minimum": 0
          },
          "commission": {
            "type": ["number", "null"],
            "minimum": 0
          },
          "type": {
            "type": ["string", "null"],
            "enum": ["buy", "sell", "lease", "buy_sell", null]
          },
          "status": {
            "oneOf": [
              {
                "type": "integer",
                "enum": [0, 1]
              },
              {
                "type": "string",
                "enum": ["0", "1", "pending", "completed"]
              }
            ]
          },
          "closed_at": {
            "type": ["string", "null"],
            "format": "date"
          },
          "lead_source": {
            "type": ["string", "null"],
            "maxLength": 255
          },
          "connection_ids": {
            "type": ["array", "null"],
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "WebhookEvent": {
        "type": "string",
        "enum": ["connection.created", "connection.updated", "todo.created", "todo.completed", "transaction.created"]
      },
      "WebhookSubscriptionInput": {
        "type": "object",
        "required": ["event", "hook_url"],
        "properties": {
          "event": {
            "$ref": "#/components/schemas/WebhookEvent"
          },
          "hook_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "filters": {
            "type": ["object", "null"]
          }
        }
      },
      "WebhookSubscriptionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "event": {
                "$ref": "#/components/schemas/WebhookEvent"
              },
              "hook_url": {
                "type": "string",
                "format": "uri"
              },
              "active_at": {
                "type": ["string", "null"],
                "format": "date-time"
              }
            }
          }
        }
      }
    }
  }
}
