{
  "openapi": "3.0.1",
  "info": {
    "title": "BaZi Chart API (八字排盤)",
    "description": "Compute Chinese Four Pillars (BaZi / 八字) charts from birth data: pillars, hidden stems, Na Yin, Ten Gods, five-element distribution, luck cycles (大運) and current-year pillar. Pay per chart.",
    "version": "1.0",
    "x-build-id": "eu0gdIPHOzezlZBpT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kelvin.kwong~bazi-chart-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kelvin.kwong-bazi-chart-api",
        "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/kelvin.kwong~bazi-chart-api/runs": {
      "post": {
        "operationId": "runs-sync-kelvin.kwong-bazi-chart-api",
        "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/kelvin.kwong~bazi-chart-api/run-sync": {
      "post": {
        "operationId": "run-sync-kelvin.kwong-bazi-chart-api",
        "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": {
          "birthDatetime": {
            "title": "Birth date & time",
            "type": "string",
            "description": "ISO 8601 date-time of birth, e.g. `1995-08-17T14:30:00`. Without a UTC offset it is interpreted as local wall-clock time in `timezone`; with an offset (or `Z`) it is converted into `timezone` first. Required unless `charts` (batch mode) is used."
          },
          "calendarType": {
            "title": "Calendar type",
            "enum": [
              "solar",
              "lunar"
            ],
            "type": "string",
            "description": "Whether `birthDatetime` is a Gregorian (solar) or Chinese lunar date.",
            "default": "solar"
          },
          "isLeapMonth": {
            "title": "Lunar leap month (閏月)",
            "type": "boolean",
            "description": "Only relevant when `calendarType` is `lunar`: set to true if the birth month is the leap (閏) month.",
            "default": false
          },
          "gender": {
            "title": "Gender",
            "enum": [
              "male",
              "female"
            ],
            "type": "string",
            "description": "Biological gender at birth — determines the direction of the luck cycles (大運順逆). Required unless `charts` (batch mode) is used."
          },
          "timezone": {
            "title": "Timezone",
            "type": "string",
            "description": "IANA timezone of the birth place, e.g. `Asia/Hong_Kong`, `America/New_York`. The birth time is resolved to local wall-clock time in this zone before any pillar calculation.",
            "default": "Asia/Hong_Kong"
          },
          "ziHourMode": {
            "title": "子時 (Zi hour) mode",
            "enum": [
              "late",
              "early"
            ],
            "type": "string",
            "description": "How a 23:00–23:59 birth is assigned to a day pillar. `late` (晚子時): the day pillar stays on the current calendar day. `early`: the day pillar advances to the next day at 23:00. Births at 00:00–00:59 always use the current calendar day.",
            "default": "late"
          },
          "language": {
            "title": "Label language",
            "enum": [
              "zh-Hant",
              "zh-Hans",
              "en"
            ],
            "type": "string",
            "description": "Language of human-readable labels in the output. Stems and branches always include hanzi (Traditional & Simplified) and pinyin regardless of this setting.",
            "default": "zh-Hant"
          },
          "includeLuckCycles": {
            "title": "Include luck cycles (大運)",
            "type": "boolean",
            "description": "Include the 10-year luck cycles (大運) in the output.",
            "default": true
          },
          "charts": {
            "title": "Batch mode: multiple charts",
            "type": "array",
            "description": "Optional array of birth records with the same shape as the top-level fields (`birthDatetime`, `gender`, `calendarType`, `isLeapMonth`, `timezone`, `ziHourMode`, `language`, `includeLuckCycles`). When present, the top-level single-chart fields are ignored and each record is processed independently — one invalid record does not fail the run. Each successfully computed chart is charged as one `chart-generated` event."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}