Zügle Auth API

PIN login, session lifecycle, and data-subject rights (GDPR export/erasure).

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 8

POST /api/auth/signup Create an account #
POST /api/auth/login Log in with email and password #
POST /api/auth/forgot Request a password-reset link by mail #
POST /api/auth/reset Redeem a reset token and set a new password #
POST /api/auth/change-password Change the current account's password #
POST /api/auth/logout Log out the current session #
POST /api/auth/logout-all Log out every device for this profile #
GET /api/auth/me Who am I #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/zuegle-com:zuegle-com-auth-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

zuegle-com-auth-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Zügle Auth API
  version: 1.0.0
  description: 'Zügle is a Swiss "does it pay off to move?" app. Paste a Flatfox/Homegate listing

    link (or enter costs manually) to compare a candidate apartment against a current

    home: monthly living costs, the Swiss income-tax delta between municipalities

    (federal/cantonal/Gemeinde), commute time and cost, and a quality-of-living score.


    The app has **guest mode**: several routes are reachable with no session cookie at

    all. A guest supplies their own income/relationship/confession/children/current-home

    figures on the request itself (query params or, for ingest, a `profile` body object)

    and gets a computed result back — nothing about a guest request is ever persisted

    server-side. The same routes behave differently for an authenticated household

    member: caller-supplied profile values are ignored and the stored profile

    (`p1`/`p2`) is used instead. Guest traffic is additionally throttled by a set of

    in-memory, per-IP rate-limit buckets described on each public operation; an

    authenticated caller using their own app is never subject to those buckets.'
  contact:
    name: Zügle
servers:
- url: http://localhost:8090
  description: Local dev (npm run dev) or local prod (npm run prod) — both serve on :8090
- url: https://zuegle.com
  description: 'Public production deployment. The VPS holds no open ports: a Cloudflare Tunnel (cloudflared) fronts localhost:8090, so TLS terminates at Cloudflare and the app runs with TRUST_PROXY_HOPS=1 / FORCE_HTTPS=1. Auto-deployed from the main branch.'
- url: https://zugle-vps.barbel-char.ts.net
  description: The same VPS over the Tailscale tailnet — admin/debug access that does not depend on Cloudflare. Tailscale Funnel is OFF here; a tailnet member reaches this, the public internet does not.
security:
- cookieAuth: []
tags:
- name: Auth
  description: PIN login, session lifecycle, and data-subject rights (GDPR export/erasure).
