{
  "openapi": "3.1.0",
  "info": {
    "title": "TimePortal Future reading API",
    "version": "1.0.0",
    "description": "Full reading query with JSON or Markdown table output. Existing reading access controls apply. Structured requests do not call Jev."
  },
  "servers": [
    {
      "url": "https://timeportal.pro/future"
    }
  ],
  "security": [
    {},
    {
      "SiteCredential": []
    }
  ],
  "paths": {
    "/query.php": {
      "get": {
        "operationId": "futureReadingGet",
        "summary": "Read future tables or capabilities",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 3000,
              "description": "Natural-language request with explicit ISO dates, interpreted by Jev; omit when using structured fields."
            }
          },
          {
            "name": "aspects",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated values or all."
            }
          },
          {
            "name": "language",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "ko"
              ],
              "default": "en"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "markdown"
              ],
              "default": "json"
            }
          },
          {
            "name": "birthdate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "current_date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "southern",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "include_markets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "include_spx",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "primary_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "relationships",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated values or all."
            }
          },
          {
            "name": "exclude_relationships",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated values or all."
            }
          },
          {
            "name": "min_duration_days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 36500,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Calculated tables, or endpoint capabilities when GET has no arguments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "app": {
                      "type": "string"
                    },
                    "tables": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "query": {
                      "type": "object"
                    },
                    "meta": {
                      "type": "object"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "UTF-8 Markdown tables"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request."
          },
          "422": {
            "description": "Missing or invalid query arguments."
          },
          "429": {
            "description": "Existing site reading limit."
          },
          "502": {
            "description": "Upstream service failure."
          },
          "504": {
            "description": "Upstream timeout."
          }
        }
      },
      "post": {
        "operationId": "futureReadingPost",
        "summary": "Submit a full-feature future query",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "maxLength": 3000,
                    "description": "Natural-language request with explicit ISO dates, interpreted by Jev; omit when using structured fields."
                  },
                  "aspects": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "string"
                      }
                    ],
                    "default": "all"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "ko"
                    ],
                    "default": "en"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "markdown"
                    ],
                    "default": "json"
                  },
                  "access_code": {
                    "type": "string",
                    "writeOnly": true,
                    "description": "Optional existing site access credential. POST only; never include in a URL."
                  },
                  "birthdate": {
                    "type": "string",
                    "format": "date"
                  },
                  "current_date": {
                    "type": "string",
                    "format": "date"
                  },
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  },
                  "southern": {
                    "type": "boolean",
                    "default": false
                  },
                  "include_markets": {
                    "type": "boolean",
                    "default": false
                  },
                  "include_spx": {
                    "type": "boolean",
                    "default": false
                  },
                  "primary_only": {
                    "type": "boolean",
                    "default": false
                  },
                  "relationships": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "exclude_relationships": {
                    "oneOf": [
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "min_duration_days": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 36500,
                    "default": 0
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "birthdate"
                    ]
                  },
                  {
                    "required": [
                      "query"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculated tables, or endpoint capabilities when GET has no arguments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "app": {
                      "type": "string"
                    },
                    "tables": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "markdown": {
                      "type": "string"
                    },
                    "query": {
                      "type": "object"
                    },
                    "meta": {
                      "type": "object"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "UTF-8 Markdown tables"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request."
          },
          "422": {
            "description": "Missing or invalid query arguments."
          },
          "429": {
            "description": "Existing site reading limit."
          },
          "502": {
            "description": "Upstream service failure."
          },
          "504": {
            "description": "Upstream timeout."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SiteCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "Existing website reading credential, if the user has one. Not the TypeSafe API key."
      }
    }
  }
}