---
title: "Add New Analyst"
method: POST
path: "/add_new_analyst"
---

# Add New Analyst

`POST /add_new_analyst`

Add a new user of the role Analyst to the database. Requires a logged in analyst or an admin.

Args:
    user: Annotated[User, Depends(get_current_user)]: Logged in user with the role "analyst" or "admin".
    form_data: (Annotated[OAuth2PasswordRequestForm, Depends()]): The user credentials to add to the database.
    session: (Annotated[Session, Depends(get_session)]): the database session.

Returns:
    JSONResponse: A JSON response

Raises:
    HTTPException: if the logged in user is not an analyst or an admin or if
    username is already in use or if saving to the database fails for some reason.

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

## Changes

- **2026-07-17** `c24fa4e23380` — 1 info
  - endpoint added
- **2025-05-20** `bbcc40488a72` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api/changes/add_new_analyst/post.md)

---

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