{
  "openapi": "3.0.1",
  "info": {
    "title": "Research Paper RAG: arXiv, PubMed and Open Access",
    "description": "Turn an open-access research paper from arXiv, PubMed or Europe PMC into Markdown and token-counted RAG chunks. DOI, authors and license travel with every chunk. Official APIs only, no browser, no API key. Not affiliated with arXiv, PubMed, Europe PMC or OpenAlex.",
    "version": "1.0",
    "x-build-id": "XvMxxkDfkXcOO9HIF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mmdincer~research-paper-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mmdincer-research-paper-rag",
        "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/mmdincer~research-paper-rag/runs": {
      "post": {
        "operationId": "runs-sync-mmdincer-research-paper-rag",
        "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/mmdincer~research-paper-rag/run-sync": {
      "post": {
        "operationId": "run-sync-mmdincer-research-paper-rag",
        "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": {
          "papers": {
            "title": "Papers",
            "maxItems": 25,
            "type": "array",
            "description": "DOIs, PMIDs, PMCIDs, arXiv ids, OpenAlex work ids, or links to those records. One per line, up to 25. Example: <code>PMC4792175</code> or <code>arXiv:2405.13832</code> or <code>10.1038/sdata.2016.18</code>.",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Search query",
            "maxLength": 300,
            "type": "string",
            "description": "Optional, unless New papers this week is on. Finds open-access papers with full text. Europe PMC (PubMed OA) and the arXiv API are searched. OpenAlex keyword search runs only when you supply your own OpenAlex key, because that call is billed by OpenAlex. A weekly watch does not search OpenAlex."
          },
          "sources": {
            "title": "Sources",
            "uniqueItems": true,
            "type": "array",
            "description": "Which official sources to ask. Europe PMC serves PubMed open-access full text. arXiv serves HTML when the paper's licence allows redistribution. OpenAlex supplies the licence, the ids and, when you add a key, its cached PDF.",
            "items": {
              "type": "string",
              "enum": [
                "europepmc",
                "openalex",
                "arxiv"
              ],
              "enumTitles": [
                "Europe PMC (PubMed OA full text)",
                "OpenAlex",
                "arXiv"
              ]
            },
            "default": [
              "europepmc",
              "openalex",
              "arxiv"
            ]
          },
          "maxPapers": {
            "title": "Maximum papers",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Stop after this many papers, identifiers and search hits combined. A low number caps the cost of a first run.",
            "default": 5
          },
          "datasetId": {
            "title": "Read identifiers from a dataset",
            "type": "string",
            "description": "Optional. An Apify dataset whose items contain <code>doi</code>, <code>pmcid</code>, <code>pmid</code>, <code>arxivId</code>, <code>openAlexId</code>, <code>url</code> or <code>id</code>. The dataset is opened read-only."
          },
          "watchNewPapers": {
            "title": "New papers this week",
            "type": "boolean",
            "description": "Keyword watch. With a search query, Europe PMC and arXiv return papers first published in the last 7 days (Europe PMC FIRST_PDATE, arXiv submittedDate). Schedule the Actor once a week. Clear the Papers list, or those ids are read on every run. Papers this query already returned are skipped and not charged. arXiv HTML is opened so the licence box can be checked; the body is kept only when that licence allows redistribution. OpenAlex is not searched. You still pay the Research paper event only when full text is returned.",
            "default": false
          },
          "mode": {
            "title": "What to return",
            "enum": [
              "both",
              "chunks",
              "document"
            ],
            "type": "string",
            "description": "<b>Paper and chunks</b> writes one paper row plus its chunk rows. <b>Chunks only</b> writes chunk rows for papers that were read (failed papers still get a paper row so you can see why). <b>Paper only</b> skips chunking.",
            "default": "both"
          },
          "chunkSize": {
            "title": "Chunk size (tokens)",
            "minimum": 64,
            "maximum": 4096,
            "type": "integer",
            "description": "Token budget per chunk, counted with cl100k_base, the tokenizer OpenAI embedding and chat models use. 512 suits retrieval. Use 256 for narrow facts and 1024 for long arguments.",
            "default": 512
          },
          "chunkOverlap": {
            "title": "Chunk overlap (tokens)",
            "minimum": 0,
            "maximum": 2048,
            "type": "integer",
            "description": "How many tokens from the end of one chunk are repeated at the start of the next. At most half the chunk size.",
            "default": 64
          },
          "includeMarkdown": {
            "title": "Include Markdown",
            "type": "boolean",
            "description": "Add the full <code>markdown</code> field on the paper row. Turn it off when you only want the chunks.",
            "default": true
          },
          "includeReferences": {
            "title": "Include the reference list",
            "type": "boolean",
            "description": "Off by default. Reference lists are long and rarely useful in a retrieval index. Turn this on when you want the bibliography in the chunks.",
            "default": false
          },
          "maxChunksPerPaper": {
            "title": "Maximum chunks per paper",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Safety cap on chunk rows for one paper. The paper row is marked truncated when the cap is hit. Chunks are not charged.",
            "default": 400
          },
          "licenseFilter": {
            "title": "Which licences to read",
            "enum": [
              "any-open",
              "commercial"
            ],
            "type": "string",
            "description": "<b>Any open licence</b> returns CC BY, CC BY-SA, CC BY-NC, CC BY-ND, the NC-ND combinations, CC0 and public domain, and marks which ones allow commercial use or adaptation. <b>Commercial use</b> skips NC licences. The arXiv non-exclusive licence is never returned as full text.",
            "default": "any-open"
          },
          "openAlexApiKey": {
            "title": "OpenAlex API key (optional)",
            "type": "string",
            "description": "Your own free OpenAlex key. Needed only for OpenAlex keyword search and for OpenAlex's cached PDF when Europe PMC and arXiv have no text. Those calls spend your OpenAlex daily allowance (about $0.001 per search and $0.01 per PDF). The key is not written to the dataset or the log. Single-record lookups work without a key."
          },
          "contactEmail": {
            "title": "Email for Unpaywall",
            "type": "string",
            "description": "Your own email, sent only to the Unpaywall API when a DOI has no redistributable full text in Europe PMC or arXiv. Unpaywall requires it and rejects placeholder domains such as example.com. The address is not written to the dataset, the run summary or the log. Leave this empty to skip Unpaywall. Only a PDF whose location licence allows redistribution is downloaded."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}