{
  "openapi": "3.1.0",
  "info": {
    "title": "Wondercraft Public API",
    "version": "0.0.1"
  },
  "paths": {
    "/podcast/scripted": {
      "post": {
        "tags": [
          "Podcasts"
        ],
        "summary": "Create any audio content with a user provided script",
        "description": "Starts a background job to produce an audio file with the provided script segments. The response\n    contains a `job_id` that can be used to query with the `/podcast/{job_id}` to query for status.\n    Requires a valid `X-API-TOKEN` header.\n\n    Throws:\n    - 429 if the user has too many jobs in flight.\n    - 400 if any voice_id or music_id provided is invalid",
        "operationId": "generate_user_scripted_episode_podcast_scripted_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateUserScriptedEpisodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateEpisodeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/podcast": {
      "post": {
        "tags": [
          "Podcasts"
        ],
        "summary": "Create any audio content with an AI-generated script",
        "description": "Starts a background job that creates an AI generated script and produces an audio file.\n    The response contains a `job_id` that can be used with the `/podcast/{job_id}` endpoint\n    to query for status.\n    Requires a valid `X-API-TOKEN` header.\n\n    Throws:\n    - 429 if the user has too many jobs in flight.\n    - 422 if provided voice_ids are not unique\n    - 400 if any voice_ids or music_ids provided are invalid",
        "operationId": "generate_ai_scripted_episode_podcast_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateAiScriptedEpisodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateEpisodeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/podcast/{job_id}": {
      "get": {
        "tags": [
          "Podcasts"
        ],
        "summary": "Get audio content result and status",
        "description": "Gets the status of podcast generation job, including a link to download it if the job was\n    successful. Requires a valid `X-API-TOKEN` header.\n\n\n    The link returned expires after 24 hours.\n    Feel free to call this endpoint again to get a fresh link, no need to regenerate the podcast\n    and waste credits.\n\n    Throws\n    - 404 if job_id is invalid",
        "operationId": "get_episode_status_podcast__job_id__get",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Job Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetEpisodeStatusResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/podcast/convo-mode/ai-scripted": {
      "post": {
        "tags": [
          "Podcasts"
        ],
        "summary": "Generate AI-scripted podcast with 2 hosts using Convo Mode",
        "description": "Starts a background job that creates an AI generated script and produces an audio file in convo mode.\n    The response contains a `job_id` that can be used with the `/podcast/{job_id}` endpoint\n    to query for status.\n    Requires a valid `X-API-TOKEN` header.\n\n\n    **Note that generating via Convo Mode yields more natural results but takes longer.\n    Expect at least 1 minute of processing per minute duration of audio before investigating a potential failure.**\n\n    Throws:\n    - 429 if the user has too many jobs in flight.\n    - 400 if any voice_ids provided are invalid or if the length of voice_ids is not 2.",
        "operationId": "generate_ai_scripted_convo_mode_episode_podcast_convo_mode_ai_scripted_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateAiScriptedConvoModeEpisodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateEpisodeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/podcast/convo-mode/user-scripted": {
      "post": {
        "tags": [
          "Podcasts"
        ],
        "summary": "Generate podcast with 2 hosts using Convo Mode, with a user provided script",
        "description": "Starts a background job to produce an audio file with the provided script segments in convo mode. The response\n    contains a `job_id` that can be used to query with the `/podcast/{job_id}` to query for status.\n    Requires a valid `X-API-TOKEN` header.\n\n\n    **Note that generating via Convo Mode yields more natural results but takes longer.\n    Expect at least 1 minute of processing per minute duration of audio before investigating a potential failure.**\n\n\n    Throws:\n    - 429 if the user has too many jobs in flight.\n    - 400 if any voice_ids provided are invalid or if the length of voice_ids is not 2.",
        "operationId": "generate_user_scripted_convo_mode_episode_podcast_convo_mode_user_scripted_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateUserScriptedConvoModeEpisodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerateEpisodeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/verify": {
      "get": {
        "tags": [
          "Other"
        ],
        "summary": "Verify API key",
        "description": "An endpoint to verify that your API key is functional",
        "operationId": "verify_key_verify_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/podcasts": {
      "get": {
        "summary": "Get Podcasts For User",
        "operationId": "get_podcasts_for_user_podcasts_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {

                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "GenerateAiScriptedConvoModeEpisodeRequest": {
        "properties": {
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "The prompt to instruct the AI to generate the script. You can specify the duration, and include links. Sometimes, the AI hallucinates, so it helps to mention that this podcast has two hosts."
          },
          "voice_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Voice Ids",
            "description": "A list of voice_ids to use for the generated audio. **Must provide exactly 2 voices for this endpoint.** If the script has multiple speakers, we will use the voices from this list in the order they appear in. All ids in this list must be unique. If no IDs are provided, 2 defaults will be used."
          },
          "delivery_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delivery Instructions",
            "description": "An optional delivery instructions for the generated audio. This will be used to guide the generation of the audio."
          },
          "music_spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MusicTrackSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "An optional spec for adding background music to the generated script. Note that if the chosenmusic track is longer than the duration of the generated script, it will be cut off."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "prompt"
        ],
        "title": "GenerateAiScriptedConvoModeEpisodeRequest",
        "description": "A request to start a job that generates an audio file for a podcast in convo mode\nwith a script generated by AI using the provided prompt.\nAn optional list of Voice IDs can be provided to control the audio generation output. If no voice_ids are provided,\ndefaults of up to 2 convo-mode voices will be chosen."
      },
      "GenerateAiScriptedEpisodeRequest": {
        "properties": {
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "The prompt for the episode, can include links"
          },
          "voice_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Voice Ids",
            "description": "A list of voice_ids to use for the generated audio. If the script has multiple speakers, we will use the voices from this list in the order then appear in. All ids in this list must be unique. If no IDs are provided, up to 2 defaults will be used."
          },
          "music_spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MusicTrackSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "An optional spec for adding background music to the generated script. Note that if the chosenmusic track is longer than the duration of the generated script, it will be cut off."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "prompt"
        ],
        "title": "GenerateAiScriptedEpisodeRequest",
        "description": "A request to start a job that generates an audio file for audio content with a script generated by AI using the\nprovided prompt.\nAn optional list of Voice IDs can be provided to control the audio generation output. If no voice_ids are provided,\ndefaults of up to 2 speakers will be chosen."
      },
      "GenerateEpisodeResponse": {
        "properties": {
          "job_id": {
            "type": "string",
            "format": "uuid",
            "title": "Job Id",
            "description": "The job ID for the episode generation. The status of this job can be queried using the`/podcast/{job_id}` endpoint."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "job_id"
        ],
        "title": "GenerateEpisodeResponse"
      },
      "GenerateUserScriptedConvoModeEpisodeRequest": {
        "properties": {
          "script": {
            "items": {
              "$ref": "#/components/schemas/ScriptSegment"
            },
            "type": "array",
            "title": "Script",
            "description": "The segments forming the script for the episode"
          },
          "delivery_instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delivery Instructions",
            "description": "An optional delivery instructions for the generated audio. This will be used to guide the generation of the audio."
          },
          "music_spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MusicTrackSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "An optional spec for adding background music to the generated script. Note that if the chosenmusic track is longer than the duration of the generated script, it will be cut off."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "script"
        ],
        "title": "GenerateUserScriptedConvoModeEpisodeRequest",
        "description": "A request to start a job that generates an audio file for a podcast in convo mode\nwith a script generated by the user."
      },
      "GenerateUserScriptedEpisodeRequest": {
        "properties": {
          "script": {
            "items": {
              "$ref": "#/components/schemas/ScriptSegment"
            },
            "type": "array",
            "title": "Script",
            "description": "The segments forming the script for the episode"
          },
          "music_spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MusicTrackSpec"
              },
              {
                "type": "null"
              }
            ],
            "description": "An optional spec for adding background music to the generated script. Note that if the chosenmusic track is longer than the duration of the generated script, it will be cut off."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "script"
        ],
        "title": "GenerateUserScriptedEpisodeRequest",
        "description": "A request to start a job to generate audio content with a provided script."
      },
      "GetEpisodeStatusResponse": {
        "properties": {
          "finished": {
            "type": "boolean",
            "title": "Finished",
            "description": "Whether the episode generation is finished"
          },
          "script": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Script",
            "description": "The script used for generating the episode"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url",
            "description": "A URL for downloading the episode"
          },
          "error": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error",
            "description": "Whether an error occurred while generating the episode"
          },
          "error_details": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Details",
            "description": "The error message if the episode generation failed"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "finished"
        ],
        "title": "GetEpisodeStatusResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "MusicTrackSpec": {
        "properties": {
          "music_id": {
            "type": "string",
            "title": "Music Id",
            "description": "The ID of the music track to used in the background. This can be copied from theWondercraft platform"
          },
          "fade_in_ms": {
            "type": "integer",
            "title": "Fade In Ms",
            "description": "The number of milliseconds to fade in from the start of the music track",
            "default": 0
          },
          "fade_out_ms": {
            "type": "integer",
            "title": "Fade Out Ms",
            "description": "The number of milliseconds to fade out from the end of the music track",
            "default": 0
          },
          "playback_start": {
            "type": "integer",
            "title": "Playback Start",
            "description": "A millisecond into the music track at which we start playing. Equivalent to trimming thebeginning of the music track. Defaults to 0 (i.e. no trimming)",
            "default": 0
          },
          "playback_end": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playback End",
            "description": "How many milliseconds into the music should we playback. Equivalent to trimming up to this numberof milliseconds from the music track. Defaults to the entire music track."
          },
          "volume": {
            "type": "number",
            "title": "Volume",
            "description": "The volume to apply to the music track. Defaults to 0.05. Must be between 0.0 and 1.0",
            "default": 0.05
          },
          "loop": {
            "type": "boolean",
            "title": "Loop",
            "description": "Whether to loop the music track. Defaults to False.",
            "default": false
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "music_id"
        ],
        "title": "MusicTrackSpec",
        "description": "A music track to add to the generated audio. Note that the music will always be added at the very beginning of the\ngenerated podcast and will be automatically trimmed to match the content length."
      },
      "ScriptSegment": {
        "properties": {
          "text": {
            "type": "string",
            "title": "Text",
            "description": "The text to be spoken for this part of the dialogue"
          },
          "voice_id": {
            "type": "string",
            "title": "Voice Id",
            "description": "A unique identifier for the voice copied from the Wondercraft Platform to use for the speaker of this segment."
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "text",
          "voice_id"
        ],
        "title": "ScriptSegment",
        "description": "A single unit of speech in the script defined by the user."
      },
      "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"
      },
      "VerifyResponse": {
        "properties": {
          "status": {
            "type": "string",
            "const": "ok",
            "title": "Status",
            "description": "A value representing a successful request"
          },
          "email": {
            "type": "string",
            "title": "Email",
            "description": "The email address of the user this token is associated with"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "status",
          "email"
        ],
        "title": "VerifyResponse",
        "example": {
          "email": "example@example.com",
          "status": "ok"
        }
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.wondercraft.ai/v1",
      "description": "Base Wondercraft API"
    }
  ]
}