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

# Enrich an analysis

> Idempotently generates the missing core export sections for a COMPLETED run THIS API started. A report created on the preuve.ai dashboard is refused with 403 REPORT_NOT_FROM_AGENT_RUN, like the export: polling resolves it, generating against it does not. Optionally starts deep-only modules via body.modules (one successful generation per module per report). founderFit runs inline and underwrites against the founder profile saved on preuve.ai when founderProfile is omitted (an explicit payload overrides it); the other modules run async - poll get_analysis. Partial failures return HTTP 207 with a success-shaped body.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/agent/analyses/{id}/enrich
openapi: 3.1.0
info:
  title: Preuve Agent API
  version: '2.0'
  summary: Startup idea validation for AI agents and scripts.
  description: >
    API for programmatic startup idea validation: a 0-100 viability score,
    competitors, market sizing and source-linked evidence from 60+ live sources.
    Every request carries a single x-preuve-key header holding the whole API key
    - no signing, no bearer token. See the Authentication guide.


    Every response is JSON, errors included: an unknown route answers 404 with
    the same { error, code } envelope as every other failure, so branch on code
    and never parse a message. Error codes are stable and retired ones stay
    listed on the Errors page. scanType "starter" costs nothing and returns a
    real report, which makes it the sandbox: an agent can exercise the whole
    create - poll - enrich - export loop without spending a cent. GET /api/agent
    is the unauthenticated discovery document.
  termsOfService: https://preuve.ai/terms
  contact:
    name: Preuve AI developer support
    url: https://preuve.ai/support
    email: hello@preuve.ai
servers:
  - url: https://preuve.ai
security:
  - preuveKey: []
tags:
  - name: Discovery
    description: Unauthenticated documents that describe the API itself.
  - name: Analyses
    description: One idea at a time - create, poll, enrich, export.
  - name: Batches
    description: Up to five analyses in one idempotent batch.
  - name: Tools
    description: Utilities that spend no scan quota.
  - name: Agency
    description: >-
      Client work on a Consultant or Agency workspace (agency:read /
      agency:write).
externalDocs:
  description: Developer docs - quickstart, authentication, quotas, error codes
  url: https://docs.preuve.ai/
