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

# Get Team Dashboard

> Aggregate payload for the team dashboard page paint.

Pillar 2 of the pool-exhaustion fix (`docs/plans/2026-05-04-permanent-
pool-exhaustion-fix.md`): replaces 5–7 parallel GETs (team, tasks,
activity, strategy/history, strategy/briefs, canvas/layout) with one
handler / one session. Sub-queries are issued via `asyncio.gather` so
the connection holds for the longest sub-query, not the sum.

Optimization (per pre-flight audit): `team_service.get_team()` is
called ONCE here and the loaded ORM row is the only authoritative
ownership check — the per-resource code paths re-fetch the team
today, which is wasted I/O on the hot path.



## OpenAPI

````yaml /openapi.json get /api/v1/teams/{team_id}/dashboard
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/teams/{team_id}/dashboard:
    get:
      tags:
        - Teams
      summary: Get Team Dashboard
      description: |-
        Aggregate payload for the team dashboard page paint.

        Pillar 2 of the pool-exhaustion fix (`docs/plans/2026-05-04-permanent-
        pool-exhaustion-fix.md`): replaces 5–7 parallel GETs (team, tasks,
        activity, strategy/history, strategy/briefs, canvas/layout) with one
        handler / one session. Sub-queries are issued via `asyncio.gather` so
        the connection holds for the longest sub-query, not the sum.

        Optimization (per pre-flight audit): `team_service.get_team()` is
        called ONCE here and the loaded ORM row is the only authoritative
        ownership check — the per-resource code paths re-fetch the team
        today, which is wasted I/O on the hot path.
      operationId: get_team_dashboard_api_v1_teams__team_id__dashboard_get
      parameters:
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Team Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamDashboardResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    TeamDashboardResponse:
      properties:
        team:
          $ref: '#/components/schemas/TeamDetailResponse'
        tasks:
          $ref: '#/components/schemas/TeamTaskListResponse'
        activity:
          $ref: '#/components/schemas/TeamActivityResponse'
        strategy_history:
          $ref: '#/components/schemas/StrategyHistoryResponse'
        strategy_briefs:
          $ref: '#/components/schemas/StrategyBriefHistoryListResponse'
        canvas_layout:
          additionalProperties: true
          type: object
          title: Canvas Layout
      type: object
      required:
        - team
        - tasks
        - activity
        - strategy_history
        - strategy_briefs
        - canvas_layout
      title: TeamDashboardResponse
      description: |-
        Aggregate payload for the team dashboard page paint.

        Replaces 5–7 parallel GETs with one handler/one session. Each sub-key
        matches the existing per-resource endpoint payload verbatim so the
        frontend can keep using its current types.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TeamDetailResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        team_type:
          type: string
          title: Team Type
        display_name:
          type: string
          title: Display Name
        status:
          type: string
          title: Status
        workflow_phase:
          type: string
          title: Workflow Phase
          default: onboarding
        workflow_phase_label:
          type: string
          title: Workflow Phase Label
          default: Setting Up
        tier:
          type: string
          title: Tier
        operation_mode:
          type: string
          title: Operation Mode
        trigger_mode:
          type: string
          title: Trigger Mode
          default: strategy-driven
        default_currency:
          type: string
          title: Default Currency
          default: USD
        auto_config:
          additionalProperties: true
          type: object
          title: Auto Config
          default: {}
        orchestrator_cadence:
          additionalProperties: true
          type: object
          title: Orchestrator Cadence
          default: {}
        content_strategy:
          additionalProperties: true
          type: object
          title: Content Strategy
          default: {}
        stripe_subscription_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Stripe Subscription Id
        config:
          additionalProperties: true
          type: object
          title: Config
          default: {}
        onboarding_step:
          type: string
          title: Onboarding Step
          default: pending
        connected_accounts:
          items:
            type: string
          type: array
          title: Connected Accounts
          default: []
        brand_kit_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Brand Kit Id
        brand_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Brand Id
        brand_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand Name
        hired_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Hired At
        paused_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Paused At
        cancelled_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Cancelled At
        subscription_ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Subscription Ends At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        members:
          items:
            $ref: '#/components/schemas/TeamMemberResponse'
          type: array
          title: Members
        recent_activity:
          items:
            $ref: '#/components/schemas/TeamAuditLogResponse'
          type: array
          title: Recent Activity
          default: []
        content_cadence:
          items:
            $ref: '#/components/schemas/CadenceStreamResponse'
          type: array
          title: Content Cadence
          default: []
        my_role:
          anyOf:
            - type: string
            - type: 'null'
          title: My Role
      type: object
      required:
        - id
        - team_type
        - display_name
        - status
        - tier
        - operation_mode
        - created_at
        - updated_at
        - members
      title: TeamDetailResponse
    TeamTaskListResponse:
      properties:
        tasks:
          items:
            $ref: '#/components/schemas/TeamTaskResponse'
          type: array
          title: Tasks
        total:
          type: integer
          title: Total
      type: object
      required:
        - tasks
        - total
      title: TeamTaskListResponse
    TeamActivityResponse:
      properties:
        activity:
          items:
            $ref: '#/components/schemas/TeamAuditLogResponse'
          type: array
          title: Activity
        total:
          type: integer
          title: Total
      type: object
      required:
        - activity
        - total
      title: TeamActivityResponse
    StrategyHistoryResponse:
      properties:
        strategies:
          items:
            $ref: '#/components/schemas/CycleStrategyResponse'
          type: array
          title: Strategies
      type: object
      required:
        - strategies
      title: StrategyHistoryResponse
    StrategyBriefHistoryListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/StrategyBriefHistoryItem'
          type: array
          title: Items
      type: object
      required:
        - items
      title: StrategyBriefHistoryListResponse
    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
    TeamMemberResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        role:
          type: string
          title: Role
        agent_slug:
          type: string
          title: Agent Slug
        display_name:
          type: string
          title: Display Name
        capabilities:
          items:
            type: string
          type: array
          title: Capabilities
        hired_agent_id:
          type: string
          format: uuid
          title: Hired Agent Id
        current_activity:
          additionalProperties: true
          type: object
          title: Current Activity
          default: {}
        persona_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Persona Name
          description: Derive persona_name from the hired_agent relationship.
          readOnly: true
        agent_classes:
          items:
            type: string
          type: array
          title: Agent Classes
          description: >-
            AgentClass taxonomy (analyst / creator / platform_specialist /

            orchestrator / evaluator) derived from the canonical class map.


            Surfaced in the API response so the frontend Office Space canvas

            can enforce the rule: Platform cards attach only to members

            classed ``platform_specialist``. Looking up via
            ``hired_agent.agent_type``

            rather than ``agent_slug`` because team-member slug can differ

            from the underlying agent_type (e.g. slug "blog-publisher" →

            agent_type "blog-specialist").
          readOnly: true
      type: object
      required:
        - id
        - role
        - agent_slug
        - display_name
        - capabilities
        - hired_agent_id
        - persona_name
        - agent_classes
      title: TeamMemberResponse
    TeamAuditLogResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        action_type:
          type: string
          title: Action Type
        description:
          type: string
          title: Description
        details:
          additionalProperties: true
          type: object
          title: Details
        source:
          type: string
          title: Source
        severity:
          type: string
          title: Severity
        member_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Member Id
        team_task_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Team Task Id
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - action_type
        - description
        - details
        - source
        - severity
        - member_id
        - team_task_id
        - created_at
      title: TeamAuditLogResponse
    CadenceStreamResponse:
      properties:
        label:
          type: string
          title: Label
        cadence:
          type: string
          title: Cadence
        schedule_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Schedule Type
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
      type: object
      required:
        - label
        - cadence
      title: CadenceStreamResponse
      description: >-
        One human-readable Content-Cadence row for the Team Settings card.


        Derived read-time from the team's work loops (see

        ``app.services.cadence_display.derive_cadence_streams``) — NOT from the

        collapsed, load-bearing ``orchestrator_cadence`` dict. ``label`` is the

        loop name (plus a ``— Posts`` / ``— Guides`` source sub-label when two

        distribution loops share a name); ``cadence`` is the human cadence
        string

        ("Daily", "Every 3 days", "When triggered", …) — never a raw mode token.
    TeamTaskResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        task_type:
          type: string
          title: Task Type
        title:
          type: string
          title: Title
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        status:
          type: string
          title: Status
        priority:
          type: string
          title: Priority
        input_data:
          additionalProperties: true
          type: object
          title: Input Data
          default: {}
        output_data:
          additionalProperties: true
          type: object
          title: Output Data
          default: {}
        quality_score:
          anyOf:
            - type: number
            - type: 'null'
          title: Quality Score
        evaluation_notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Evaluation Notes
        scheduled_for:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Scheduled For
        platform:
          anyOf:
            - type: string
            - type: 'null'
          title: Platform
        publish_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Publish Url
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published At
        revision_count:
          type: integer
          title: Revision Count
        max_revisions:
          type: integer
          title: Max Revisions
        assigned_member_id:
          type: string
          format: uuid
          title: Assigned Member Id
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - id
        - task_type
        - title
        - description
        - status
        - priority
        - quality_score
        - evaluation_notes
        - scheduled_for
        - platform
        - publish_url
        - published_at
        - revision_count
        - max_revisions
        - assigned_member_id
        - started_at
        - completed_at
        - created_at
      title: TeamTaskResponse
    CycleStrategyResponse:
      properties:
        cycle_instance_id:
          type: string
          format: uuid
          title: Cycle Instance Id
        instance_number:
          type: integer
          title: Instance Number
        strategy_status:
          type: string
          title: Strategy Status
        strategy_revision_count:
          type: integer
          title: Strategy Revision Count
          default: 0
        content_strategy:
          additionalProperties: true
          type: object
          title: Content Strategy
        start_date:
          type: string
          format: date-time
          title: Start Date
        end_date:
          type: string
          format: date-time
          title: End Date
      type: object
      required:
        - cycle_instance_id
        - instance_number
        - strategy_status
        - start_date
        - end_date
      title: CycleStrategyResponse
    StrategyBriefHistoryItem:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
        cycle_instance_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Cycle Instance Id
        brief_preview:
          type: string
          title: Brief Preview
      type: object
      required:
        - id
        - created_at
        - brief_preview
      title: StrategyBriefHistoryItem
      description: Row in the Strategy Briefs list — one per past generation.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````