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

# API Authentication

The Authentication API allows you to authenticate users and obtain access tokens for the OpenMemoryX portal.

## Register

Create a new user account.

<ParamField body="email" type="string" required>
  User email address
</ParamField>

<ParamField body="password" type="string" required>
  User password (min 8 characters)
</ParamField>

### Request

```bash theme={null}
curl -X POST https://t0ken.ai/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepassword123"
  }'
```

### Response

```json theme={null}
{
  "id": 1,
  "email": "user@example.com",
  "message": "User registered successfully"
}
```

## Login

Authenticate and obtain a JWT access token.

<ParamField body="username" type="string" required>
  User email address
</ParamField>

<ParamField body="password" type="string" required>
  User password
</ParamField>

### Request

```bash theme={null}
curl -X POST https://t0ken.ai/api/auth/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=user@example.com&password=securepassword123"
```

### Response

```json theme={null}
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer"
}
```

## Get Current User

Retrieve information about the currently authenticated user.

### Request

```bash theme={null}
curl https://t0ken.ai/api/auth/me \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

### Response

```json theme={null}
{
  "id": 1,
  "email": "user@example.com",
  "created_at": "2026-02-13T10:00:00Z"
}
```


## OpenAPI

````yaml POST /api/auth/login
openapi: 3.1.0
info:
  title: MemoryX API
  description: >-
    MemoryX – Cognitive Memory API and LLM proxy.


    **Base URL:** `https://memoryx.cloud/api`


    **Consumers:**

    - **SDK / MCP:** Memories (v1), Conversations (v1), Projects, Stats, Agents
    (auto-register, claim), API Keys

    - **OpenClaw plugin:** LLM Proxy (chat completions with memory injection)

    - **Portal:** Auth (Firebase), Subscription, Install guide

    - **Public:** Models repo (search, autocomplete)


    **Auth:** `X-API-Key` for SDK/MCP/plugin; Firebase ID token or Bearer for
    portal endpoints.
  version: 1.0.0
servers: []
security: []
paths:
  /api/auth/login:
    post:
      tags:
        - auth
      summary: Login
      operationId: login_api_auth_login_post
      parameters: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_login_api_auth_login_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Token'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_login_api_auth_login_post:
      properties:
        grant_type:
          anyOf:
            - type: string
              pattern: ^password$
            - type: 'null'
          title: Grant Type
        username:
          type: string
          title: Username
        password:
          type: string
          format: password
          title: Password
        scope:
          type: string
          title: Scope
          default: ''
        client_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Id
        client_secret:
          anyOf:
            - type: string
            - type: 'null'
          format: password
          title: Client Secret
      type: object
      required:
        - username
        - password
      title: Body_login_api_auth_login_post
    Token:
      properties:
        access_token:
          type: string
          title: Access Token
        token_type:
          type: string
          title: Token Type
          default: bearer
      type: object
      required:
        - access_token
      title: Token
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````