---
title: "Get Utopia Data"
method: POST
path: "/utopia/"
---

# Get Utopia Data

`POST /utopia/`

Request and receive the Utopia map corresponding to the decision variables sent.

Args:
    request (UtopiaRequest): the set of decision variables and problem for which the utopia forest map is requested
    for.
    user (Annotated[User, Depend(get_current_user)]) the current user
    session (Annotated[Session, Depends(get_session)]) the current database session
Raises:
    HTTPException:
Returns:
    UtopiaResponse: the map for the forest, to be rendered in frontend

## Request body

- UtopiaRequest — The request for an Utopia map.
  - `problem_id` integer, required — Problem for which the map is generated
  - `solution` SolutionInfo, required — Used when we wish to reference a solution in some `StateDB` stored in the database.
    - `state_id` integer, required
    - `solution_index` integer, required
    - `name` string, nullable — Name to be given to the solution. Optional.

## Response `200`

Successful Response

- UtopiaResponse — The response to an UtopiaRequest.
  - `is_utopia` boolean, required — True if map exists for this problem.
  - `map_name` string, required — Name of the map.
  - `map_json` object, required — MapJSON representation of the geography.
  - `options` object, required — A dict with given years as keys containing options for each year.
  - `description` string, required — Description shown above the map.
  - `years` string[], required — A list of years for which the maps have been generated.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/industrial-optimization-group/apis/desdeo-fast-api.md) · [All operations](https://skmtc.net/industrial-optimization-group/apis/desdeo-fast-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/industrial-optimization-group/desdeo-fast-api/versions/c24fa4e23380/schema)
