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

# Generate account statement

> Generate a PDF account statement for the user including investment, cash, and savings activity.



## OpenAPI

````yaml POST /users/me/account-statements/generate
openapi: 3.0.3
info:
  title: Wealthyhood Users API
  version: 1.0.0
  description: >
    User management endpoints for creating and managing user accounts in the
    Wealthyhood platform.


    All requests require a bearer access token with the advertised scopes, and
    must include 

    appropriate authentication headers.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.wealthyhood.com
        description: Wealthyhood API host name.
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Create and manage user accounts.
paths:
  /users/me/account-statements/generate:
    post:
      tags:
        - Users
      summary: Generate account statement
      description: >
        Generates a PDF account statement for the user identified by the
        `x-user-id` header.

        The statement includes investment, cash, and savings activity within the
        optional date range.


        **Date range:**

        - If both `start` and `end` are omitted, the statement includes all
        available activity

        - Dates are inclusive (start of day for `start`, end of day for `end`)

        - Dates must be in ISO 8601 format (YYYY-MM-DD)


        **User requirements:**

        - User must have an address on file (required for PDF generation)


        **Response:**

        Returns a pre-signed URL (`fileUri`) to download the generated PDF. The
        URL is temporary

        and typically expires after a short period.
      operationId: generateAccountStatement
      parameters:
        - name: x-user-id
          in: header
          required: true
          description: >-
            MongoDB ObjectId of the user for whom to generate the account
            statement
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
          example: 64f0c51e7fb3fc001234a001
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateAccountStatementRequest'
            examples:
              withDateRange:
                summary: With optional date range
                value:
                  start: '2024-01-01'
                  end: '2024-12-31'
              empty:
                summary: All activity (no date filter)
                value: {}
      responses:
        '200':
          description: Account statement generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateAccountStatementResponse'
              example:
                fileUri: >-
                  https://account-statements.r2.cloudflarestorage.com/64f0c51e7fb3fc001234a001/statement.pdf?X-Amz-...
        '400':
          $ref: '#/components/responses/BadRequestError'
          content:
            application/json:
              examples:
                invalidDateRange:
                  summary: Start date after end date
                  value:
                    status: 400
                    error:
                      message: >-
                        Validation failed: [{"path":"start","message":"Start
                        date must be before or equal to end date"}]
                    responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
                noAddress:
                  summary: User has no address on file
                  value:
                    status: 400
                    error:
                      message: >-
                        User must have an address on file to generate account
                        statements
                    responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
        '401':
          $ref: '#/components/responses/UnauthorizedError'
components:
  schemas:
    GenerateAccountStatementRequest:
      type: object
      description: >-
        Optional date range for the account statement. If omitted, includes all
        available activity.
      properties:
        start:
          type: string
          format: date
          description: >-
            Start date for the statement period (inclusive). ISO 8601 date
            format (YYYY-MM-DD).
          example: '2024-01-01'
        end:
          type: string
          format: date
          description: >-
            End date for the statement period (inclusive). ISO 8601 date format
            (YYYY-MM-DD).
          example: '2024-12-31'
      additionalProperties: false
    GenerateAccountStatementResponse:
      type: object
      required:
        - fileUri
      properties:
        fileUri:
          type: string
          format: uri
          description: >-
            Pre-signed URL to download the generated PDF account statement. The
            URL is temporary and expires after a short period.
          example: >-
            https://account-statements.r2.cloudflarestorage.com/64f0c51e7fb3fc001234a001/statement.pdf?X-Amz-...
      additionalProperties: false
    ApiErrorResponse:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message
            description:
              type: string
              description: Additional error details
              nullable: true
        responseId:
          type: string
          format: uuid
          description: Unique identifier for this error response
      additionalProperties: false
  responses:
    BadRequestError:
      description: Validation failure or business rule violation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            invalidEmail:
              summary: Invalid email format
              value:
                status: 400
                error:
                  message: Invalid email address format
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
            missingFields:
              summary: Missing required fields
              value:
                status: 400
                error:
                  message: 'Missing required fields: firstName, lastName'
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
            addressCountryMismatch:
              summary: Address country code mismatch
              value:
                status: 400
                error:
                  message: Address countryCode must match residencyCountry
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
    UnauthorizedError:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            status: 401
            error:
              message: Unauthorized - Invalid or missing authentication token
            responseId: 145f2b0d-1d5b-4e91-8d0d-7af0ae9ad13a
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Auth0-issued access token that includes the scopes listed for the
        endpoint.

````