{
  "openapi": "3.0.1",
  "info": {
    "title": "SNCF TGV Timetable & TGV Max Seat Finder",
    "description": "Every TGV INOUI, Intercités and night train for the next 30 days with TGV Max (MAX JEUNE / MAX SENIOR) seat availability, free-seat alerts, 'where can I go' explorer, typical fares and route punctuality, from SNCF open data.",
    "version": "0.1",
    "x-build-id": "4dNbibs5Qu4JLg6zz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yck69~french-trains/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yck69-french-trains",
        "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/yck69~french-trains/runs": {
      "post": {
        "operationId": "runs-sync-yck69-french-trains",
        "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/yck69~french-trains/run-sync": {
      "post": {
        "operationId": "run-sync-yck69-french-trains",
        "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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "What do you want?",
            "enum": [
              "trains",
              "explorer",
              "punctuality",
              "fares"
            ],
            "type": "string",
            "description": "<b>Trains</b>: every TGV INOUI, Intercités and night train between cities over the next 30 days, with TGV Max seat availability, typical fares and the route's punctuality. Turn on alerts to get only seats that just opened.<br><b>TGV Max explorer</b>: every destination you can reach with a TGV Max seat from a city, by date.<br><b>Punctuality</b>: monthly on-time rate, delays and causes of a TGV route.<br><b>Fares</b>: price ranges by carrier, class and fare type.",
            "default": "trains"
          },
          "origins": {
            "title": "From",
            "type": "array",
            "description": "Cities or stations, e.g. <code>Paris</code>, <code>Lyon</code>, <code>Aix en Provence</code>. Several are allowed.",
            "items": {
              "type": "string"
            }
          },
          "destinations": {
            "title": "To",
            "type": "array",
            "description": "Cities or stations. Leave empty for every destination.",
            "items": {
              "type": "string"
            }
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Default: today. The timetable covers the next 30 days. A date or a duration like <code>7 days</code> (from today)."
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "Default: the end of the 30-day window."
          },
          "weekdays": {
            "title": "Days of the week",
            "type": "array",
            "description": "e.g. only Fridays and Sundays for weekend trips.",
            "items": {
              "type": "string",
              "enum": [
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
                "Sunday"
              ]
            }
          },
          "departAfter": {
            "title": "Depart after",
            "type": "string",
            "description": "e.g. <code>07:00</code>."
          },
          "departBefore": {
            "title": "Depart before",
            "type": "string",
            "description": "e.g. <code>10:30</code>."
          },
          "onlyMaxAvailable": {
            "title": "Only trains with TGV Max seats",
            "type": "boolean",
            "description": "Keep trains with MAX JEUNE / MAX SENIOR seats available.",
            "default": false
          },
          "onlyNew": {
            "title": "Alerts: only seats that opened since the last run",
            "type": "boolean",
            "description": "SNCF publishes TGV Max availability once a day (around 06:30 Paris time). Schedule the Actor every morning with an email, Slack or Telegram integration to be told about seats that opened since the previous day.",
            "default": false
          },
          "alertName": {
            "title": "Alert name",
            "type": "string",
            "description": "Separate memory per alert, e.g. <code>paris-marseille-fridays</code>. Defaults to one per set of filters."
          },
          "includeFares": {
            "title": "Add typical fares",
            "type": "boolean",
            "description": "Price ranges of the route by carrier and class (for trains with a 'To').",
            "default": true
          },
          "includePunctuality": {
            "title": "Add route punctuality",
            "type": "boolean",
            "description": "The route's on-time rate and delays over the latest month.",
            "default": true
          },
          "includeBuses": {
            "title": "Include SNCF coaches",
            "type": "boolean",
            "description": "The timetable also lists some SNCF coach services.",
            "default": false
          },
          "months": {
            "title": "Months of punctuality history",
            "minimum": 1,
            "maximum": 120,
            "type": "integer",
            "description": "For Punctuality mode.",
            "default": 12
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Trains, destinations or report rows.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}