> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Anmeldung

> Dieser Endpunkt authentifiziert einen Nutzer und liefert Access-Tokens.

## POST /auth/login

Mit diesem Endpunkt meldet sich ein Nutzer per E-Mail und Passwort an. Bei erfolgreicher Authentifizierung werden Access- und Refresh-Token für nachfolgende API-Anfragen zurückgegeben.

### Anfragetext

<ParamField body="email" type="string" required>
  E-Mail-Adresse des Nutzers.
</ParamField>

<ParamField body="password" type="string" required>
  Passwort des Kontos.
</ParamField>

### Antwort

<ResponseField name="success" type="boolean">
  Gibt an, ob die Anmeldung erfolgreich war.
</ResponseField>

<ResponseField name="message" type="string">
  Für Menschen lesbare Statusmeldung.
</ResponseField>

<ResponseField name="user" type="object">
  Objekt mit den Nutzerdaten.

  <Expandable title="Eigenschaften von user">
    <ResponseField name="id" type="string">
      Eindeutige Kennung des Nutzers.
    </ResponseField>

    <ResponseField name="email" type="string">
      E-Mail-Adresse des Nutzers.
    </ResponseField>

    <ResponseField name="name" type="string">
      Vollständiger Name des Nutzers.
    </ResponseField>

    <ResponseField name="emailVerified" type="boolean">
      Ob die E-Mail-Adresse verifiziert ist.
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO-8601-Zeitstempel der letzten Aktualisierung.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="tokens" type="object">
  Objekt mit den Authentifizierungs-Tokens.

  <Expandable title="Eigenschaften von tokens">
    <ResponseField name="accessToken" type="string">
      Access-Token für nachfolgende Anfragen. Verwenden Sie ihn im Header `Authorization` als Bearer-Token. Läuft nach 15 Minuten ab.
    </ResponseField>

    <ResponseField name="refreshToken" type="string">
      Refresh-Token zum Beziehen neuer Access-Tokens. Läuft nach 7 Tagen ab.
    </ResponseField>

    <ResponseField name="expiresIn" type="number">
      Ablaufzeit des Tokens in Sekunden (900 = 15 Minuten).
    </ResponseField>

    <ResponseField name="tokenType" type="string">
      Token-Typ (immer „Bearer“).
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/auth/login \
    -H "Content-Type: application/json" \
    -d '{
          "email": "user@example.com",
          "password": "securePassword123"
        }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/auth/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'securePassword123'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.llmgenerator.com/api/v1/auth/login',
      json={
          'email': 'user@example.com',
          'password': 'securePassword123'
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "success": true,
    "message": "Login successful",
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "user@example.com",
      "name": "John Doe",
      "emailVerified": true,
      "updatedAt": "2026-01-29T12:00:00.000Z"
    },
    "tokens": {
      "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expiresIn": 900,
      "tokenType": "Bearer"
    }
  }
  ```

  ```json Invalid Credentials (401) theme={null}
  {
    "message": "Invalid email or password"
  }
  ```
</ResponseExample>
