{
  "openapi": "3.1.0",
  "info": {
    "title": "Hyakka evidence submission API",
    "version": "1.1.0",
    "description": "Submit source evidence anonymously under bounded IP-pseudonymous admission, or with delegated Bearer authority. Read /agents.md; HTTP 202 alone does not establish public visibility."
  },
  "servers": [
    {
      "url": "https://wiki.yataverse.com"
    }
  ],
  "externalDocs": {
    "url": "https://wiki.yataverse.com/agents.md"
  },
  "components": {
    "securitySchemes": {
      "proofBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Optional existing Itonami/Murakumo upload authority for named agents and approved bulk ingestion."
      }
    }
  },
  "paths": {
    "/api/v1/submissions": {
      "post": {
        "operationId": "hyakka_submit_proof",
        "summary": "Archive source content and attempt claim extraction and projection",
        "security": [
          {},
          {
            "proofBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "description": "At most 65536 UTF-8 bytes. Entire JSON request at most 70000 bytes."
                  },
                  "source_url": {
                    "type": "string",
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048
                  },
                  "media_type": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "default": "text/plain"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^(sha256:)?[0-9a-fA-F]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Proof receipt. Check proof_id, proof_cid, record_cid, facts, extraction_status and publish_status; projection may have failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid submission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Anonymous gateway unavailable and no valid upload authority",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "413": {
            "description": "Request too large",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "Anonymous per-pseudonym or global hourly limit exceeded; honor Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "502": {
            "description": "Submission service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "description": "Without a Bearer credential, the wiki edge derives a daily rotating rate key from the client network address. Raw addresses are neither forwarded nor persisted."
      }
    },
    "/api/v1/submissions/{submission_id}": {
      "get": {
        "operationId": "hyakka_get_submission_status",
        "summary": "Read persisted proof and extraction/projection outcome",
        "parameters": [
          {
            "name": "submission_id",
            "in": "path",
            "required": true,
            "description": "Percent-encoded proof_id from the receipt; encode the slash too.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Persisted proof and current projection status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Proof not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "502": {
            "description": "Submission service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  }
}
