---
title: "Expand Constraint Choices Endpoint"
method: POST
path: "/felix/constraints/expand"
tags: ["felix"]
---

# Expand Constraint Choices Endpoint

`POST /felix/constraints/expand`

Expand the choice list for a single constraint.

Args:
    request: Constraint to expand, target count, and task description.
    auth: Authenticated caller.

Returns:
    The updated constraint with its expanded choices and token usage.

Raises:
    HTTPException: 503 for transient upstream failures, 500 otherwise.

## Request body

- ExpandConstraintChoicesRequest — Expand constraint choices request
  - `user_id` string, nullable — User ID (optional, uses authenticated user if not provided)
  - `constraint` ConstraintRequest, required — Constraint request model
    - `description` string, required — Constraint description
    - `choices` string[], nullable — Optional list of choices for this constraint
    - `weights` number[], nullable — Optional weights for choices (must align with choices length)
    - `probability` number, nullable — Optional probability (0.0-1.0) for this constraint
  - `task_description` string, required — Task description for context
  - `max_count` integer — Maximum number of choices after expansion

## Response `200`

Successful Response

- ExpandConstraintChoicesResponse — Expand constraint choices response
  - `success` boolean, required
  - `constraint` ConstraintRequest, required — Constraint request model
    - `description` string, required — Constraint description
    - `choices` string[], nullable — Optional list of choices for this constraint
    - `weights` number[], nullable — Optional weights for choices (must align with choices length)
    - `probability` number, nullable — Optional probability (0.0-1.0) for this constraint
  - `expanded_choices` string[], required
  - `count` integer, required
  - `token_usage` integer, nullable — Estimated tokens used for expansion

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/b92f75fd3b61/schema)
