{
  "openapi": "3.0.1",
  "info": {
    "title": "Spain Medicine Shortages Monitor (AEMPS CIMA)",
    "description": "Daily alerts from the official AEMPS medicines database (CIMA): new, changed and resolved supply problems (shortages), new and withdrawn medicines and safety notes. Active ingredient, ATC, lab and alternatives included. Filter by keyword, ATC or lab. Only new alerts.",
    "version": "1.0",
    "x-build-id": "hnBU5tr5mzbC1H2Ps"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/hispadata~spain-medicines-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-hispadata-spain-medicines-monitor",
        "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/hispadata~spain-medicines-monitor/runs": {
      "post": {
        "operationId": "runs-sync-hispadata-spain-medicines-monitor",
        "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/hispadata~spain-medicines-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-hispadata-spain-medicines-monitor",
        "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": {
          "alertTypes": {
            "title": "What to watch",
            "type": "array",
            "description": "Kinds of alerts you want. Default: everything except marketing status changes.",
            "items": {
              "type": "string",
              "enum": [
                "shortage_started",
                "shortage_updated",
                "shortage_resolved",
                "medicine_authorized",
                "medicine_withdrawn",
                "marketing_changed",
                "safety_note"
              ],
              "enumTitles": [
                "New supply problems (shortages)",
                "Supply problem: new expected end date",
                "Supply problem resolved",
                "New medicines in CIMA",
                "Medicines withdrawn from CIMA",
                "Marketing status changed (marketed / not marketed)",
                "AEMPS safety notes"
              ]
            },
            "default": [
              "shortage_started",
              "shortage_updated",
              "shortage_resolved",
              "medicine_authorized",
              "medicine_withdrawn",
              "safety_note"
            ]
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Return only alerts that mention any of these words in the medicine name, active ingredient, ATC name, laboratory or AEMPS note. Accents and case do not matter. Example: amoxicilina, insulina, ozempic. Leave empty for all.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Exclude keywords",
            "type": "array",
            "description": "Skip alerts that mention any of these words.",
            "items": {
              "type": "string"
            }
          },
          "atcCodes": {
            "title": "ATC codes (prefix)",
            "type": "array",
            "description": "Keep only medicines whose ATC code starts with one of these. Example: J01 (antibiotics), A10 (diabetes), N06A (antidepressants).",
            "items": {
              "type": "string"
            }
          },
          "laboratories": {
            "title": "Laboratories",
            "type": "array",
            "description": "Keep only medicines of these marketing authorisation holders or marketers (part of the name is enough). Example: Cinfa, Normon, Pfizer.",
            "items": {
              "type": "string"
            }
          },
          "problemTypes": {
            "title": "Supply problem types",
            "type": "array",
            "description": "Keep only these AEMPS supply problem types. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "3",
                "4",
                "7",
                "1",
                "2",
                "9",
                "12",
                "10",
                "5",
                "6",
                "11"
              ],
              "enumTitles": [
                "No equivalent available (prescriber must choose another treatment)",
                "Temporary shortage",
                "Available as foreign medicine",
                "See AEMPS information note",
                "Supply to hospitals only",
                "Controlled distribution, limited units",
                "Controlled distribution to hospitals",
                "Exceptional units (other language packaging)",
                "Same active ingredient available",
                "Same active ingredients available",
                "Non-prescription alternatives available"
              ]
            }
          },
          "onlyWithoutAlternative": {
            "title": "Only shortages without an alternative",
            "type": "boolean",
            "description": "Keep only supply problems where AEMPS says there is no equivalent medicine (types 3, 4 and 7).",
            "default": false
          },
          "prescriptionOnly": {
            "title": "Only prescription medicines",
            "type": "boolean",
            "description": "Skip medicines that do not need a prescription.",
            "default": false
          },
          "includeParallelImports": {
            "title": "Include parallel imports",
            "type": "boolean",
            "description": "Parallel import registrations (number with IP) are included by default.",
            "default": true
          },
          "onlyNew": {
            "title": "Only new alerts",
            "type": "boolean",
            "description": "Remember what was already delivered for the same filters and return only new alerts. The first run returns what started in the last days (see below). Turn off to get every supply problem that started in that period again.",
            "default": true
          },
          "lookbackDays": {
            "title": "Days to look back (first run)",
            "minimum": 1,
            "maximum": 31,
            "type": "integer",
            "description": "How many days back the first run looks (1 to 31). Later runs continue from the previous one.",
            "default": 7
          },
          "fetchDetails": {
            "title": "Read medicine details",
            "type": "boolean",
            "description": "Add active ingredients, ATC, laboratory, prescription status and links to the leaflet and technical sheet (one extra request per alert).",
            "default": true
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum alerts returned (and charged) per run.",
            "default": 500
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}