---
title: "Optimize"
method: POST
path: "/api/surrogate/{model_id}/optimize"
tags: ["surrogate"]
---

# Optimize

`POST /api/surrogate/{model_id}/optimize`

## Request

- Base URL: `https://api.pcbgenerator.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.pcbgenerator.com/api/surrogate/{model_id}/optimize`
- Auth: none declared

Global optimization of a surrogate output using differential evolution.

## Path parameters

- `model_id` string, required

## Request body

- OptimizeRequest
  - `objective_output` string, required: Output to optimize
  - `objective_type` 'minimize' | 'maximize' | 'target': Optimization objective: minimize, maximize, or target a specific value
  - `target_value` number, nullable: Target value (required when objective_type is 'target')
  - `fixed_inputs` object, nullable: Inputs to hold constant
  - `bounds_override` object, nullable: Override bounds: {name: [min, max]}
  - `max_iter` integer: Max optimizer iterations

## Response `200`

Successful Response

- SurrogateResponse
  - `success` boolean, required
  - `data` object, nullable
  - `error` string, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/pcbgenerator/apis/pcb-stackup-generator-api.md) · [All operations](https://skmtc.dev/pcbgenerator/apis/pcb-stackup-generator-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pcbgenerator/apis/pcb-stackup-generator-api/revisions/b6084b3ace32?raw)