paths:
  /api/agent/analyses/{id}/enrich:
    post:
      tags:
        - Analyses
      summary: Enrich an analysis
      description: >
        Idempotently generates the missing core export sections for a COMPLETED
        run THIS API started. A report created on the preuve.ai dashboard is
        refused with 403 REPORT_NOT_FROM_AGENT_RUN, like the export: polling
        resolves it, generating against it does not. Optionally starts deep-only
        modules via body.modules (one successful generation per module per
        report). founderFit runs inline and underwrites against the founder
        profile saved on preuve.ai when founderProfile is omitted (an explicit
        payload overrides it); the other modules run async - poll get_analysis.
        Partial failures return HTTP 207 with a success-shaped body.
      operationId: enrichAnalysis
      parameters:
        - $ref: '#/components/parameters/AnalysisId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnrichRequest'
      responses:
        '200':
          description: Enrichment (and any inline module) completed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnrichResponse'
        '207':
          description: >-
            Partial success - some sections or modules failed; inspect failures
            and modules.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnrichResponse'
        '400':
          description: >-
            Invalid modules or founderProfile (INVALID_MODULES,
            INVALID_FOUNDER_PROFILE).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >
            Modules requested on a non-deep report (MODULES_REQUIRE_DEEP), the
            key lacks analysis:write (INSUFFICIENT_SCOPE), or the report was
            created on the preuve.ai dashboard (REPORT_NOT_FROM_AGENT_RUN).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: Analysis not complete yet (ANALYSIS_NOT_COMPLETE).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '422':
          description: >
            The run is FAILED, so there is nothing to enrich (ANALYSIS_FAILED).
            Terminal for this id - start a new run rather than retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    AnalysisId:
      name: id
      in: path
      required: true
      description: >
        Run id (returned by create) or report id. What resolves differs per
        route: the poll also accepts any personal starter or deep report the
        account owns, including dashboard-created ones (the UUID in
        /app/results?id=...), while export and enrich serve analyses this API
        started. See each operation.
      schema:
        type: string
        format: uuid
  schemas:
    EnrichRequest:
      type: object
      properties:
        modules:
          type: array
          description: Deep-only modules to generate. Omit for core enrichment only.
          items:
            type: string
            enum:
              - proofOfDemand
              - founderFit
              - playbook
              - trends
              - community
        founderProfile:
          $ref: '#/components/schemas/FounderProfile'
      example:
        modules:
          - founderFit
          - playbook
        founderProfile:
          hoursPerWeek: 20
          runwayMonths: 6
          domainYears: 3
          shippedBefore: side_project
          audienceSize: under_1k
          teamStatus: solo
    EnrichResponse:
      type: object
      properties:
        analysis:
          $ref: '#/components/schemas/AnalysisRun'
        enrichment:
          $ref: '#/components/schemas/EnrichmentState'
        failures:
          type: array
          description: Core sections that failed this pass. Retry by calling enrich again.
          items:
            type: object
        modules:
          type:
            - object
            - 'null'
          description: Per-module results for the modules requested in this call.
          additionalProperties:
            $ref: '#/components/schemas/ModuleResult'
    ApiError:
      type: object
      required:
        - error
        - code
      description: >
        Every error, on every route, unknown paths included. Some codes add
        top-level context fields (limit, tokenBalance, resetAt, upsell, ...); a
        404 NOT_FOUND on an unknown route adds details.discovery,
        details.openapi and details.docs so the caller can recover.
      properties:
        error:
          type: string
          description: Human-readable message. Prose; it changes.
        code:
          type: string
          description: Stable machine-readable code. Branch on this.
        details:
          description: >
            Optional context. An object on most codes (limits, recovery links,
            the method and path of a 404); an array of strings where the route
            forwards a validator's messages, as enrich does on
            INVALID_FOUNDER_PROFILE. Read it, never branch on it - `code` is the
            contract.
          oneOf:
            - type: object
              additionalProperties: true
            - type: array
              items:
                type: string
        limit:
          type: integer
          description: >
            The ceiling that was hit, in the unit the code implies: bytes on
            PAYLOAD_TOO_LARGE, runs in flight on CONCURRENT_LIMIT_REACHED,
            requests in the window on a rate limit.
        remaining:
          type: integer
          description: Requests left in the current window.
        resetAt:
          type: string
          format: date-time
          description: >
            When the window that refused this request reopens. Present on
            DAILY_LIMIT_REACHED from run creation (the idea generator's rolling
            ceiling sends only limit); prefer it over the Retry-After header
            when both are present, since it is absolute.
        tokenBalance:
          type: integer
          description: >-
            Deep-scan credits left on the account. Present on
            INSUFFICIENT_TOKENS.
        scansUsed:
          type: integer
        scansRemaining:
          type: integer
        limitType:
          type: string
          description: Which ceiling refused an AppSumo-backed account.
        upgradeHint:
          type: string
          description: What to change to get past this refusal. Prose, not a contract.
        paused:
          type: boolean
          description: >
            Present only on the LLM-pause 503, where the body is exactly {
            error, code, paused }.
        upsell:
          $ref: '#/components/schemas/ExportUpsell'
    FounderProfile:
      type: object
      required:
        - hoursPerWeek
        - runwayMonths
        - domainYears
        - shippedBefore
        - audienceSize
        - teamStatus
      properties:
        hoursPerWeek:
          type: number
          minimum: 1
          maximum: 168
        runwayMonths:
          type: number
          minimum: 0
          maximum: 120
        domainYears:
          type: number
          minimum: 0
          maximum: 60
        shippedBefore:
          type: string
          enum:
            - never
            - side_project
            - launched
        audienceSize:
          type: string
          enum:
            - none
            - under_1k
            - 1k_10k
            - over_10k
        teamStatus:
          type: string
          enum:
            - solo
            - cofounded_friends
            - cofounded_colleagues
            - team_with_hires
        twelveMonthGoal:
          type: string
          enum:
            - replace_income
            - side_income
            - vc_scale
        sabotagePattern:
          type: string
          maxLength: 280
    AnalysisRun:
      type: object
      properties:
        id:
          type: string
          format: uuid
        reportId:
          type:
            - string
            - 'null'
          format: uuid
          description: >
            Null until the report row is attached, which is why a run that
            failed before dispatch is retryable under the same clientRunId.
        clientRunId:
          type:
            - string
            - 'null'
          description: >
            The caller-chosen id from create. Null when the analysis is a
            dashboard-created report resolved by its report id: no run row
            exists, so there is no clientRunId to replay.
        batchId:
          type:
            - string
            - 'null'
          format: uuid
          description: The batch this run belongs to, or null for a standalone run.
        scanType:
          type: string
          enum:
            - starter
            - deep
          description: Your request type. Reliable from creation, even while PROCESSING.
        enrichmentMode:
          type: string
          enum:
            - core
            - none
        publish:
          type: boolean
        reportType:
          type:
            - string
            - 'null'
          enum:
            - quick
            - deep_dive
            - null
        analysisTier:
          type:
            - string
            - 'null'
          enum:
            - basic
            - advanced
            - null
          description: >-
            Derived from the report. Deep runs read "basic" until deep sections
            land.
        status:
          type: string
          enum:
            - PENDING
            - PROCESSING
            - COMPLETED
            - FAILED
        progressStep:
          type:
            - string
            - 'null'
          description: Free-text pipeline stage while PROCESSING.
        errorCode:
          type:
            - string
            - 'null'
          description: >
            Set on a FAILED run. Two internal markers are deliberately rewritten
            before they leave: an ambiguous dispatch reports
            TRIGGER_DISPATCH_FAILED and an ambiguous claim refund reports
            REPORT_CREATE_FAILED.
        errorMessage:
          type:
            - string
            - 'null'
        resetAt:
          type: string
          format: date-time
          description: >
            Present only on a batch item refused by the rolling daily cap;
            absent, not null, on every other run.
        pollAfterSeconds:
          type: integer
          description: >
            Present only while polling is still useful. Pace by this rather than
            by a fixed interval.
        pollHint:
          type: string
          description: Present alongside pollAfterSeconds.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        readyForExport:
          type: boolean
          description: >
            Whether GET /export will serve this analysis now. Always false for a
            report created on the preuve.ai dashboard, whatever state the report
            is in, because that export answers 403 REPORT_NOT_FROM_AGENT_RUN.
            Branch on exportable first.
        exportable:
          type: boolean
          description: >
            Present, and false, only on a report created on the preuve.ai
            dashboard. Absent means the ordinary contract applies and
            readyForExport is the gate. When it is false, no amount of polling
            or enriching changes it.
        exportBlockedCode:
          type: string
          enum:
            - REPORT_NOT_FROM_AGENT_RUN
          description: Present alongside exportable, naming the refusal.
        exportBlockedHint:
          type: string
          description: Present alongside exportable. Relayable prose.
        enrichment:
          $ref: '#/components/schemas/EnrichmentState'
        modules:
          type:
            - object
            - 'null'
          description: Per-module statuses. Deep reports only; null on free runs.
          properties:
            proofOfDemand:
              $ref: '#/components/schemas/ModuleStatus'
            founderFit:
              $ref: '#/components/schemas/ModuleStatus'
            playbook:
              $ref: '#/components/schemas/ModuleStatus'
            trends:
              $ref: '#/components/schemas/ModuleStatus'
            community:
              $ref: '#/components/schemas/ModuleStatus'
        reportUrl:
          type:
            - string
            - 'null'
          format: uri
          description: Null until the report row exists.
        shareUrl:
          type:
            - string
            - 'null'
          format: uri
    EnrichmentState:
      type: object
      description: >
        Progress of the core export sections. The four name arrays partition
        `required`, so a poller decides what to do next by reading them rather
        than by parsing `status`: anything in processing means keep polling,
        anything in failed means call enrich again, and missing with nothing
        processing means enrichment was never started for it.
      properties:
        mode:
          type: string
          enum:
            - core
            - none
        status:
          type: string
          enum:
            - not_required
            - pending
            - processing
            - partial
            - completed
            - failed
          description: >
            Rolled up from the arrays below. "partial" means some sections
            landed and others did not; "not_required" is mode "none", or a
            report with no required sections.
        required:
          type: array
          description: >-
            Every section this report and mode need. The other four arrays
            partition it.
          items:
            type: string
        completed:
          type: array
          items:
            type: string
        missing:
          type: array
          description: Required, not generated, and not currently being generated.
          items:
            type: string
        processing:
          type: array
          description: >-
            Generation is in flight. Keep polling rather than calling enrich
            again.
          items:
            type: string
        failed:
          type: array
          description: >-
            Generation was attempted and failed. Retryable by calling enrich
            again.
          items:
            type: string
        sections:
          type: object
          description: >
            Per-section detail, keyed by section name, for every entry in
            required. Each value carries at least a status matching the array
            the section is in, plus completedAt on a completed section and
            whatever the last attempt recorded on a failed one.
          additionalProperties:
            type: object
            properties:
              status:
                type: string
                enum:
                  - missing
                  - processing
                  - completed
                  - failed
                  - pending
              completedAt:
                type:
                  - string
                  - 'null'
                format: date-time
            additionalProperties: true
    ModuleResult:
      type: object
      properties:
        ok:
          type: boolean
        status:
          type: integer
          description: >-
            Per-module HTTP-style status (200 inline success, 202 accepted, 409
            cap, ...).
        code:
          type:
            - string
            - 'null'
        state:
          type: string
          enum:
            - not_generated
            - generating
            - failed
            - completed
        alreadyStarted:
          type: boolean
          description: True when a generation started elsewhere was already in flight.
        retryable:
          type: boolean
          description: True when the failure did not consume the one-per-module cap.
        hint:
          type: string
          description: >
            Guidance worth relaying for this outcome (e.g. the 409 cap points to
            export_analysis; accepted async modules point to get_analysis).
    ExportUpsell:
      type: object
      description: >
        Purchase context for a locked export or buyable quota refusal. Export
        upsells are free-owner only; a paid non-regional caller may receive a
        scan_pack top-up on INSUFFICIENT_TOKENS. Ignore it if you only need the
        data contract.
      properties:
        offer:
          type: string
          enum:
            - founder_report
            - scan_pack
          description: >
            "founder_report" is the $59 one-time tier. "scan_pack" is a top-up
            for an account that already bought and has no deep credits left.
        price:
          type: string
          description: Display price text, e.g. "$59 one-time".
        guarantee:
          type: string
          description: >
            Guarantee text for offer=founder_report. Omitted for scan_pack
            top-ups; an empty string is never used.
        url:
          type: string
          format: uri
          description: Purchase or report URL, with attribution query parameters.
        locked:
          type: array
          description: >
            Section names the offer covers. Distinct from the top-level locked
            object, which names response FIELDS.
          items:
            type: string
        note:
          type: string
          description: The same facts as one sentence, for a client that relays text.
    ModuleStatus:
      type: object
      properties:
        status:
          type: string
          enum:
            - not_generated
            - generating
            - failed
            - completed
  responses:
    Unauthorized:
      description: >
        Missing x-preuve-key header (MISSING_API_KEY), or a malformed, unknown
        or revoked key (INVALID_AGENT_KEY - the same envelope for all three, on
        purpose). Repeated failures are throttled per IP and answer 429.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: >
        Unknown id, or the resource belongs to another account. The code names
        what was looked up: ANALYSIS_NOT_FOUND on the analysis routes,
        BATCH_NOT_FOUND on the batch ones. The analysis routes also answer
        REPORT_DELETED when the run exists but its report was deleted from the
        dashboard: nothing is left to poll, enrich or export.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    PayloadTooLarge:
      description: >
        The request body is over the 1 MB limit (PAYLOAD_TOO_LARGE, with the
        ceiling in `limit`). Counted while the body streams in and refused the
        moment it is exceeded, before any quota, token, or scan is consumed. Not
        retryable unchanged: send less, or split the work across requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RateLimited:
      description: >
        Rate limited (RATE_LIMITED or DAILY_LIMIT_REACHED). RATE_LIMITED carries
        a Retry-After header with the seconds until the window resets; the
        quota-shaped codes clear on a different clock and put resetAt in the
        body instead.
      headers:
        Retry-After:
          description: Seconds until the per-minute window resets (RATE_LIMITED only).
          schema:
            type: integer
            minimum: 1
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalError:
      description: >
        Unexpected server error (INTERNAL_ERROR, or TRIGGER_DISPATCH_FAILED when
        a deep scan could not be handed to the job runner). Never tell the user
        their quota is safe: on a deep scan the spend can already have happened
        when the failure hit, and an ambiguous dispatch deliberately keeps the
        report and its funding because the job may have been accepted before its
        response was lost. Treat consumption as unknown and retry with backoff.
        On an operation that takes a clientRunId, retry with the SAME one - that
        reconciles the original run, whatever state it reached, instead of
        starting and charging for a second one. On every other operation there
        is nothing to reconcile: the read or export simply failed, so a plain
        backed-off retry is the whole recovery.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    ServiceUnavailable:
      description: >
        A dependency was unavailable or deliberately paused (SERVICE_DISABLED,
        LLM_PAUSED, PROFILE_LOOKUP_FAILED, and the fail-closed answer when the
        rate-limit backend is down). Any authenticated route can answer this
        one: authentication meters itself through the same fail-closed limiter,
        so an outage there refuses the request before the handler runs.
        Retryable, and no paid quota, tokens, or scans were consumed - a pause
        that lands mid-run refunds the claim it had already made. Back off and
        try again rather than falling back to a different endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    preuveKey:
      type: apiKey
      in: header
      name: x-preuve-key
      description: >
        Your API key (prv_...), sent as-is. It is the only credential the API
        needs - see the Authentication guide.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.