# Generate or regenerate podcast script POST /api/v1/podcasts/{podcast_id}/generate/ Content-Type: application/json Generates or regenerates the podcast script. Can be called multiple times to regenerate with different parameters. **Workflow:** 1. Call this endpoint to generate/regenerate script 2. Review the generated script 3. Call /publish/ to generate audio **Parameters:** - `voice_type`: Podcast preset (interview, panel, etc.). Defaults based on length. - `llm_prompt`: Optional custom instructions for script generation - `length`: Desired podcast length in minutes Reference: https://docs.aisquare.studio/api-reference/ai-square-studio-api/podcasts/generate-create ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: AISquare Studio API version: 1.0.0 paths: /api/v1/podcasts/{podcast_id}/generate/: post: operationId: generate-create summary: Generate or regenerate podcast script description: |2- Generates or regenerates the podcast script. Can be called multiple times to regenerate with different parameters. **Workflow:** 1. Call this endpoint to generate/regenerate script 2. Review the generated script 3. Call /publish/ to generate audio **Parameters:** - `voice_type`: Podcast preset (interview, panel, etc.). Defaults based on length. - `llm_prompt`: Optional custom instructions for script generation - `length`: Desired podcast length in minutes tags: - subpackage_podcasts parameters: - name: podcast_id in: path required: true schema: type: integer responses: '202': description: Script generation scheduled content: application/json: schema: $ref: '#/components/schemas/Podcasts_generateCreate_Response_202' '400': description: Invalid state or parameters content: application/json: schema: description: Any type requestBody: content: application/json: schema: $ref: '#/components/schemas/PodcastGeneration' components: schemas: VoiceTypeEnum: type: string enum: - interview - panel - educational - narrative - debate description: |- * `interview` - Interview * `panel` - Panel * `educational` - Educational * `narrative` - Narrative * `debate` - Debate title: VoiceTypeEnum NullEnum: description: Any type title: NullEnum PodcastGenerationVoiceType: oneOf: - $ref: '#/components/schemas/VoiceTypeEnum' - $ref: '#/components/schemas/NullEnum' description: >- Podcast preset type (interview, panel, etc.). Defaults based on length if not provided. * `interview` - Interview * `panel` - Panel * `educational` - Educational * `narrative` - Narrative * `debate` - Debate title: PodcastGenerationVoiceType PodcastGeneration: type: object properties: voice_type: oneOf: - $ref: '#/components/schemas/PodcastGenerationVoiceType' - type: 'null' description: >- Podcast preset type (interview, panel, etc.). Defaults based on length if not provided. * `interview` - Interview * `panel` - Panel * `educational` - Educational * `narrative` - Narrative * `debate` - Debate llm_prompt: type: - string - 'null' description: Optional custom instructions for script generation length: type: - integer - 'null' description: Desired podcast length in minutes description: Serializer for podcast script generation/regeneration request. title: PodcastGeneration Podcasts_generateCreate_Response_202: type: object properties: {} description: Empty response body title: Podcasts_generateCreate_Response_202 ``` ## SDK Code Examples ```python import requests url = "https://api.example.com/api/v1/podcasts/1/generate/" payload = {} headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.example.com/api/v1/podcasts/1/generate/'; const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.example.com/api/v1/podcasts/1/generate/" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.example.com/api/v1/podcasts/1/generate/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.example.com/api/v1/podcasts/1/generate/") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.example.com/api/v1/podcasts/1/generate/', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.example.com/api/v1/podcasts/1/generate/"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api/v1/podcasts/1/generate/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```