Skip to content

Auth

Thogits uses session-based authentication. After registering or logging in, the server sets an HTTP-only session cookie that authenticates subsequent requests. All auth endpoints are under /api/auth/.

Create a new account with email and password.

Auth required: No

Request body:

FieldTypeRequiredDescription
emailstringYesEmail address
passwordstringYesPassword (minimum 8 characters)
Terminal window
curl -X POST https://app.thogits.com/api/auth/register \
-H "Content-Type: application/json" \
-c cookies.txt \
-d '{"email": "user@example.com", "password": "securepass123"}'

Response (200):

{
"user_id": "01HQ8A1B2CDEFGHIJK3LMNOP4Q",
"email": "user@example.com",
"display_name": null,
"created_at": "2025-01-15T10:00:00Z",
"oauth_providers": [],
"has_password": true,
"has_totp": false
}

A session cookie is set automatically. You can immediately make authenticated requests.

Errors:

StatusCause
400Invalid email, password too short, or email already registered

Authenticate with email and password.

Auth required: No

Request body:

FieldTypeRequiredDescription
emailstringYesEmail address
passwordstringYesPassword
Terminal window
curl -X POST https://app.thogits.com/api/auth/login \
-H "Content-Type: application/json" \
-b cookies.txt -c cookies.txt \
-d '{"email": "user@example.com", "password": "securepass123"}'

Response (200) — success:

{
"user_id": "01HQ8A1B2CDEFGHIJK3LMNOP4Q",
"email": "user@example.com",
"display_name": "Alice",
"created_at": "2025-01-15T10:00:00Z",
"oauth_providers": ["google"],
"has_password": true,
"has_totp": true
}

Response (200) — TOTP required:

If the account has two-factor authentication enabled, the password check succeeds but returns a partial session:

{
"needs_2fa": true
}

You must then call POST /auth/2fa/totp/verify with the 6-digit code to complete login.

Errors:

StatusCause
401Invalid email or password

End the current session.

Auth required: Yes

Terminal window
curl -X POST https://app.thogits.com/api/auth/logout \
-b cookies.txt -c cookies.txt

Response (200):

{"message": "Logged out"}

Get the current authenticated user’s information.

Auth required: Yes

Terminal window
curl https://app.thogits.com/api/auth/me \
-b cookies.txt -c cookies.txt

Response (200): The UserInfo object (same shape as the register/login response).

Errors:

StatusCause
401Not authenticated

Update the current user’s profile.

Auth required: Yes

Request body:

FieldTypeRequiredDescription
display_namestringNoDisplay name
Terminal window
curl -X PUT https://app.thogits.com/api/auth/profile \
-H "Content-Type: application/json" \
-b cookies.txt -c cookies.txt \
-d '{"display_name": "Alice"}'

Response (200): The updated UserInfo object.


Change the current user’s password.

Auth required: Yes

Request body:

FieldTypeRequiredDescription
current_passwordstringYesCurrent password for verification
new_passwordstringYesNew password (minimum 8 characters)
Terminal window
curl -X POST https://app.thogits.com/api/auth/password \
-H "Content-Type: application/json" \
-b cookies.txt -c cookies.txt \
-d '{"current_password": "securepass123", "new_password": "evenmoresecure456"}'

Response (200):

{"message": "Password updated"}

Errors:

StatusCause
400New password too short
401Current password incorrect