# Start Batch Planning POST /api/v2/experiences/plan/ Content-Type: application/json Initiates the AI planning phase. Takes source docs and studio context to generate content plans. Reference: https://docs.aisquare.studio/api-reference/ai-square-studio-api/experiences/plan-create ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: AISquare Studio API version: 1.0.0 paths: /api/v2/experiences/plan/: post: operationId: plan-create summary: Start Batch Planning description: >- Initiates the AI planning phase. Takes source docs and studio context to generate content plans. tags: - subpackage_experiences responses: '202': description: '' content: application/json: schema: $ref: '#/components/schemas/PlannerResponse' requestBody: content: application/json: schema: $ref: '#/components/schemas/PlannerRequest' components: schemas: PlannerRequest: type: object properties: rag_document_ids: type: array items: type: string description: List of Vector Document IDs (Strings) studio_id: type: string experience_types: type: array items: type: string description: List of experience types (e.g. ['VIDEO', 'PODCAST']) additional_context: type: string action_session_id: type: - string - 'null' description: Optional Action Session ID to pull context from required: - rag_document_ids - studio_id - experience_types description: >- Input serializer for the Batch Planner API. Accepts raw selection from the UI (RAG Docs + Studio + Experience Types). Validation: - Inherits context-aware validation logic from domain Mixins. - Ensures user has access to Studio and Documents within the active Workspace. title: PlannerRequest PlannerResponse: type: object properties: job_id: type: string status: type: string result: type: object additionalProperties: description: Any type description: Contains list of spawned child jobs message: type: string required: - job_id - status - message description: >- Returns the ID of the Master Planner Job and the result of the planning phase. title: PlannerResponse ``` ## SDK Code Examples ```python import requests url = "https://api.example.com/api/v2/experiences/plan/" payload = { "rag_document_ids": ["doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456", "doc_4a7d3e2b-5678-4f90-b123-fedcba654321"], "studio_id": "studio_7c9e6679-7425-40de-944b-e07fc1f90ae7", "experience_types": ["VIDEO", "PODCAST"] } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.example.com/api/v2/experiences/plan/'; const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"rag_document_ids":["doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456","doc_4a7d3e2b-5678-4f90-b123-fedcba654321"],"studio_id":"studio_7c9e6679-7425-40de-944b-e07fc1f90ae7","experience_types":["VIDEO","PODCAST"]}' }; 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/v2/experiences/plan/" payload := strings.NewReader("{\n \"rag_document_ids\": [\n \"doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456\",\n \"doc_4a7d3e2b-5678-4f90-b123-fedcba654321\"\n ],\n \"studio_id\": \"studio_7c9e6679-7425-40de-944b-e07fc1f90ae7\",\n \"experience_types\": [\n \"VIDEO\",\n \"PODCAST\"\n ]\n}") 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/v2/experiences/plan/") 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 = "{\n \"rag_document_ids\": [\n \"doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456\",\n \"doc_4a7d3e2b-5678-4f90-b123-fedcba654321\"\n ],\n \"studio_id\": \"studio_7c9e6679-7425-40de-944b-e07fc1f90ae7\",\n \"experience_types\": [\n \"VIDEO\",\n \"PODCAST\"\n ]\n}" 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/v2/experiences/plan/") .header("Content-Type", "application/json") .body("{\n \"rag_document_ids\": [\n \"doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456\",\n \"doc_4a7d3e2b-5678-4f90-b123-fedcba654321\"\n ],\n \"studio_id\": \"studio_7c9e6679-7425-40de-944b-e07fc1f90ae7\",\n \"experience_types\": [\n \"VIDEO\",\n \"PODCAST\"\n ]\n}") .asString(); ``` ```php request('POST', 'https://api.example.com/api/v2/experiences/plan/', [ 'body' => '{ "rag_document_ids": [ "doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456", "doc_4a7d3e2b-5678-4f90-b123-fedcba654321" ], "studio_id": "studio_7c9e6679-7425-40de-944b-e07fc1f90ae7", "experience_types": [ "VIDEO", "PODCAST" ] }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.example.com/api/v2/experiences/plan/"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"rag_document_ids\": [\n \"doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456\",\n \"doc_4a7d3e2b-5678-4f90-b123-fedcba654321\"\n ],\n \"studio_id\": \"studio_7c9e6679-7425-40de-944b-e07fc1f90ae7\",\n \"experience_types\": [\n \"VIDEO\",\n \"PODCAST\"\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "rag_document_ids": ["doc_9f8b7c6a-1234-4d56-8e9f-abcdef123456", "doc_4a7d3e2b-5678-4f90-b123-fedcba654321"], "studio_id": "studio_7c9e6679-7425-40de-944b-e07fc1f90ae7", "experience_types": ["VIDEO", "PODCAST"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/api/v2/experiences/plan/")! 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() ```