{
  "openapi": "3.1.0",
  "info": {
    "title": "Podfactum API",
    "description": "Submit articles and PDFs to your Podfactum feed programmatically. Authenticate with 'Authorization: Bearer pfk_...' (create keys at podfactum.com/user/settings/api). Errors are RFC 9457 problem+json with a stable `code` field. Docs: /api/agents.md and /api/guide.",
    "version": "1.0.0"
  },
  "paths": {
    "/api/v1/submissions": {
      "post": {
        "tags": [
          "Podfactum API"
        ],
        "summary": "Submit a URL or PDF for episode generation",
        "description": "Submit content for asynchronous episode generation.\n\nSend JSON `{\"url\": ...}` or multipart form data with a `file` PDF. Returns\n202 with a `status_url` to poll; generation typically takes a few minutes.",
        "operationId": "create_submission_api_v1_submissions_post",
        "parameters": [],
        "responses": {
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Malformed request (invalid_request)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "API key missing, unknown, or revoked (invalid_api_key)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "200": {
            "description": "Content already generated \u2014 completed episode returned, nothing charged"
          },
          "402": {
            "description": "Out of episode credits (out_of_credits)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Already submitted; body carries submission_id (duplicate_submission)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "PDF exceeds the size limit (pdf_too_large)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported content or file type (unsupported_media_type)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "url"
                ]
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "A PDF"
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyBearer": []
          }
        ]
      }
    },
    "/api/v1/submissions/{submission_id}": {
      "get": {
        "tags": [
          "Podfactum API"
        ],
        "summary": "Poll a submission's status",
        "description": "Status of a submission created by this account. When `status` is\n`completed`, `episode` carries the title, share URL, and audio URL.",
        "operationId": "submission_status_api_v1_submissions__submission_id__get",
        "parameters": [
          {
            "name": "submission_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Submission Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "401": {
            "description": "API key missing, unknown, or revoked (invalid_api_key)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such submission on this account (not_found)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyBearer": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details; branch on `code`.",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from podfactum.com/user/settings/api (pfk_...)"
      }
    }
  },
  "servers": [
    {
      "url": "https://podfactum.com"
    }
  ]
}