{
  "openapi": "3.1.0",
  "info": {
    "title": "拾流私人内容投递",
    "version": "0.3.0",
    "description": "将用户要求保存的文字投递到私人 Feed。"
  },
  "servers": [
    {
      "url": "https://feed.tjdata.site"
    }
  ],
  "security": [
    {
      "sourceToken": []
    }
  ],
  "paths": {
    "/api/v1/actions/deliveries": {
      "post": {
        "operationId": "saveToStill",
        "summary": "保存用户要求保存的文章或简报",
        "description": "将最终文字保存到来源凭证所属的私人阅读空间。仅在返回 delivered 后确认保存。请求不得超过 64 KiB。",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "idempotency_key",
                  "content"
                ],
                "properties": {
                  "idempotency_key": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.:-]{1,128}$",
                    "description": "每份新内容使用唯一键，失败重试复用原键。"
                  },
                  "content": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "schema_version",
                      "title",
                      "content_type",
                      "blocks"
                    ],
                    "properties": {
                      "schema_version": {
                        "type": "string",
                        "enum": [
                          "1.0"
                        ]
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "summary": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "content_type": {
                        "type": "string",
                        "enum": [
                          "brief",
                          "report"
                        ]
                      },
                      "blocks": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "type",
                            "text"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "markdown"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60000,
                              "description": "Markdown 正文，支持标题、列表、引用、表格和代码块。"
                            }
                          }
                        }
                      },
                      "tags": {
                        "type": "array",
                        "maxItems": 10,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 50
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "相同内容已保存，返回原回执",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entry_id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "delivery_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "delivered"
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "首次保存成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entry_id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "delivery_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "delivered"
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "来源凭证无效或已撤销"
          },
          "409": {
            "description": "同一键用于不同内容"
          },
          "410": {
            "description": "原内容已删除"
          },
          "413": {
            "description": "请求超过 64 KiB"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "sourceToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "在 GPT Action 的 API Key / Bearer 认证设置中填写来源凭证。"
      }
    }
  }
}
