> ## 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 Seo Audit History Route

> Last N SEO audit run snapshots for a brand, newest first.

Reads the append-only Phase-2 ``seo_audit_runs`` history (the
``BrandAudit`` snapshot is clobbered per re-run by design) so the report
UI can diff a re-run against the previous run instead of replacing it.
Gated on ``SEO_LONGITUDINAL_ENABLED`` (404 when off — the tables are not
being written) + brand ownership like the sibling brand-scoped routes.



## OpenAPI

````yaml /openapi.json get /api/v1/free-audits/seo-history/{brand_id}
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/free-audits/seo-history/{brand_id}:
    get:
      tags:
        - Free Audits
        - Free Audits
      summary: Get Seo Audit History Route
      description: |-
        Last N SEO audit run snapshots for a brand, newest first.

        Reads the append-only Phase-2 ``seo_audit_runs`` history (the
        ``BrandAudit`` snapshot is clobbered per re-run by design) so the report
        UI can diff a re-run against the previous run instead of replacing it.
        Gated on ``SEO_LONGITUDINAL_ENABLED`` (404 when off — the tables are not
        being written) + brand ownership like the sibling brand-scoped routes.
      operationId: >-
        get_seo_audit_history_route_api_v1_free_audits_seo_history__brand_id__get
      parameters:
        - name: brand_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Brand Id
        - name: platform
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 50
              - type: 'null'
            title: Platform
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 20
            minimum: 1
            default: 5
            title: Limit
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeoAuditHistoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SeoAuditHistoryResponse:
      properties:
        brand_id:
          type: string
          format: uuid
          title: Brand Id
        runs:
          items:
            $ref: '#/components/schemas/SeoAuditHistoryRun'
          type: array
          title: Runs
      type: object
      required:
        - brand_id
      title: SeoAuditHistoryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SeoAuditHistoryRun:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        audit_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Audit Id
        created_at:
          type: string
          format: date-time
          title: Created At
        overall_score:
          anyOf:
            - type: number
            - type: 'null'
          title: Overall Score
        grade:
          anyOf:
            - type: string
            - type: 'null'
          title: Grade
        scoring_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Scoring Version
        category_scores:
          additionalProperties:
            type: number
          type: object
          title: Category Scores
        issue_count:
          type: integer
          title: Issue Count
          default: 0
        critical_count:
          type: integer
          title: Critical Count
          default: 0
        issues:
          items:
            $ref: '#/components/schemas/SeoAuditHistoryIssue'
          type: array
          title: Issues
      type: object
      required:
        - id
        - created_at
      title: SeoAuditHistoryRun
      description: >-
        One immutable ``SeoAuditRun`` serialised for trend/delta consumers.


        Scores normally require matching ``scoring_version`` values (NULL vs a

        named version is incomparable). Historical v3 is quarantined even
        against

        itself because that label spans two models; issue codes still diff
        freely.

        See ``services/seo_score_comparability.py``.
    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
    SeoAuditHistoryIssue:
      properties:
        code:
          type: string
          title: Code
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        severity:
          type: string
          title: Severity
        affected_pages:
          type: integer
          title: Affected Pages
          default: 0
        impact:
          anyOf:
            - $ref: '#/components/schemas/AuditImpact'
            - type: 'null'
      type: object
      required:
        - code
        - severity
      title: SeoAuditHistoryIssue
      description: One issue in a historical run snapshot — identity is the stable code.
    AuditImpact:
      properties:
        value:
          type: number
          exclusiveMinimum: 0
          title: Value
        unit:
          type: string
          enum:
            - milliseconds
            - monthly_organic_visits
          title: Unit
      additionalProperties: false
      type: object
      required:
        - value
        - unit
      title: AuditImpact
      description: A positive, finite quantity attached to one audit finding.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````