{
    "openapi": "3.0.0",
    "info": {
        "title": "LinkedIn API Documentation",
        "description": "API documentation for scraping LinkedIn profile data.",
        "version": "1.0.0"
    },
    "paths": {
        "/api/credits": {
            "get": {
                "tags": [
                    "Browserflow API"
                ],
                "summary": "Get remaining API credits",
                "description": "Retrieve remaining API credits for the authenticated user.\n\nNote: Adjust the `path` below to whatever route you’ve registered for this controller.",
                "operationId": "getBrowserflowCredits",
                "responses": {
                    "200": {
                        "description": "Credits retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Credits retrieved successfully"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "credits": {
                                            "type": "integer",
                                            "example": 120
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Invalid or missing API token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Provide a valid API token in the Authorization header"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "User not found / no credits record",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "User not found"
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "No credits information available for this user"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-check-connection": {
            "post": {
                "tags": [
                    "LinkedIn Connection Check"
                ],
                "summary": "Check if a LinkedIn Profile is a Connection",
                "description": "Checks if the provided LinkedIn profile URL is a connection by looking for the substring '1' in the text of an element with the class '.dist-value'.",
                "operationId": "checkLinkedInConnection",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "The LinkedIn profile URL",
                                        "type": "string",
                                        "format": "url"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response with connection status",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "is_connection": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "is_pending": {
                                            "type": "boolean",
                                            "example": false
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully checked connection status; You are connected"
                                        },
                                        "image_url": {
                                            "type": "string"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 5
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid LinkedIn URL"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-get-chat-history": {
            "post": {
                "tags": [
                    "LinkedIn Chat"
                ],
                "summary": "Get LinkedIn chat history with a profile",
                "description": "Navigates to the given LinkedIn profile, opens the Messages panel (requires existing connection), and returns the chat history (most recent first in the response).",
                "operationId": "getLinkedInChatHistory",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "LinkedIn profile URL (must be a personal profile, not a company). Example: https://www.linkedin.com/in/username/",
                                        "type": "string",
                                        "format": "url"
                                    },
                                    "nrOfMessages": {
                                        "description": "Optional limit for the number of most recent messages to return.",
                                        "type": "integer",
                                        "minimum": 1
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successfully retrieved chat history",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "5f7c1c8b-3a21-4d2a-9e10-abc123def456"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully retrieved chat history"
                                        },
                                        "chat_history": {
                                            "description": "Messages in chronological order from oldest to newest in the raw scrape; response is reversed to most recent first.",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "date": {
                                                        "type": "string",
                                                        "example": "2025-08-28"
                                                    },
                                                    "time": {
                                                        "type": "string",
                                                        "example": "14:37"
                                                    },
                                                    "name": {
                                                        "type": "string",
                                                        "example": "Jane Doe"
                                                    },
                                                    "message": {
                                                        "type": "string",
                                                        "example": "Great to connect! Let's chat next week."
                                                    },
                                                    "shared_content": {
                                                        "type": "string",
                                                        "example": "https://example.com/shared-article",
                                                        "nullable": true
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "total": {
                                            "type": "integer",
                                            "example": 23
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "example": "https://cdn.example.com/screenshots/abc123.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 50
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid LinkedIn profile URL. This module requires a personal LinkedIn profile, not a company profile."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "You are temporarily blocked from using this service as you were causing too many errors. Please contact support at hello@browserflow.io to resolve this issue."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Could not export chat history."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-profile-data": {
            "post": {
                "tags": [
                    "LinkedIn Profile Data"
                ],
                "summary": "Scrape LinkedIn Profile Data",
                "description": "Scrapes profile data from a LinkedIn URL and returns detailed information.",
                "operationId": "scrapeLinkedInProfile",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "The LinkedIn profile URL",
                                        "type": "string",
                                        "format": "url"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response with LinkedIn profile data",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "properties": {
                                                "url": {
                                                    "type": "string",
                                                    "example": "https://www.linkedin.com/in/elon-musk"
                                                },
                                                "connection_status": {
                                                    "properties": {
                                                        "is_connection": {
                                                            "type": "boolean",
                                                            "example": true
                                                        },
                                                        "is_pending": {
                                                            "type": "boolean",
                                                            "example": false
                                                        }
                                                    },
                                                    "type": "object"
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "about": {
                                                    "type": "string"
                                                },
                                                "tagline": {
                                                    "type": "string"
                                                },
                                                "picture": {
                                                    "type": "string"
                                                },
                                                "skills": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "location": {
                                                    "type": "string"
                                                },
                                                "education": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "institution_name": {
                                                                "type": "string"
                                                            },
                                                            "education_description": {
                                                                "type": "string"
                                                            },
                                                            "education_duration": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "experience": {
                                                    "type": "array",
                                                    "items": {
                                                        "properties": {
                                                            "job_title": {
                                                                "type": "string"
                                                            },
                                                            "company_name": {
                                                                "type": "string"
                                                            },
                                                            "employment_duration": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                },
                                                "contact_info": {
                                                    "properties": {
                                                        "email": {
                                                            "type": "string"
                                                        },
                                                        "website": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "type": "object"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "message": {
                                            "type": "string"
                                        },
                                        "image_url": {
                                            "type": "string"
                                        },
                                        "credits_used": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid LinkedIn URL"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/linkedin-invite-to-follow-page": {
            "post": {
                "tags": [
                    "LinkedIn Connections"
                ],
                "summary": "Invite connections to follow a LinkedIn Company Page",
                "operationId": "inviteToFollowPage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "type": "string",
                                        "format": "uri",
                                        "example": "https://www.linkedin.com/company/acme-inc/"
                                    },
                                    "searchTerm": {
                                        "type": "string",
                                        "example": "marketing"
                                    },
                                    "searchName": {
                                        "type": "string",
                                        "example": "John"
                                    },
                                    "locations": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "example": [
                                            "Amsterdam",
                                            "Berlin"
                                        ]
                                    },
                                    "currentCompany": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "example": [
                                            "Acme",
                                            "Globex"
                                        ]
                                    },
                                    "schools": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "example": [
                                            "TU Delft",
                                            "UVA"
                                        ]
                                    },
                                    "industries": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "example": [
                                            "Information Technology & Services",
                                            "Marketing & Advertising"
                                        ]
                                    },
                                    "maxToInvite": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "example": 10
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Invitations sent",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "uri"
                                        },
                                        "credits_used": {
                                            "type": "integer"
                                        },
                                        "invites_left": {
                                            "type": "integer",
                                            "nullable": true
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "500": {
                        "description": "Server Error"
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-list-connections": {
            "post": {
                "tags": [
                    "LinkedIn Connections"
                ],
                "summary": "List your LinkedIn connections",
                "description": "Opens the LinkedIn Connections page, optionally applies a sort filter, scrolls to load entries, and returns a paginated slice of your connections.",
                "operationId": "listLinkedInConnections",
                "requestBody": {
                    "required": false,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "limit": {
                                        "description": "Maximum number of connections to return.",
                                        "type": "integer",
                                        "default": 10,
                                        "minimum": 1
                                    },
                                    "offset": {
                                        "description": "Number of connections to skip before collecting results (use for pagination).",
                                        "type": "integer",
                                        "default": 0,
                                        "minimum": 0
                                    },
                                    "filter": {
                                        "description": "Sort order to apply in the UI before scraping.",
                                        "type": "string",
                                        "default": "recently added",
                                        "enum": [
                                            "recently added",
                                            "first name",
                                            "last name"
                                        ]
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Connections retrieved successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "e1c6b9a1-2d3f-4a5b-9c8d-1234567890ab"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "description": "List of connections after applying offset/limit.",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "name": {
                                                        "type": "string",
                                                        "example": "Alex Johnson"
                                                    },
                                                    "linkedin_url": {
                                                        "type": "string",
                                                        "format": "url",
                                                        "example": "https://www.linkedin.com/in/alex-johnson/"
                                                    },
                                                    "profile_image": {
                                                        "type": "string",
                                                        "format": "url",
                                                        "example": "https://media.licdn.com/dms/image/C4D03AQ...",
                                                        "nullable": true
                                                    },
                                                    "tagline": {
                                                        "type": "string",
                                                        "example": "Senior Product Manager at ExampleCorp"
                                                    },
                                                    "connected_at": {
                                                        "type": "string",
                                                        "example": "2025-06-18"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Connections retrieved successfully"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "url",
                                            "example": "https://cdn.example.com/screenshots/list-connections-abc123.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 25
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Could not open connections modal: Failed to locate the filter dropdown trigger"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Failed to scrape connections"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-scrape-posts": {
            "post": {
                "tags": [
                    "LinkedIn Posts"
                ],
                "summary": "Scrape recent LinkedIn posts from a profile or company page",
                "description": "Accepts either a personal profile URL (e.g., https://www.linkedin.com/in/...) or a company URL (e.g., https://www.linkedin.com/company/...). For profiles, it navigates to the Recent Activity feed; for companies, it goes to the Posts tab, sorts by Recent, scrolls to load items, and returns structured post data.",
                "operationId": "scrapeLinkedInPosts",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "LinkedIn URL of a person (/in/...) or company (/company/...).",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://www.linkedin.com/in/jane-doe/"
                                    },
                                    "offset": {
                                        "description": "Number of posts to skip before collecting results.",
                                        "type": "integer",
                                        "default": 0,
                                        "minimum": 0
                                    },
                                    "limit": {
                                        "description": "Maximum number of posts to return.",
                                        "type": "integer",
                                        "default": 3,
                                        "minimum": 1
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Posts successfully scraped",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "e1c6b9a1-2d3f-4a5b-9c8d-1234567890ab"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "description": "Scraped posts after applying offset/limit.",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "content": {
                                                        "type": "string",
                                                        "example": "Thrilled to share our latest product update...",
                                                        "nullable": true
                                                    },
                                                    "time_and_visibility": {
                                                        "type": "string",
                                                        "example": "1d • Public"
                                                    },
                                                    "author": {
                                                        "type": "string",
                                                        "example": "Acme Inc."
                                                    },
                                                    "author_description": {
                                                        "type": "string",
                                                        "example": "Innovating widgets since 1999",
                                                        "nullable": true
                                                    },
                                                    "reactions": {
                                                        "type": "string",
                                                        "example": "125",
                                                        "nullable": true
                                                    },
                                                    "post_url": {
                                                        "type": "string",
                                                        "format": "url",
                                                        "example": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Posts successfully scraped"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "url",
                                            "example": "https://cdn.example.com/screenshots/scrape-posts-abc123.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 30
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "oneOf": [
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Invalid LinkedIn URL provided. Please provide a valid company or profile URL."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "You should provide a valid LinkedIn URL. It should either start with https://www.linkedin.com/in or https://www.linkedin.com/company"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Could not scroll to bottom"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Could not get company posts"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-scrape-profiles-from-post-comments": {
            "post": {
                "tags": [
                    "LinkedIn Posts"
                ],
                "summary": "Scrape LinkedIn Profiles from Post Comments",
                "description": "Fetches LinkedIn profile data from comments and/or reactions on a specific LinkedIn post URL.",
                "operationId": "scrapeProfilesFromPostComments",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "postUrl"
                                ],
                                "properties": {
                                    "postUrl": {
                                        "description": "The LinkedIn post URL containing comments/reactions. Must look like 'linkedin.com/posts/...' or 'linkedin.com/feed/update/...'",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://www.linkedin.com/feed/update/urn:li:activity:1234567890/"
                                    },
                                    "add_reactions": {
                                        "description": "Whether to collect reactors from the post's reactions modal.",
                                        "type": "boolean",
                                        "default": false,
                                        "example": true
                                    },
                                    "reactions_offset": {
                                        "description": "Zero-based offset into the reactions list (pagination).",
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "reactions_limit": {
                                        "description": "Maximum number of reactors to return. Default: 200.",
                                        "type": "integer",
                                        "default": 200,
                                        "example": 200
                                    },
                                    "add_comments": {
                                        "description": "Whether to scrape commenters under the post.",
                                        "type": "boolean",
                                        "default": true,
                                        "example": true
                                    },
                                    "comments_offset": {
                                        "description": "Zero-based offset into the comments list (pagination).",
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "comments_limit": {
                                        "description": "Maximum number of comments (profiles) to return.",
                                        "type": "integer",
                                        "example": 100
                                    },
                                    "deduplicate": {
                                        "description": "If true, deduplicate commenters by linkedin_url (keeps first occurrence). Default: false.",
                                        "type": "boolean",
                                        "default": false,
                                        "example": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful response with LinkedIn profile data from post comments/reactions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "description": "Alias of `comments` for backward compatibility.",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "linkedin_url": {
                                                        "type": "string"
                                                    },
                                                    "image_url": {
                                                        "type": "string"
                                                    },
                                                    "tagline": {
                                                        "type": "string"
                                                    },
                                                    "comment": {
                                                        "type": "string"
                                                    },
                                                    "likes": {
                                                        "type": "integer"
                                                    },
                                                    "replies": {
                                                        "type": "integer"
                                                    },
                                                    "relation": {
                                                        "type": "string"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "comments": {
                                            "description": "Commenter profiles scraped from the post.",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "linkedin_url": {
                                                        "type": "string"
                                                    },
                                                    "image_url": {
                                                        "type": "string"
                                                    },
                                                    "tagline": {
                                                        "type": "string"
                                                    },
                                                    "comment": {
                                                        "type": "string"
                                                    },
                                                    "likes": {
                                                        "type": "integer"
                                                    },
                                                    "replies": {
                                                        "type": "integer"
                                                    },
                                                    "relation": {
                                                        "type": "string"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "reactions": {
                                            "description": "Reactors scraped from the reactions modal (present when add_reactions=true).",
                                            "type": "array",
                                            "items": {
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "linkedin_url": {
                                                        "type": "string"
                                                    },
                                                    "image_url": {
                                                        "type": "string"
                                                    },
                                                    "tagline": {
                                                        "type": "string"
                                                    },
                                                    "reaction_type": {
                                                        "description": "One of: like, love, celebrate, appreciate, insightful, funny.",
                                                        "type": "string",
                                                        "example": "like"
                                                    },
                                                    "relation": {
                                                        "type": "string"
                                                    }
                                                },
                                                "type": "object"
                                            }
                                        },
                                        "message": {
                                            "type": "string"
                                        },
                                        "image_url": {
                                            "type": "string"
                                        },
                                        "credits_used": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Your postUrl is invalid. Navigate to a post in LinkedIn, click on the three dots in the top right corner, and select 'Copy link to post'."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized (invalid token or not logged in to LinkedIn)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: ..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-scrape-profiles-from-search": {
            "post": {
                "tags": [
                    "LinkedIn Search"
                ],
                "summary": "Scrape LinkedIn profiles or companies from search results",
                "description": "Builds a LinkedIn search URL (or uses a provided one), optionally applies a location filter, paginates through search results, and returns structured profile/company data.",
                "operationId": "scrapeLinkedInProfilesFromSearch",
                "requestBody": {
                    "required": false,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "searchTerm": {
                                        "description": "Free-text query used to construct the LinkedIn search URL when searchUrl is not provided.",
                                        "type": "string",
                                        "example": "Javascript Developer"
                                    },
                                    "category": {
                                        "description": "Select the search vertical. Defaults to people. If set to companies, the company search vertical is used.",
                                        "type": "string",
                                        "enum": [
                                            "people",
                                            "companies"
                                        ],
                                        "example": "people"
                                    },
                                    "searchUrl": {
                                        "description": "Optional full LinkedIn search URL (people/companies or Sales Navigator). Must start with 'https://www.linkedin.com/search/results' or 'https://www.linkedin.com/sales/search'. If provided, it takes precedence over searchTerm/category.",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://www.linkedin.com/search/results/people/?keywords=javascript%20developer"
                                    },
                                    "startPage": {
                                        "description": "Page number to start from (1-indexed).",
                                        "type": "integer",
                                        "default": 1,
                                        "minimum": 1
                                    },
                                    "nrOfPages": {
                                        "description": "Number of result pages to scrape.",
                                        "type": "integer",
                                        "default": 1,
                                        "minimum": 1
                                    },
                                    "city": {
                                        "description": "Optional city to filter by (used only when searchUrl is not provided). Use the English name.",
                                        "type": "string"
                                    },
                                    "country": {
                                        "description": "Optional country to filter by (used only when searchUrl is not provided). Use the English name.",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successfully scraped profiles from search",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "9d7b0a24-6fb7-4a9f-9e35-1c2b3a4d5e6f"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "data": {
                                            "description": "Aggregated results across the requested pages. Query parameters 'startPage' and 'nrOfPages' determine pagination.",
                                            "type": "array",
                                            "items": {
                                                "oneOf": [
                                                    {
                                                        "properties": {
                                                            "name": {
                                                                "type": "string",
                                                                "example": "Rafa Manuels"
                                                            },
                                                            "linkedin_url": {
                                                                "type": "string",
                                                                "format": "url",
                                                                "example": "https://www.linkedin.com/in/rafa-manuels/"
                                                            },
                                                            "image_url": {
                                                                "type": "string",
                                                                "format": "url",
                                                                "example": "https://media.licdn.com/dms/image/C4D03AQ...",
                                                                "nullable": true
                                                            },
                                                            "tagline": {
                                                                "type": "string",
                                                                "example": "Senior JavaScript Developer at ExampleCorp"
                                                            },
                                                            "location": {
                                                                "type": "string",
                                                                "example": "Amsterdam, North Holland, Netherlands"
                                                            },
                                                            "summary": {
                                                                "type": "string",
                                                                "example": "Building scalable frontend architectures.",
                                                                "nullable": true
                                                            }
                                                        },
                                                        "type": "object"
                                                    },
                                                    {
                                                        "properties": {
                                                            "name": {
                                                                "type": "string",
                                                                "example": "Acme Inc."
                                                            },
                                                            "linkedin_url": {
                                                                "type": "string",
                                                                "format": "url",
                                                                "example": "https://www.linkedin.com/company/acme-inc/"
                                                            },
                                                            "image_url": {
                                                                "type": "string",
                                                                "format": "url",
                                                                "example": "https://media.licdn.com/dms/image/C560BAQ...",
                                                                "nullable": true
                                                            },
                                                            "tagline": {
                                                                "type": "string",
                                                                "example": "Innovating widgets since 1999"
                                                            },
                                                            "followers": {
                                                                "type": "string",
                                                                "example": "12,345 followers",
                                                                "nullable": true
                                                            },
                                                            "summary": {
                                                                "type": "string",
                                                                "example": "We help developers ship faster.",
                                                                "nullable": true
                                                            }
                                                        },
                                                        "type": "object"
                                                    }
                                                ]
                                            }
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Successfully scraped profiles from search"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "url",
                                            "example": "https://cdn.example.com/screenshots/search-page-1.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 20
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "oneOf": [
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Invalid start page provided."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Invalid search URL provided. It must start with 'https://www.linkedin.com/search/results' or 'https://www.linkedin.com/sales/search'"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Location not found. Please use the English name of the city and country."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Failed during scroll #2: ..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-connection-invite": {
            "post": {
                "tags": [
                    "LinkedIn Connections"
                ],
                "summary": "Send a LinkedIn connection invite to a profile",
                "description": "Opens the target LinkedIn profile, detects current relationship state (connected/pending), then sends a connection invite. Optionally includes a note if provided.",
                "operationId": "sendLinkedInConnectionInvite",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "Target LinkedIn profile URL (must be a personal profile). Must start with https://www.linkedin.com/in/...",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://www.linkedin.com/in/jane-doe/"
                                    },
                                    "message": {
                                        "description": "Optional invitation note. LinkedIn enforces a small character limit; long notes may be rejected.",
                                        "type": "string",
                                        "example": "Hi Jane — loved your recent talk on web performance. Would be great to connect!",
                                        "nullable": true
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Invitation sent (with or without note)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "c7e4f3da-9b1a-4e2b-8a3c-12ab34cd56ef"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Succesfully send connection invite"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "url",
                                            "example": "https://cdn.example.com/screenshots/invite-sent-abc123.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 50
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "oneOf": [
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Your profileUrl is invalid. Make sure you have a valid url to a persons Linkedin profile page. It should start with https://linkedin.com/in/"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "You are already connected with this person."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "You have already sent a connection invite to this person and its still pending."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "LinkedIn is prompting a notification, please accept or deny and try again."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Could not locate the 'Connect' button."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Invalid LinkedIn profile URL or already connected with this person."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Your message may exceed LinkedIn's character limit."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "You have reached LinkedIns limit of adding messages in connection requests, please remove message to continue inviting connections."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Failed to add a message. The interface might have changed."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Could not Navigate to Linkedin"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/api/linkedin-send-message": {
            "post": {
                "tags": [
                    "LinkedIn Messaging"
                ],
                "summary": "Send a LinkedIn message to a connection",
                "description": "Opens the target LinkedIn profile, launches the chat window (requires existing connection), sends the provided message, and closes the window.",
                "operationId": "sendLinkedInMessage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "required": [
                                    "linkedinUrl",
                                    "message"
                                ],
                                "properties": {
                                    "linkedinUrl": {
                                        "description": "Target LinkedIn personal profile URL. Must start with https://www.linkedin.com/in/...",
                                        "type": "string",
                                        "format": "url",
                                        "example": "https://www.linkedin.com/in/jane-doe/"
                                    },
                                    "message": {
                                        "description": "Message text to send. Emojis or special characters may be normalized; unsupported characters can cause an error.",
                                        "type": "string",
                                        "example": "Hey Jane! Great meeting you at the meetup—would love to continue the chat."
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Message sent successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "sessionId": {
                                            "type": "string",
                                            "example": "b4b8a2b1-7b1f-48e1-9a4e-112233445566"
                                        },
                                        "success": {
                                            "type": "boolean",
                                            "example": true
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Succesfully send message"
                                        },
                                        "image_url": {
                                            "type": "string",
                                            "format": "url",
                                            "example": "https://cdn.example.com/screenshots/send-message-abc123.png"
                                        },
                                        "credits_used": {
                                            "type": "integer",
                                            "example": 30
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "oneOf": [
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Invalid LinkedIn profile URL. This module requires a personal LinkedIn profile, not a company profile."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Your profileUrl is invalid. Make sure you have a valid url to a persons Linkedin profile page. It should start with https://linkedin.com/in/"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Profile URL or message text is missing."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Are you sure this person is a connection already?"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Primary button not found."
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Cannot find the chatbox, are you sure you are connected with this person?"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "properties": {
                                                "error": {
                                                    "type": "string",
                                                    "example": "Cannot send message, this can happen if you have invalid characters in your message, like some emoticons or special characters. Please try again with a different message."
                                                }
                                            },
                                            "type": "object"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Invalid API token"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "An error occurred: Could not take HTML snapshot. ..."
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "apiKey",
                "name": "Authorization",
                "in": "header"
            }
        }
    },
    "tags": [
        {
            "name": "Browserflow API",
            "description": "General endpoints for Browserflow API."
        },
        {
            "name": "LinkedIn Connection Check",
            "description": "LinkedIn Connection Check"
        },
        {
            "name": "LinkedIn Chat",
            "description": "LinkedIn Chat"
        },
        {
            "name": "LinkedIn Profile Data",
            "description": "LinkedIn Profile Data"
        },
        {
            "name": "LinkedIn Connections",
            "description": "LinkedIn Connections"
        },
        {
            "name": "LinkedIn Posts",
            "description": "LinkedIn Posts"
        },
        {
            "name": "LinkedIn Search",
            "description": "LinkedIn Search"
        },
        {
            "name": "LinkedIn Messaging",
            "description": "LinkedIn Messaging"
        }
    ]
}