---
title: "Register"
method: POST
path: "/api/auth/register"
tags: ["auth"]
---

# Register

`POST /api/auth/register`

## Request

- Base URL: `https://api.stellara.natlex.it` (the document declares no server; this is the origin it was published from)
- URL: `https://api.stellara.natlex.it/api/auth/register`
- Auth: none declared

Register a new user with email and password.

Concurrency note: the pre-check `SELECT … WHERE email=%s` exists so
the *common* path returns a clean 409 without a transaction round-trip.
But two simultaneous register POSTs to the same email both pass the
pre-check, both reach `INSERT`, and the second one raises
``UniqueViolation`` from the schema-level `users.email UNIQUE NOT NULL`
constraint. Without the catch below, FastAPI surfaces the IntegrityError
as a 500 (real concurrency bug, audited 2026-04-25). Catch it and
re-raise as the same 409 the pre-check would have produced.

## Request body

- RegisterRequest
  - `email` string, email, required
  - `password` string, required
  - `name` string, required

## Response `201`

Successful Response

- TokenResponse
  - `access_token` string, required
  - `refresh_token` string, required
  - `token_type` string
  - `is_new_user` boolean

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/natlex/apis/stellara-api.md) · [All operations](https://skmtc.dev/natlex/apis/stellara-api/llms.txt) · [OpenAPI document](https://skmtc.dev/natlex/apis/stellara-api/revisions/e576f046b61f?raw)
