# Apply enhanced prompt (/docs/api-reference/simulation/applyEnhancedPrompt)

> Rewrite the agent's prompt sections from a completed simulation's suggestions. The agent's current sections are replaced, so save a version first if you may want them back. To review a proposed rewrite without applying it, call `enhancePrompt`. The applied text is generated again and can differ slightly from that preview.

**POST** `/simulations/{simulation_id}/apply-enhanced-prompt`

Rewrite the agent's prompt sections from a completed simulation's suggestions. The agent's current sections are replaced, so save a version first if you may want them back. To review a proposed rewrite without applying it, call `enhancePrompt`. The applied text is generated again and can differ slightly from that preview.

```yaml
operationId: applyEnhancedPrompt
parameters:
  - name: simulation_id
    in: path
    required: true
    schema:
      type: integer
responses:
  '200':
    description: The agent's prompt sections were replaced.
    content:
      application/json:
        schema:
          type: object
          properties:
            success:
              type: boolean
            message:
              type: string
            agent_id:
              type: integer
              description: The agent whose prompt changed.
        example:
          success: true
          message: Enhanced prompt applied to agent successfully
          agent_id: 123
  '400':
    description: |
      The simulation has no prompt suggestions yet. They are written when
      the simulation completes.
  '401':
    description: Missing or invalid API key.
  '403':
    description: The API key's user cannot run simulations.
  '404':
    description: Simulation not found or access denied.
```

**Python SDK**

```python
from omnidimension import Client
client = Client(api_key)

response = client.simulation.apply_enhanced_prompt(456)
print(response["json"]["agent_id"])
```

**curl**

```bash
curl -X POST "https://omnidim.io/api/v1/simulations/{simulation_id}/apply-enhanced-prompt" \
  -H "Authorization: Bearer $OMNIDIM_API_KEY"
```