---
title: "Optimize Workspace Use Case Script Section"
method: POST
path: "/api/workspaces/{workspace_id}/usecases/optimize-script-section"
---

# Optimize Workspace Use Case Script Section

`POST /api/workspaces/{workspace_id}/usecases/optimize-script-section`

## Request

- Base URL: `https://api.outcallerai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.outcallerai.com/api/workspaces/{workspace_id}/usecases/optimize-script-section`
- Auth: none declared

## Path parameters

- `workspace_id` string, required

## Request body

- UseCaseScriptSectionOptimizeRequest
  - `section` 'agentInstructions' | 'greeting' | 'mainConversationFlow' | 'closing' | 'objectionHandling' | 'guardrails', required
  - `content` string, required
  - `example` string, required
  - `useCaseId` string, nullable
  - `sessionId` string, nullable
  - `context` PromptGenerationContext
    - `name` string, nullable
    - `useCaseGoals` string, nullable
    - `conclusion` string, nullable
    - `type` string, nullable

## Response `200`

Successful Response

- UseCaseScriptSectionOptimizeResponse
  - `section` 'agentInstructions' | 'greeting' | 'mainConversationFlow' | 'closing' | 'objectionHandling' | 'guardrails', required
  - `optimizedText` string, required
  - `scriptOptimizeUsage` object
  - `optimizationsRemaining` integer, required

## Other responses

- `422`: Validation Error

## Changes

- **2026-07-31** `7c9aff2501f3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/outcallerai/apis/outcallerai-api/changes/api/workspaces/:workspace_id/usecases/optimize-script-section/post.md)

---

[API](https://skmtc.dev/outcallerai/apis/outcallerai-api.md) - [All operations](https://skmtc.dev/outcallerai/apis/outcallerai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/outcallerai/apis/outcallerai-api/revisions/40736cf433b4?raw)
