{
  "openapi": "3.0.1",
  "info": {
    "title": "CMS Medicare Part B Drug Spending Scraper API",
    "description": "Search CMS Medicare Part B drug spending by brand, generic name, HCPCS, manufacturer when reported, year, spending, beneficiaries, claims, dosage units, averages, and growth. Get normalized annual series plus retained raw CMS fields.",
    "version": "0.1",
    "x-build-id": "CunhsUZ83Q2EYrVLj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pink_comic~cms-part-b-drug-spending/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pink_comic-cms-part-b-drug-spending",
        "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/pink_comic~cms-part-b-drug-spending/runs": {
      "post": {
        "operationId": "runs-sync-pink_comic-cms-part-b-drug-spending",
        "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/pink_comic~cms-part-b-drug-spending/run-sync": {
      "post": {
        "operationId": "run-sync-pink_comic-cms-part-b-drug-spending",
        "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": {
          "brandName": {
            "title": "Exact Brand Name",
            "type": "string",
            "description": "Exact CMS brand name, such as Keytruda."
          },
          "genericName": {
            "title": "Exact Generic Name",
            "type": "string",
            "description": "Exact CMS generic name, such as Pembrolizumab."
          },
          "hcpcsCode": {
            "title": "Exact HCPCS Code",
            "pattern": "^$|^[A-Za-z0-9]{5}$",
            "type": "string",
            "description": "Exact five-character HCPCS code, such as J9271."
          },
          "manufacturer": {
            "title": "Manufacturer Contains",
            "type": "string",
            "description": "Local case-insensitive manufacturer filter when a CMS row exposes a manufacturer field. The current Keytruda row does not include one."
          },
          "year": {
            "title": "Metric Year",
            "minimum": 0,
            "type": "integer",
            "description": "Return and apply thresholds to one annual metric year. Leave 0 for the latest available year.",
            "default": 0
          },
          "minTotalSpending": {
            "title": "Minimum Total Spending (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Optional minimum total spending (usd) filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minBeneficiaries": {
            "title": "Minimum Beneficiaries",
            "minimum": 0,
            "type": "integer",
            "description": "Optional minimum beneficiaries filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minClaims": {
            "title": "Minimum Claims",
            "minimum": 0,
            "type": "integer",
            "description": "Optional minimum claims filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minDosageUnits": {
            "title": "Minimum Dosage Units",
            "minimum": 0,
            "type": "number",
            "description": "Optional minimum dosage units filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minAverageSpendingPerUnit": {
            "title": "Minimum Average Spending per Dosage Unit",
            "minimum": 0,
            "type": "number",
            "description": "Optional minimum average spending per dosage unit filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minAverageSpendingPerBeneficiary": {
            "title": "Minimum Average Spending per Beneficiary",
            "minimum": 0,
            "type": "number",
            "description": "Optional minimum average spending per beneficiary filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 0
          },
          "minSpendingGrowth": {
            "title": "Minimum Annual Spending Growth Rate",
            "type": "number",
            "description": "Decimal year-over-year rate; 0.10 means 10%. Applied to the selected/latest year.",
            "default": 0
          },
          "sortBy": {
            "title": "Sort By",
            "enum": [
              "brandName",
              "genericName",
              "hcpcsCode",
              "totalSpending",
              "beneficiaries",
              "claims",
              "dosageUnits",
              "spendingGrowth"
            ],
            "type": "string",
            "description": "Optional sort by filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": "totalSpending"
          },
          "sortDirection": {
            "title": "Sort Direction",
            "enum": [
              "asc",
              "desc"
            ],
            "type": "string",
            "description": "Optional sort direction filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": "desc"
          },
          "maxCandidates": {
            "title": "Maximum Source Candidates",
            "minimum": 1,
            "maximum": 2500,
            "type": "integer",
            "description": "Total source rows checked across all pages before local thresholds and sorting.",
            "default": 500
          },
          "maxPages": {
            "title": "Maximum CMS Pages",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Optional maximum cms pages filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 3
          },
          "maxAnnualSeriesLength": {
            "title": "Maximum Annual Observations per Drug",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Optional maximum annual observations per drug filter or result-control setting. See the README for exact source semantics, bounds, and examples.",
            "default": 10
          },
          "maxResults": {
            "title": "Maximum Drug Records",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Total paid output records after filters. The default is one record for a maximum first-run charge of $0.0021 including start.",
            "default": 1
          },
          "maxTotalChargeUsd": {
            "title": "Maximum Dataset Item Charge (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Optional ceiling used to reduce maxResults before querying at $0.002 per output item.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}