{
  "openapi": "3.0.1",
  "info": {
    "title": "Lemmy Posts, Comments, Threads & Communities (no login)",
    "description": "Public Lemmy data as rows: posts of named communities or of the whole site, keyword search over posts and comments, the full comment tree of any post, a user's public posts and comments, and community size and activity counts. Author and community server on every row. Keyless API, UTC dates.",
    "version": "0.1",
    "x-build-id": "P3bs3SledbnH9BHGp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yadroo~lemmy-public-posts/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yadroo-lemmy-public-posts",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/yadroo~lemmy-public-posts/runs": {
      "post": {
        "operationId": "runs-sync-yadroo-lemmy-public-posts",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/yadroo~lemmy-public-posts/run-sync": {
      "post": {
        "operationId": "run-sync-yadroo-lemmy-public-posts",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "What to fetch",
            "enum": [
              "communityPosts",
              "searchPosts",
              "searchComments",
              "postComments",
              "userActivity",
              "communities"
            ],
            "type": "string",
            "description": "One question per run. `communityPosts`: the posts of the communities you name, or the site-wide feed when none is named. `searchPosts` / `searchComments`: one keyword across every community the server knows. `postComments`: the whole discussion under the posts you name, numbered by reply depth. `userActivity`: what named users posted and commented in public. `communities`: which communities exist for a topic, with their size and activity. Each mode fills one dataset view.",
            "default": "communityPosts"
          },
          "communities": {
            "title": "Communities",
            "type": "array",
            "description": "`name` for a community hosted on lemmy.world, `name@server` for one anywhere else (`programming@programming.dev`), or a community link. `communityPosts` splits the row limit evenly over them and writes the source community to `matchedCommunity`; leave empty for the site-wide feed. `searchPosts` and `searchComments` search inside the first one only. `communities` mode returns them with their counts and moderator count.",
            "items": {
              "type": "string"
            }
          },
          "listingType": {
            "title": "Which part of the network",
            "enum": [
              "all",
              "local"
            ],
            "type": "string",
            "description": "Applies when no community is named (the site-wide feed in `communityPosts`), to `searchPosts` and `searchComments`, and to the ranked list in `communities`. `all` is the federated view and the wider sample; `local` keeps only communities hosted on lemmy.world, which is what a study of that one community needs. Compare the result against the `communityInstance` column.",
            "default": "all"
          },
          "sort": {
            "title": "Sort posts by",
            "enum": [
              "New",
              "Old",
              "Hot",
              "Active",
              "Scaled",
              "MostComments",
              "NewComments",
              "Controversial",
              "TopHour",
              "TopSixHour",
              "TopTwelveHour",
              "TopDay",
              "TopWeek",
              "TopMonth",
              "TopYear",
              "TopAll"
            ],
            "type": "string",
            "description": "The order the source ranks posts in, used by `communityPosts`, `searchPosts`, `searchComments` and the ranked list in `communities`. `New` is the one to keep for a monitoring schedule: it is the only order in which a rolling window can stop paging early, so it is also the cheapest. The `Top*` orders are windows as well as orders - `TopWeek` can never return a post older than seven days, so do not combine them with a longer window and expect more rows.",
            "default": "New"
          },
          "searchQuery": {
            "title": "Keyword",
            "type": "string",
            "description": "What to search for in `searchPosts` (matched against post titles, bodies and posted links), in `searchComments` (comment text) and in `communities` (community names and titles). One phrase per run; the word that produced a row is written to `matchedQuery`. The source matches substrings case-insensitively and does not support quotes, AND/OR or wildcards - for several phrases, run several tasks and merge the datasets."
          },
          "postUrls": {
            "title": "Post links or ids",
            "type": "array",
            "description": "Posts whose discussion you want, used by `postComments`. Accepted: a lemmy.world link (`lemmy.world/post/<id>`), the bare numeric id, or a post link on any other Lemmy instance (`programming.dev/post/<id>`) - a foreign link is first resolved to the copy this server holds, because every instance numbers posts differently. Every post row of any mode carries `postId` and `url`, so a feed or search run can be chained into a thread run. A deleted or unknown post yields one row with `found: false`.",
            "items": {
              "type": "string"
            }
          },
          "includeOriginalPost": {
            "title": "Also write the post itself",
            "type": "boolean",
            "description": "On by default: `postComments` writes one post row (`rowType: \"post\"`, no reply depth) before the comments of each thread, so the dataset carries the title, body, score and link the discussion is about. Switch off to get comments only - useful when you append many threads into one dataset for text analysis.",
            "default": true
          },
          "maxCommentDepth": {
            "title": "How deep to follow replies",
            "minimum": 1,
            "maximum": 50,
            "type": "number",
            "description": "Levels of replies to fetch in `postComments`: 1 is only the direct replies to the post, 8 covers almost every real thread. The source returns a whole subtree at once, so a deeper limit costs no extra requests but does cost rows - keep `maxItems` in mind on threads with hundreds of comments.",
            "default": 8
          },
          "commentSort": {
            "title": "Sort comments by",
            "enum": [
              "Top",
              "New",
              "Old",
              "Hot",
              "Controversial"
            ],
            "type": "string",
            "description": "Order of the comment branches in `postComments`. `Top` puts the branches the community agreed with first, which is what you want when `maxItems` cuts a long thread; `Old` reads the conversation the way it happened. The order applies inside every branch, the reply structure itself never changes.",
            "default": "Top"
          },
          "users": {
            "title": "Users",
            "type": "array",
            "description": "Users whose public activity you want in `userActivity`, as `name` for a lemmy.world account, `name@server` for an account anywhere else, or as a profile link. The row limit is split evenly over them. Rows carry `authorPostCount` and `authorCommentCount`, the lifetime totals the source publishes for that account, so you can tell a one-post account from a prolific one without a second run. An unknown or deleted account yields one row with `found: false`.",
            "items": {
              "type": "string"
            }
          },
          "userContent": {
            "title": "Posts, comments or both",
            "enum": [
              "posts",
              "comments",
              "both"
            ],
            "type": "string",
            "description": "What `userActivity` writes. `posts` is the account's own submissions, `comments` its replies in other people's threads - on Lemmy most accounts comment far more than they post, so `comments` is usually the bigger half. `both` splits the row limit evenly and mixes the two, newest first; the `rowType` column keeps them apart.",
            "default": "posts"
          },
          "languages": {
            "title": "Post languages",
            "type": "array",
            "description": "Keep only posts or comments whose declared language is one of these, compared against the `language` column. Empty = every language. Read the honest part first: Lemmy stores a language per post, but most clients never set it, so a large share of real rows carry `und` (not set) rather than `en`. Pick `English` **and** `Not set (undetermined)` together if you want English-speaking communities without losing most of their posts.",
            "items": {
              "type": "string",
              "enum": [
                "und",
                "en",
                "de",
                "fr",
                "es",
                "pt",
                "it",
                "nl",
                "sv",
                "da",
                "nb",
                "fi",
                "pl",
                "cs",
                "ru",
                "uk",
                "tr",
                "ja",
                "zh",
                "ko",
                "ar",
                "ca"
              ],
              "enumTitles": [
                "Not set (undetermined)",
                "English",
                "German",
                "French",
                "Spanish",
                "Portuguese",
                "Italian",
                "Dutch",
                "Swedish",
                "Danish",
                "Norwegian",
                "Finnish",
                "Polish",
                "Czech",
                "Russian",
                "Ukrainian",
                "Turkish",
                "Japanese",
                "Chinese",
                "Korean",
                "Arabic",
                "Catalan"
              ]
            }
          },
          "authorInstances": {
            "title": "Only authors from these servers",
            "type": "array",
            "description": "Keep only rows whose author lives on one of these servers, for example `lemmy.world`, `lemm.ee`, `programming.dev`, `sh.itjust.works`. Compared against the `authorInstance` column. Empty = every server. This is the filter a federated network needs: watch one instance's voices inside a worldwide community, or drop an instance that floods a feed.",
            "items": {
              "type": "string"
            }
          },
          "communityInstances": {
            "title": "Only communities on these servers",
            "type": "array",
            "description": "Keep only rows whose community is hosted on one of these servers, compared against the `communityInstance` column. Empty = every server. Useful for a site-wide or search run that should stay inside a known set of instances - a narrower form of the `local` listing, where you choose the servers yourself.",
            "items": {
              "type": "string"
            }
          },
          "minScore": {
            "title": "At least this score",
            "minimum": -100000,
            "maximum": 100000,
            "type": "number",
            "description": "Keep only posts or comments whose score (upvotes minus downvotes) is at least this value. Empty = no floor. Use it to skip the long tail of a busy community and keep what people actually reacted to. Scores are a snapshot and keep moving, which is why every row carries `fetchedAt`; `upvotes` and `downvotes` are also written separately."
          },
          "minComments": {
            "title": "At least this many comments",
            "minimum": 0,
            "maximum": 100000,
            "type": "number",
            "description": "Keep only posts with at least this many comments. Empty = no floor. On a question-and-answer community this is the \"got a real discussion\" filter. Ignored for comment rows, which carry `childCount` instead."
          },
          "excludeNsfw": {
            "title": "Drop posts and communities marked NSFW",
            "type": "boolean",
            "description": "On by default, because the site-wide feed and the community directory of an open network mix adult communities into every topic. Rows that survive carry `nsfw: false`. Switch it off for a complete sample - a moderation or research run usually needs one - and the `nsfw` column tells you which rows are flagged.",
            "default": true
          },
          "excludeBots": {
            "title": "Drop posts of accounts marked as bots",
            "type": "boolean",
            "description": "Lemmy news communities are fed by accounts that declare themselves bots, and the source publishes that flag. It is kept off by default so a feed export stays complete; every row carries `authorIsBot`, so you can filter later instead. Switch it on when the question is what humans wrote.",
            "default": false
          },
          "sinceHours": {
            "title": "Posted in the last N hours",
            "minimum": 1,
            "maximum": 8760,
            "type": "number",
            "description": "Rolling window in hours, counted in UTC from the start of the run: 24 for a day, 168 for a week. This is the input a schedule needs - no date to edit between runs. With `sort: New` paging stops as soon as the source returns older rows, so a narrow window is also a cheap run; with any other order the window only filters what was already fetched."
          },
          "onlyNew": {
            "title": "Skip rows seen in earlier runs",
            "type": "boolean",
            "description": "Remember the post and comment ids this run wrote (in a named key-value store of your account, one per task) and, on the next run of the same actor or task, write only what was not written before. Rows are remembered as they are written, so a run stopped by maxItems, your spending limit or the timeout leaves the rest for the next run. An empty run then means nothing new was posted.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 1000,
            "type": "number",
            "description": "Hard cap on the rows this run writes, and therefore on what it costs. Paging stops as soon as the cap is reached. In `communityPosts`, `userActivity` and `postComments` the cap is divided over the communities, users or threads you named, so each one is represented. The run also stops at your maximum cost per run, with a status that says so.",
            "default": 50
          },
          "fields": {
            "title": "Only these columns",
            "type": "array",
            "description": "Keep only these columns, in the order given - for example `authorHandle, community, title, score, createdAt, url`. Empty = every column of the mode. `rowType`, `sourceMode`, `found` and `url` are always kept. Letter case is corrected; a name that is no column of the mode is reported in the status message with the nearest column; a list with no valid column fails the run before any row is written.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}