# App session boot

> Returns user, preferences (Postgres), studios with permissions basics and currentProfile. May be cached in Upstash Redis (~20 min) when UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are configured.

`GET /users/me/session`

## OpenAPI

````yaml openapi/agata-v1.yaml get /users/me/session
openapi: 3.0.3
info:
  title: Agata canonical API
  version: 1.0.0
  description: Canonical contract of the Agata Go API. Every documented route is
    registered in internal/delivery/http/handler.go. Monetary amounts are
    expressed in cents and local date keys use YYYY-MM-DD.
servers:
  - url: http://localhost:{port}/api
    description: Local server
    variables:
      port:
        default: "8080"
        description: Local HTTP port
  - url: "{scheme}://{host}/api"
    description: Configurable server
    variables:
      scheme:
        default: https
        enum:
          - http
          - https
      host:
        default: api.example.com
tags:
  - name: Health check
    description: Health-check operations.
  - name: Users
    description: Users domain operations.
  - name: Profiles
    description: Studio domain operations.
  - name: Organizations
    description: Company accounts that own people and Studios. Not followable.
  - name: Public profiles
    description: Public studio reads and one-way follows. Membership is not required.
  - name: Membership
    description: Studio membership plans, Connect status, and fan subscriptions.
  - name: Messages
    description: 1:1 owner chat between a studio owner and a subscriber with the
      owner_chat perk.
  - name: Feedback
    description: Feedback domain operations.
  - name: Internal system
    description: Internal system operations.
  - name: AI capabilities
    description: Durable leases, outcomes, and reversible effects for integrated AI actions.
  - name: Finance
    description: Finance domain operations.
  - name: Goals
    description: Goals domain operations.
  - name: Pomodoro
    description: Pomodoro domain operations.
  - name: Activities
    description: Activities domain operations.
  - name: Calendar
    description: Calendar domain operations.
  - name: Library
    description: Library domain operations.
  - name: Health
    description: Health domain operations.
  - name: Nutrition
    description: Nutrition domain operations.
  - name: Notebook
    description: Notebook domain operations.
  - name: Week plan
    description: Week-plan domain operations.
  - name: Files
    description: Files domain operations.
  - name: Tags
    description: Tags domain operations.
  - name: Tasks
    description: Tasks domain operations.
  - name: Projects
    description: Projects domain operations.
  - name: Internal
    description: Internal integrations protected by Bearer session.
  - name: Internal cron
    description: Internal cron operations.
paths:
  /users/me/session:
    get:
      tags:
        - Users
      operationId: getCurrentUserSession
      summary: App session boot
      description: Returns user, preferences (Postgres), studios with permissions
        basics and currentProfile. May be cached in Upstash Redis (~20 min) when
        UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are configured.
      security:
        - sessionBearer: []
      responses:
        "200":
          description: OK.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/SuccessResponse"
                  - type: object
                    properties:
                      data:
                        $ref: "#/components/schemas/UsersSession"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "429":
          $ref: "#/components/responses/RateLimited"
        "500":
          $ref: "#/components/responses/ServerError"
      parameters: []
components:
  schemas:
    UsersPreferences:
      type: object
      properties:
        appearance:
          type: object
          additionalProperties: true
          example: example
        regional:
          type: object
          additionalProperties: true
          example: example
      required:
        - appearance
        - regional
    UsersSessionUser:
      type: object
      properties:
        id:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        authUserId:
          type: string
          example: user_abc
        email:
          type: string
          example: user@example.com
        name:
          type: string
          example: Example
        avatarUrl:
          type: string
          example: https://example.com/recurso
        createdAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        updatedAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        lastLoginAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
      required:
        - id
        - authUserId
        - email
        - createdAt
        - updatedAt
    UsersSessionPermissions:
      type: object
      properties:
        sectionAccess:
          type: array
          items:
            $ref: "#/components/schemas/ProfilesSectionAccess"
        allowedSectionIds:
          type: array
          items:
            type: string
        canManageProfile:
          type: boolean
          example: false
        canInvite:
          type: boolean
          example: false
        canViewAuditLogs:
          type: boolean
          example: false
      required:
        - sectionAccess
        - canManageProfile
        - canInvite
        - canViewAuditLogs
    UsersSessionProfile:
      type: object
      properties:
        id:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        name:
          type: string
          example: Personal
        description:
          type: string
        ownerId:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        organizationId:
          type: string
          nullable: true
          description: Owning organization. Omitted or null for person-owned studios.
          example: 11111111-1111-4111-8111-111111111111
        imageUrl:
          type: string
        profilePlan:
          type: string
          enum:
            - base
            - pro
            - business
          example: base
        billingSubscriptionStatus:
          type: string
          example: none
        memberCount:
          type: integer
          example: 1
        projectCount:
          type: integer
          example: 1
        userRole:
          type: string
          example: owner
        permissions:
          $ref: "#/components/schemas/UsersSessionPermissions"
        settings:
          type: object
          additionalProperties: true
          description: Studio settings blob (enabled sections, nutrition meal types, etc.)
        createdAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
        updatedAt:
          type: string
          format: date-time
          example: 2026-01-01T12:00:00Z
      required:
        - id
        - name
        - ownerId
        - profilePlan
        - billingSubscriptionStatus
        - memberCount
        - projectCount
        - userRole
        - permissions
        - createdAt
        - updatedAt
    UsersSession:
      type: object
      properties:
        user:
          $ref: "#/components/schemas/UsersSessionUser"
        preferences:
          $ref: "#/components/schemas/UsersPreferences"
        profiles:
          type: array
          items:
            $ref: "#/components/schemas/UsersSessionProfile"
        currentProfile:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/UsersSessionProfile"
      required:
        - user
        - preferences
        - profiles
    ProfilesSectionAccess:
      type: object
      properties:
        sectionId:
          type: string
          example: tasks
        role:
          type: string
          enum:
            - admin
            - member
          example: member
      required:
        - sectionId
        - role
    ErrorDetail:
      type: object
      required:
        - message
      properties:
        code:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: The request is not valid.
        limit_key:
          type: string
        limit:
          type: integer
        required_plan:
          type: string
          enum:
            - pro
            - business
        resolution:
          type: string
          enum:
            - upgrade_plan
            - purchase_addon
        addon_key:
          type: string
          enum:
            - extra_members
            - ai_credit_packs
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: "#/components/schemas/ErrorDetail"
        request_id:
          type: string
          format: uuid
    Meta:
      type: object
      properties:
        next_cursor:
          type: string
          nullable: true
        has_more:
          type: boolean
        page:
          type: integer
          format: int32
          description: current page (1-based) when the list uses page pagination.
        page_size:
          type: integer
          format: int32
          description: Page size when the list uses page pagination.
        total:
          type: integer
          format: int32
          description: Total items matching the filter.
        total_pages:
          type: integer
          format: int32
          description: Total pages for the current page size.
    SuccessResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          additionalProperties: true
        request_id:
          type: string
          format: uuid
        meta:
          $ref: "#/components/schemas/Meta"
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Forbidden:
      description: Acceso denegado.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    NotFound:
      description: Recurso no encontrado.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Conflict:
      description: Conflict with the current state.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    RateLimited:
      description: Request limit exceeded.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    ServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
````
