---
title: "Optimize a business variable"
method: POST
path: "/v1/optimize"
tags: ["Products"]
---

# Optimize a business variable

`POST /v1/optimize`

## Request

- Base URL: `https://api.algenta.ai`
- URL: `https://api.algenta.ai/v1/optimize`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Find the optimal value for pricing, routing, scheduling, or resource allocation.

Describe your objective and constraints in plain English — Algenta finds the best configuration across thousands of iterations.

## Request body

- OptimizeRequest: Find the best value given inputs, constraints, and an objective. Use cases: pricing, routing, scheduling, resource allocation. No math required — just describe what you're optimizing.
  - `objective` string, required: What to optimize, e.g. 'maximize profit', 'minimize cost', 'maximize throughput'
  - `variables` OptimizeVariable[], required: Variables to optimize with their allowed ranges
    - `name` string, required
    - `min` number, required
    - `max` number, required
    - `step` number, nullable
    - `unit` string, nullable
  - `constraints` OptimizeConstraint[]: Business constraints that must be satisfied
    - `expression` string, required: e.g. 'margin > 0.2', 'cost < 50000'
    - `required` boolean
  - `iterations` integer: Search iterations
  - `engine` string: Simulation engine. 'auto' selects the best engine automatically. Options: lhs (recommended for optimization), monte_carlo, qmc_sobol

## Response `200`

Successful Response

- OptimizeResponse
  - `optimization_id` string, required
  - `status` string, required
  - `optimal_values` object, required
  - `objective_value` number, required
  - `improvement_vs_midpoint` number, required: % improvement vs naive midpoint solution
  - `constraints_satisfied` boolean, required
  - `iterations_run` integer, required
  - `latency_ms` number, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/codna/apis/algenta-api.md) · [All operations](https://skmtc.dev/codna/apis/algenta-api/llms.txt) · [OpenAPI document](https://skmtc.dev/codna/apis/algenta-api/revisions/35d30f84a5df?raw)
