{
  "openapi": "3.0.1",
  "info": {
    "title": "Aozora Bunko New Public-Domain Text Delta Feed",
    "description": "Watches Aozora Bunko's own official catalog export for newly digitized or revised confirmed-public-domain Japanese texts and emits NEW_TEXT/REVISED_TEXT/STATUS_CHANGE events with full decoded text where available. Pay-per-event: billed only for what's new or changed.",
    "version": "1.0",
    "x-build-id": "y7QHuxXbBdVJl9htL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/stefano_seggio~aozora-bunko-public-domain-text-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-stefano_seggio-aozora-bunko-public-domain-text-feed",
        "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/stefano_seggio~aozora-bunko-public-domain-text-feed/runs": {
      "post": {
        "operationId": "runs-sync-stefano_seggio-aozora-bunko-public-domain-text-feed",
        "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/stefano_seggio~aozora-bunko-public-domain-text-feed/run-sync": {
      "post": {
        "operationId": "run-sync-stefano_seggio-aozora-bunko-public-domain-text-feed",
        "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": {
          "onlyNew": {
            "title": "Only deliver new/changed events (paid)",
            "type": "boolean",
            "description": "When true (default), only NEW_TEXT, REVISED_TEXT and STATUS_CHANGE rows are pushed, each as a charged PPE event. Set to false for a free baseline run: every catalog row that passes the public-domain filter is pushed once as an uncharged SNAPSHOT_NO_DIFF record.",
            "default": true
          },
          "resetState": {
            "title": "Reset stored state before this run",
            "type": "boolean",
            "description": "When true, clears this feed's stored seen-work state before this run, so the next run re-baselines from scratch (every catalog row becomes a fresh, uncharged SNAPSHOT_NO_DIFF again, subject to onlyNew). Use for testing or recovering a corrupted state store, not routine operation.",
            "default": false
          },
          "onlyConfirmedPublicDomain": {
            "title": "Only confirmed public-domain works (recommended)",
            "type": "boolean",
            "description": "When true (default), keeps only catalog rows where Aozora's own work-copyright flag reads なし (no copyright - confirmed public domain). When false, also includes rows flagged あり (the author/estate granted free-use permission, but the work is NOT public domain).",
            "default": true
          },
          "includeFullText": {
            "title": "Fetch and embed full text",
            "type": "boolean",
            "description": "When true (default), NEW_TEXT/REVISED_TEXT events download the linked text ZIP, decode it from Shift_JIS, strip Aozora's ruby/annotation markup and legend preamble, and embed both plain_text and raw_text_with_markup - delivered as the higher-priced 'result' event. When false, or when a text file fails to download/decode, the same events are delivered as metadata-only 'result-summary' records instead.",
            "default": false
          },
          "authorIdAllowlist": {
            "title": "Author ID allowlist (optional)",
            "type": "array",
            "description": "Aozora 人物ID values (e.g. \"001257\") to restrict this feed to. Leave empty to monitor the entire catalog.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxItemsPerRun": {
            "title": "Max charged events per run (0 = unlimited)",
            "minimum": 0,
            "type": "integer",
            "description": "Caps the number of charged (result/result-summary) events this run will push, independent of your Apify spending limit. 0 means no Actor-side cap.",
            "default": 20
          },
          "requestDelayMs": {
            "title": "Delay between per-work text fetches (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Aozora Bunko is a small, volunteer-run, non-commercial mirror with no published rate limit - this default trades a slower walk for not needing to trust an unconfirmed number, and for being a polite citizen of a small server, not only a cost control.",
            "default": 500
          },
          "maxRetries": {
            "title": "Max retry attempts per HTTP request",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Retry attempts (exponential backoff with jitter) for a 429/5xx response or a network-level failure before a single catalog or text-ZIP fetch is given up on as failed.",
            "default": 5
          },
          "requestTimeoutSecs": {
            "title": "Per-request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Aborts a single request to Aozora Bunko (catalog export or per-work text ZIP) that takes longer than this, so one slow response never stalls the whole run.",
            "default": 30
          },
          "deltaStateName": {
            "title": "Delta state name",
            "type": "string",
            "description": "Names the Key-Value Store this feed's seen-work state is kept in. Run multiple independent schedules - e.g. filtered to different author allowlists - without them draining each other's baseline by giving each a distinct name here.",
            "default": "default"
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}