{
  "openapi": "3.0.1",
  "info": {
    "title": "Sweden Road Incidents & Train Delays – Trafikverket",
    "description": "Get live road incidents, roadworks, ferry changes, rail disruptions and delayed or cancelled trains in Sweden from Trafikverket's open data API (CC0). Filter by county, municipality or station. JSON, CSV or Excel for logistics, fleets, news and apps. Bring your own free key. $1 per 1,000 rows.",
    "version": "0.0",
    "x-build-id": "9N32sYwf7SDQDaaHx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/madeform~trafikverket-disruptions/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-madeform-trafikverket-disruptions",
        "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/madeform~trafikverket-disruptions/runs": {
      "post": {
        "operationId": "runs-sync-madeform-trafikverket-disruptions",
        "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/madeform~trafikverket-disruptions/run-sync": {
      "post": {
        "operationId": "run-sync-madeform-trafikverket-disruptions",
        "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": [
          "trafikverketApiKey"
        ],
        "properties": {
          "trafikverketApiKey": {
            "title": "Trafikverket API key",
            "type": "string",
            "description": "Required. Your own free Trafikverket API key, stored encrypted as a secret and never logged. Get one in a few minutes at <a href=\"https://data.trafikverket.se/get-started\" target=\"_blank\">data.trafikverket.se/get-started</a>."
          },
          "type": {
            "title": "Type",
            "enum": [
              "both",
              "rail",
              "road"
            ],
            "type": "string",
            "description": "Which disruptions to collect: road (incidents, roadworks, ferries), rail (operative events) or both. With both, road rows are saved first.",
            "default": "both"
          },
          "countyNo": {
            "title": "Counties",
            "type": "array",
            "description": "Optional. Only disruptions in these counties (official county numbers), for example 14 for Västra Götaland. Empty means all of Sweden. Not applied to train announcements.",
            "items": {
              "type": "string",
              "enum": [
                "1",
                "3",
                "4",
                "5",
                "6",
                "7",
                "8",
                "9",
                "10",
                "12",
                "13",
                "14",
                "17",
                "18",
                "19",
                "20",
                "21",
                "22",
                "23",
                "24",
                "25"
              ],
              "enumTitles": [
                "1 – Stockholm",
                "3 – Uppsala",
                "4 – Södermanland",
                "5 – Östergötland",
                "6 – Jönköping",
                "7 – Kronoberg",
                "8 – Kalmar",
                "9 – Gotland",
                "10 – Blekinge",
                "12 – Skåne",
                "13 – Halland",
                "14 – Västra Götaland",
                "17 – Värmland",
                "18 – Örebro",
                "19 – Västmanland",
                "20 – Dalarna",
                "21 – Gävleborg",
                "22 – Västernorrland",
                "23 – Jämtland",
                "24 – Västerbotten",
                "25 – Norrbotten"
              ]
            }
          },
          "municipality": {
            "title": "Municipality",
            "type": "string",
            "description": "Optional. Trafikverket has no municipality field, so this is a case-insensitive text match against the location, title and description of each disruption, for example: Sundsvall."
          },
          "stationSignature": {
            "title": "Station signature",
            "type": "string",
            "description": "Optional. Trafikverket station signature, for example: Cst (Stockholm Central). Limits rail events to those whose affected section includes the station. Required for train announcements."
          },
          "includeTrainAnnouncements": {
            "title": "Include train announcements",
            "type": "boolean",
            "description": "Also fetch cancelled or delayed departures and arrivals at the station. Requires a station signature.",
            "default": false
          },
          "hoursBack": {
            "title": "Hours back",
            "minimum": 0,
            "maximum": 168,
            "type": "integer",
            "description": "Include disruptions that ended, and trains advertised, up to this many hours ago (0–168). Default 0 means only current ones.",
            "default": 0
          },
          "hoursAhead": {
            "title": "Hours ahead",
            "minimum": 0,
            "maximum": 168,
            "type": "integer",
            "description": "Include disruptions that start, and trains advertised, up to this many hours ahead (0–168). Default 24.",
            "default": 24
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of disruptions to save (1–10,000). Each saved row is one billed event. Users on Apify's free plan get at most 200 per run.",
            "default": 200
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}