paths:
  /api/auth/signup:
    post:
      operationId: signup
      summary: Create an account
      description: Public. Creates an account plus its first (empty) profile in one transaction, and signs the caller in. The FIRST account on an installation is created with role "admin" — with no admin there would be no way to reach the operator panel, and shipping a default admin credential would be worse. Every later signup is a plain user. Set ALLOW_SIGNUP=0 to make an instance invite-only, which turns this route into a 403. Rate limited to 5 per hour per IP on top of the general guest budget.
      tags:
      - Auth
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - password
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
                  minLength: 10
                  description: At least 10 characters; no composition rules (NIST SP 800-63B).
                name:
                  type: string
                  description: Optional display name for the first profile.
              example:
                email: you@example.ch
                password: correct horse battery
                name: Ana
      responses:
        '200':
          description: Account created; Set-Cookie carries the session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Identity'
        '400':
          description: Invalid address, password too short, or the address is already registered.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: An account with that email already exists
        '403':
          description: Registration is closed on this instance (ALLOW_SIGNUP=0).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many signups from this IP.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
  /api/auth/login:
    post:
      operationId: login
      summary: Log in with email and password
      description: Public. Verifies the password with scrypt and, on success, sets the HttpOnly `zugle_session` cookie (the stored session row holds only the token's SHA-256). Returns ONE message for both "no such account" and "wrong password", and an unknown address still pays a full scrypt verification, so neither the body nor the response time enumerates registered addresses. Guarded by a brute-force limiter that is per-IP (10 failures / 15 min) AND per-account (5 / 15 min) — either alone leaves the other attack open.
      tags:
      - Auth
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - password
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
              example:
                email: you@example.ch
                password: correct horse battery
      responses:
        '200':
          description: Login succeeded; Set-Cookie carries the session.
          headers:
            Set-Cookie:
              schema:
                type: string
              description: zugle_session=<64-hex token>; Path=/; HttpOnly; SameSite=Lax; Max-Age=...
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Identity'
        '401':
          description: Wrong email or password (deliberately indistinguishable).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Wrong email or password
        '429':
          description: Too many failed attempts for this IP or this account in the last 15 minutes.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds until the oldest failure in the window ages out.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
              example:
                error: Too many attempts — try again later
                retryAfterSec: 412
  /api/auth/forgot:
    post:
      operationId: forgotPassword
      summary: Request a password-reset link by mail
      description: 'Public — a locked-out user has no session by definition. **Always returns the same 200 body**, whether or not the address is registered: anything else would make this the account-enumeration oracle that `/api/auth/login` goes out of its way not to be. When the address exists, any previously issued link for it is invalidated and a new single-use token (valid 1 hour) is mailed out. Mail is optional infrastructure — with `SMTP_HOST`/`APP_BASE_URL` unset nothing is sent and the response is unchanged. Rate-limited to 5 requests / 15 min.'
      tags:
      - Auth
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              properties:
                email:
                  type: string
                  format: email
              example:
                email: you@example.ch
      responses:
        '200':
          description: Request accepted. Says nothing about whether the address exists.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
              example:
                ok: true
        '429':
          description: Too many reset requests from this IP in the last 15 minutes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
  /api/auth/reset:
    post:
      operationId: resetPassword
      summary: Redeem a reset token and set a new password
      description: Public. The token comes from the mailed link's `?reset=` parameter; only its SHA-256 is stored server-side, so database read access is not account takeover. Single use, and unknown / already-used / expired all return the SAME message — which of the three it was is information about someone else's inbox. On success every session for the account is destroyed (the point of a reset is usually a suspected compromise) and a fresh one is issued for the device that redeemed the link.
      tags:
      - Auth
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - token
              - password
              properties:
                token:
                  type: string
                password:
                  type: string
              example:
                token: 3f1c…
                password: correct horse battery
      responses:
        '200':
          description: Password changed; Set-Cookie carries a new session.
          headers:
            Set-Cookie:
              schema:
                type: string
              description: zugle_session=<64-hex token>; Path=/; HttpOnly; SameSite=Lax; Max-Age=...
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Identity'
        '400':
          description: Link no longer valid, or the new password fails the shape rules.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: That reset link is no longer valid — request a new one
        '429':
          description: Too many attempts from this IP in the last 15 minutes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
  /api/auth/change-password:
    post:
      operationId: changePassword
      summary: Change the current account's password
      description: Requires a session and the current password. Ends every OTHER session for the account (changing a password usually means the old one is believed compromised) and issues a fresh cookie for the calling device only.
      tags:
      - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - currentPassword
              - newPassword
              properties:
                currentPassword:
                  type: string
                newPassword:
                  type: string
                  minLength: 10
      responses:
        '200':
          description: Password changed; Set-Cookie carries a new session for this device.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
        '400':
          description: Current password wrong, or the new one is too short.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/SessionExpired'
  /api/auth/logout:
    post:
      operationId: logout
      summary: Log out the current session
      description: Destroys the session behind the presented cookie and clears it client-side.
      tags:
      - Auth
      responses:
        '200':
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
              description: Clears the zugle_session cookie (Max-Age=0).
          content:
            application/json:
              schema:
                type: object
                required:
                - ok
                properties:
                  ok:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/SessionExpired'
  /api/auth/logout-all:
    post:
      operationId: logoutAll
      summary: Log out every device for this profile
      description: Destroys every session belonging to the caller's profile, not just the current one.
      tags:
      - Auth
      responses:
        '200':
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
              description: Clears the zugle_session cookie on this device too (Max-Age=0).
          content:
            application/json:
              schema:
                type: object
                required:
                - ok
                properties:
                  ok:
                    type: boolean
                    example: true
        '401':
          $ref: '#/components/responses/SessionExpired'
  /api/auth/me:
    get:
      operationId: getMe
      summary: Who am I
      description: Returns the caller's own profileId/role from the session. `role` is absent on sessions created before roles existed and defaults to "user" client-side; the server always re-checks with a real role gate on admin routes regardless of what this reports.
      tags:
      - Auth
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                - profileId
                - role
                properties:
                  profileId:
                    type: string
                    example: p1
                  role:
                    type: string
                    enum:
                    - user
                    - admin
                    example: user
        '401':
          $ref: '#/components/responses/SessionExpired'
components:
  responses:
    SessionExpired:
      description: No valid session cookie. This is the ONE error shape in the whole API that bypasses the standard ApiError → handleRouteError path (it's written directly by auth.js's authGate middleware before the route dispatcher runs), which is why it alone carries a `code` field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SessionExpiredError'
          example:
            error: Unauthorized — please log in
            code: SESSION_EXPIRED
  schemas:
    Error:
      type: object
      description: 'The base shape of every error response in this API: `{ error: <message>, ...extra }`, produced by throwing `ApiError(status, message, extra)` in server/app.js (caught centrally by handleRouteError) or, for unmatched routes, written directly by the dispatcher.'
      required:
      - error
      properties:
        error:
          type: string
      additionalProperties: true
    Identity:
      type: object
      required:
      - userId
      - role
      description: Who the session belongs to. Returned by signup and login.
      properties:
        userId:
          type: string
          example: u_xRTAzIJhYMHC
        email:
          type: string
          format: email
        role:
          type: string
          enum:
          - user
          - admin
          description: A UI hint only — every admin route re-checks server-side with requireAdmin, so claiming "admin" client-side gets a 403 and nothing else.
    SessionExpiredError:
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        required:
        - code
        properties:
          code:
            type: string
            enum:
            - SESSION_EXPIRED
    RateLimitError:
      description: A 429 from any of the guest-mode rate-limit buckets, or the login brute-force limiter.
      allOf:
      - $ref: '#/components/schemas/Error'
      - type: object
        required:
        - retryAfterSec
        properties:
          retryAfterSec:
            type: integer
            description: Also sent as the Retry-After response header.
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: zugle_session
      description: 64-hex-character session token set as an HttpOnly, SameSite=Strict cookie by POST /api/auth/login. Routes NOT in the guest-mode public set return 401 with code SESSION_EXPIRED when it is missing or invalid.