{
  "openapi": "3.0.1",
  "info": {
    "title": "Data Enrich API",
    "description": "Public LinkedIn and YouTube data API - fetch profiles, posts, comments, videos, channels, and more",
    "version": "1.0.0"
  },
  "servers": [
    { "url": "https://api.dataenrich.tech" }
  ],
  "paths": {
    "/linkedin/v1/profiles": {
      "post": {
        "summary": "Get profile",
        "description": "Returns the public profile behind a LinkedIn profile URL: headline, location, follower and connection counts, current position, experience, education, and skills.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProfileRequest" } } }
        },
        "responses": {
          "200": { "description": "Profile data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Profile" } } } }
        }
      }
    },
    "/linkedin/v1/profiles/metrics": {
      "post": {
        "summary": "Get profile metrics",
        "description": "Returns the public profile social metrics of a LinkedIn profile URL: followers, connections, is_verified",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProfileMetricsRequest" } } }
        },
        "responses": {
          "200": { "description": "Profile metrics data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProfileMetrics" } } } }
        }
      }
    },
    "/linkedin/v1/posts": {
      "post": {
        "summary": "Get user posts",
        "description": "Returns a user's public posts, newest first, with engagement counts. Paginated.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserPostsRequest" } } }
        },
        "responses": {
          "200": { "description": "List of user posts", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserPostsResponse" } } } }
        }
      }
    },
    "/linkedin/v1/posts/search": {
      "post": {
        "summary": "Search posts",
        "description": "Search public posts by keyword, with filters for sort order, recency, and mentions. Page-based pagination, up to 50 results per page.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchPostsRequest" } } }
        },
        "responses": {
          "200": { "description": "Search results with pagination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchPostsResponse" } } } }
        }
      }
    },
    "/linkedin/v1/post-details": {
      "post": {
        "summary": "Get post details",
        "description": "Full detail of a single post by its URL or URN: the author, commentary, reaction breakdown, and optionally the individual comments and reactions, plus any attached content.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PostDetailsRequest" } } }
        },
        "responses": {
          "200": { "description": "Post details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PostDetails" } } } }
        }
      }
    },
    "/linkedin/v1/post-comments": {
      "post": {
        "summary": "Get post comments",
        "description": "Returns the comments on a public post, identified by its post URN. Results are paged with page and size.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PostCommentsRequest" } } }
        },
        "responses": {
          "200": { "description": "Comments list with pagination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PostCommentsResponse" } } } }
        }
      }
    },
    "/linkedin/v1/user-comments": {
      "post": {
        "summary": "Get user comments",
        "description": "Returns the comments a user has written on other posts, with a reference to each post. Paginated.",
        "parameters": [
          { "name": "x-api-key", "in": "header", "required": true, "schema": { "type": "string" }, "description": "API key for authentication" }
        ],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCommentsRequest" } } }
        },
        "responses": {
          "200": { "description": "User comments list with pagination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCommentsResponse" } } } }
        }
      }
    },
    "/youtube/v1/search" : {
      "get" : {
        "summary" : "Search videos",
        "description" : "Search public YouTube videos by query with optional filters.",
        "parameters" : [ {
          "name" : "query",
          "in" : "query",
          "required" : true,
          "schema" : { "type" : "string" },
          "description" : "Search term"
        }, {
          "name" : "sort_by",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Sort order (relevance, uploadDate)"
        }, {
          "name" : "duration",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Filter by duration (short, medium, long)"
        }, {
          "name" : "region",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Region code"
        }, {
          "name" : "type",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Content type (video, playlist, channel)"
        }, {
          "name" : "upload_date",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Upload date range"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "Search results" }
        }
      }
    },
    "/youtube/v1/channel/videos" : {
      "get" : {
        "summary" : "Get channel videos",
        "description" : "Get videos from a YouTube channel.",
        "parameters" : [ {
          "name" : "handle",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel handle (@username)"
        }, {
          "name" : "channel_id",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel ID"
        }, {
          "name" : "sort",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Sort order (newest, popular, oldest)"
        }, {
          "name" : "is_paid_promotions",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Filter for paid promotions"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "List of videos" }
        }
      }
    },
    "/youtube/v1/video" : {
      "get" : {
        "summary" : "Get video details",
        "description" : "Get details about a specific YouTube video.",
        "parameters" : [ {
          "name" : "url",
          "in" : "query",
          "required" : true,
          "schema" : { "type" : "string" },
          "description" : "YouTube video URL"
        }, {
          "name" : "language",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Preferred language"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "Video details" }
        }
      }
    },
    "/youtube/v1/channel/shorts" : {
      "get" : {
        "summary" : "Get channel shorts",
        "description" : "Get YouTube Shorts from a channel.",
        "parameters" : [ {
          "name" : "handle",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel handle (@username)"
        }, {
          "name" : "channel_id",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel ID"
        }, {
          "name" : "sort",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Sort order (newest, popular, oldest)"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "List of shorts" }
        }
      }
    },
    "/youtube/v1/channel/lives" : {
      "get" : {
        "summary" : "Get channel lives",
        "description" : "Get live streams from a channel.",
        "parameters" : [ {
          "name" : "handle",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel handle (@username)"
        }, {
          "name" : "channel_id",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel ID"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "List of live streams" }
        }
      }
    },
    "/youtube/v1/channel/playlists" : {
      "get" : {
        "summary" : "Get channel playlists",
        "description" : "Get playlists from a channel.",
        "parameters" : [ {
          "name" : "handle",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel handle (@username)"
        }, {
          "name" : "channel_id",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel ID"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "List of playlists" }
        }
      }
    },
    "/youtube/v1/video/comments" : {
      "get" : {
        "summary" : "Get video comments",
        "description" : "Get comments from a YouTube video.",
        "parameters" : [ {
          "name" : "url",
          "in" : "query",
          "required" : true,
          "schema" : { "type" : "string" },
          "description" : "YouTube video URL"
        }, {
          "name" : "order",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Sort order (relevance, time)"
        }, {
          "name" : "continuation_token",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Pagination cursor"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "List of comments" }
        }
      }
    },
    "/youtube/v1/channel" : {
      "get" : {
        "summary" : "Get channel",
        "description" : "Get information about a YouTube channel.",
        "parameters" : [ {
          "name" : "url",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel URL"
        }, {
          "name" : "handle",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel handle (@username)"
        }, {
          "name" : "channel_id",
          "in" : "query",
          "schema" : { "type" : "string" },
          "description" : "Channel ID"
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "required" : true,
          "schema" : { "type" : "string" }
        } ],
        "responses" : {
          "200" : { "description" : "Channel information" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": { "type": "apiKey", "in": "header", "name": "x-api-key" }
    },
    "schemas": {
      "Empty" : {
        "title" : "Empty Schema",
        "type" : "object"
    },
      "ProfileRequest": {
        "type": "object",
        "required": ["url"],
        "properties": {
          "url": { "type": "string", "description": "Public LinkedIn profile URL" }
        }
      },
      "ProfileMetricsRequest": {
        "type": "object",
        "required": ["url"],
        "properties": {
          "url": { "type": "string", "description": "Public LinkedIn profile URL" }
        }
      },
      "Profile": {
        "type": "object",
        "properties": {
          "url": { "type": "string" },
          "name": { "type": "string" },
          "headline": { "type": "string" },
          "location": { "type": "string" },
          "followers": { "type": "integer" },
          "connections": { "type": "integer" },
          "current_position": { "type": "object" },
          "experience": { "type": "array", "items": { "type": "object" } },
          "education": { "type": "array", "items": { "type": "object" } },
          "skills": { "type": "array", "items": { "type": "string" } }
        }
      },
      "ProfileMetrics": {
        "type": "object",
        "properties": {
          "verified": { "type": "boolean" },
          "followersCount": { "type": "integer" },
          "connectionsCount": { "type": "integer" }
        }
      },
      "UserPostsRequest": {
        "type": "object",
        "required": ["urn"],
        "properties": {
          "urn": { "type": "string", "description": "Public LinkedIn profile urn for individuals and not for company" },
          "paginationToken": { "type": "string", "description": "Pagination cursor from a previous response" },
          "size": { "type": "integer", "description": "Number of results to be returned in single api call" }
        }
      },
      "UserPostsResponse": {
        "type": "object",
        "properties": {
          "content": { "type": "array", "items": { "$ref": "#/components/schemas/Post" } },
          "paginationToken": { "type": "string" }
        }
      },
      "Post": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "commentary": { "type": "string" },
          "totalComments": { "type": "integer" },
          "totalReactions": { "type": "integer" },
          "totalShares": { "type": "integer" },
          "reactionType": { "type": "object" },
          "url": { "type": "string" },
          "author": { "type": "object" },
          "content": { "type": "object" }
        }
      },
      "SearchPostsRequest": {
        "type": "object",
        "required": ["keyword"],
        "properties": {
          "keyword": { "type": "string", "description": "Search term" },
          "sort": { "type": "string", "enum": ["RELEVANCE", "DATE_POSTED"], "default": "RELEVANCE", "description": "RELEVANCE or DATE_POSTED" },
          "datePosted": { "type": "string", "enum": ["PAST_24_HOURS", "PAST_WEEK", "PAST_MONTH"], "description": "PAST_24_HOURS, PAST_WEEK, or PAST_MONTH" },
          "fromCompany": { "type": "array", "items": { "type": "string" }, "description": "Restrict to authors by company entity URN (numeric strings)" },
          "mentionsPerson": { "type": "array", "items": { "type": "string" }, "description": "Posts mentioning these person entity URNs" },
          "mentionsCompany": { "type": "array", "items": { "type": "string" }, "description": "Posts mentioning these company entity URNs (numeric strings)" },
          "page": { "type": "integer", "default": 0, "minimum": 0, "description": "Page number, from 0" },
          "size": { "type": "integer", "default": 10, "minimum": 1, "maximum": 50, "description": "Results per page, 1 to 50" }
        }
      },
      "SearchPostsResponse": {
        "type": "object",
        "properties": {
          "content": { "type": "array", "items": { "$ref": "#/components/schemas/Post" } },
          "pageable": { "type": "object" },
          "totalElements": { "type": "integer" },
          "totalPages": { "type": "integer" },
          "first": { "type": "boolean" },
          "last": { "type": "boolean" },
          "size": { "type": "integer" },
          "number": { "type": "integer" },
          "numberOfElements": { "type": "integer" },
          "empty": { "type": "boolean" }
        }
      },
      "PostDetailsRequest": {
        "type": "object",
        "properties": {
          "url": { "type": "string", "description": "Public LinkedIn post URL" },
          "urn": { "type": "string", "description": "Post URN, for example urn:li:activity:7361200000000000000" },
          "comments": { "type": "boolean", "default": true, "description": "Include the comments array" },
          "reactions": { "type": "boolean", "default": true, "description": "Include the reactions array" }
        },
        "oneOf": [ { "required": ["url"] }, { "required": ["urn"] } ]
      },
      "PostDetails": {
        "type": "object",
        "properties": {
          "urn": { "type": "string" },
          "threadUrn": { "type": "string" },
          "shareUrn": { "type": "string" },
          "commentary": { "type": "string" },
          "numComments": { "type": "integer" },
          "numReactions": { "type": "integer" },
          "reactionType": { "type": "object" },
          "shareUrl": { "type": "string" },
          "actor": { "type": "object" },
          "comments": { "type": "array", "items": { "type": "object" } },
          "reactions": { "type": "array", "items": { "type": "object" } },
          "content": { "type": "object" },
          "sponsored": { "type": "boolean" }
        }
      },
      "PostCommentsRequest": {
        "type": "object",
        "required": ["urn"],
        "properties": {
          "urn": { "type": "string", "description": "The post URN, for example urn:li:activity:7376356221991178240" },
          "page": { "type": "integer", "default": 0, "description": "Zero-based page number" },
          "size": { "type": "integer", "default": 10, "description": "Items per page" }
        }
      },
      "PostCommentsResponse": {
        "type": "object",
        "properties": {
          "content": { "type": "array", "items": { "type": "object" } },
          "pageable": { "type": "object" },
          "last": { "type": "boolean" },
          "totalElements": { "type": "integer" },
          "totalPages": { "type": "integer" },
          "first": { "type": "boolean" },
          "size": { "type": "integer" },
          "number": { "type": "integer" },
          "numberOfElements": { "type": "integer" },
          "empty": { "type": "boolean" }
        }
      },
      "UserCommentsRequest": {
        "type": "object",
        "required": ["urn"],
        "properties": {
          "urn": { "type": "string", "description": "Public LinkedIn profile urn for individuals and not for company" },
          "paginationToken": { "type": "string", "description": "Pagination cursor from a previous response" },
          "size": { "type": "integer", "description": "Number of results to be returned in single api call" }
        }
      },
      "UserCommentsResponse": {
        "type": "object",
        "properties": {
          "content": { "type": "array", "items": { "type": "object" } },
          "paginationToken": { "type": "string" }
        }
      }
    }
  },
  "security": [ { "apiKey": [] } ]
}
