---
title: "Change username"
method: POST
path: "/change-username"
---

# Change username

`POST /change-username`

## Headers

- `X-XSRF-Token` XCSRFToken — unresolved $ref

## Request body

- ChangeUsername
  - `username` string, required — New username

## Response `200`

Change username response.

- DefaultJsonResponse
  - `meta` object, required
    - `code` integer, required — Http status code
  - `response` object, required
    - `user` object — By default an empty dictionary is returned. However by overriding _User::get_security_payload()_ any attributes of the User model can be returned.
    - `csrf_token` string — Session CSRF token

## Other responses

- `302` — Username has been changed (non-json)
- `400` — Errors while validating form

## Changes

- **2025-01-14** `a0f89515a349` — 1 info
  - endpoint added
- **2019-07-23** `11c8459a5c04` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/pallets-eco/apis/flask-security-external-api/changes/change-username/post.md)

---

[API](https://skmtc.dev/pallets-eco/apis/flask-security-external-api.md) · [All operations](https://skmtc.dev/pallets-eco/apis/flask-security-external-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pallets-eco/flask-security-external-api/revisions/ee92f388dafa/schema)
