{
  "openapi": "3.0.1",
  "info": {
    "title": "Lemmy Instance Extractor",
    "description": "Point at ANY Lemmy instance (lemmy.world, sh.itjust.works, lemm.ee…) and pull instance stats, posts, comments or communities into clean flat rows. One actor reads every federated /api/v3 server. Sort + community filters, auto-paged, lossless _raw. Pay per item.",
    "version": "0.1",
    "x-build-id": "ioLxY4Y3CBbTPyd76"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datamule~lemmy-instance-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datamule-lemmy-instance-extractor",
        "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/datamule~lemmy-instance-extractor/runs": {
      "post": {
        "operationId": "runs-sync-datamule-lemmy-instance-extractor",
        "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/datamule~lemmy-instance-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-datamule-lemmy-instance-extractor",
        "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",
        "required": [
          "instances"
        ],
        "properties": {
          "instances": {
            "title": "Lemmy instance(s)",
            "type": "array",
            "description": "One or more Lemmy instances as bare hostnames or base URLs. Every federated Lemmy server speaks the identical unauthenticated /api/v3 REST API, so point this at as many as you like. Examples: lemmy.world, https://sh.itjust.works, lemm.ee, programming.dev. An instance that is down or is not a Lemmy server is skipped with a warning and the run continues.",
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "title": "Mode (what to extract)",
            "enum": [
              "site",
              "posts",
              "comments",
              "communities"
            ],
            "type": "string",
            "description": "Which Lemmy collection to read from each instance. site = the instance's own metadata + live stats (one row per instance — a federated-instance census). posts / comments / communities = a paginated feed (one row per item), honouring the sort and, for posts/comments, an optional community filter.",
            "default": "site"
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "Active",
              "Hot",
              "New",
              "Old",
              "MostComments",
              "TopDay",
              "TopWeek",
              "TopMonth",
              "TopYear",
              "TopAll",
              "Controversial",
              "Scaled"
            ],
            "type": "string",
            "description": "Sort order for feed modes (ignored for site mode). Note: Lemmy's comment feed only supports Hot / Top / New / Old / Controversial — any other sort you pick is automatically mapped to the closest comment-valid sort, so your run never fails on an unsupported sort. Posts and communities support the full set below.",
            "default": "Active"
          },
          "limit": {
            "title": "Limit (items per instance)",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of items to fetch PER INSTANCE in feed modes (posts / comments / communities). Lemmy caps a single API request at 50 items, so larger values are fetched by paging automatically. Ignored in site mode (always one row per instance). Each emitted row is one billable event. Default 50.",
            "default": 50
          },
          "communityName": {
            "title": "Community filter (name)",
            "type": "string",
            "description": "Optional. Restrict posts / comments to a single community. Use a local name (technology) or a fully-qualified federated name (technology@lemmy.world). Ignored for site / communities modes and when Community ID is set."
          },
          "communityId": {
            "title": "Community filter (numeric ID)",
            "type": "integer",
            "description": "Optional. Restrict posts / comments to a community by its numeric local ID on the target instance. Takes precedence over Community name. Ignored for site / communities modes."
          },
          "postId": {
            "title": "Post filter (numeric ID)",
            "type": "integer",
            "description": "Optional. In comments mode, restrict to the comment thread of a single post by its numeric ID on the target instance. Ignored in other modes."
          },
          "listingType": {
            "title": "Listing type",
            "enum": [
              "All",
              "Local"
            ],
            "type": "string",
            "description": "Optional listing scope for posts / communities modes. All = the whole federated view (default). Local = only content originating on that instance. (Subscribed / ModeratorView require a logged-in account and are not useful unauthenticated.)",
            "default": "All"
          },
          "userAgent": {
            "title": "User-Agent (optional)",
            "type": "string",
            "description": "Optional custom User-Agent header. A descriptive default is sent if left empty. Some instances rate-limit or block generic agents."
          },
          "extraHeaders": {
            "title": "Extra request headers (optional)",
            "type": "object",
            "description": "Optional extra HTTP headers to send with every request, as a JSON object. Not required for public instances (the Lemmy read API needs no auth). Never logged."
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}