> ## 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.

# Get the Agency workspace

> Workspace identity, the caller's role, remaining shared project quota, and one page of the workspace's client reports - dashboard-created ones included, newest first, without report bodies. Consultant and AppSumo Agency accounts only: a key whose account holds no Agency workspace, or whose membership was removed, gets 404 AGENCY_NOT_FOUND on the next call. Membership is resolved live on every request, independently of the key.




## OpenAPI

````yaml /api-reference/openapi.yaml get /api/agent/agency
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/agency:
    get:
      tags:
        - Agency
      summary: Get the Agency workspace
      description: >
        Workspace identity, the caller's role, remaining shared project quota,
        and one page of the workspace's client reports - dashboard-created ones
        included, newest first, without report bodies. Consultant and AppSumo
        Agency accounts only: a key whose account holds no Agency workspace, or
        whose membership was removed, gets 404 AGENCY_NOT_FOUND on the next
        call. Membership is resolved live on every request, independently of the
        key.
      operationId: getAgency
      parameters:
        - name: limit
          in: query
          required: false
          description: Client reports to return in the reports array.
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 20
        - name: offset
          in: query
          required: false
          description: Paging offset into the reports array.
          schema:
            type: integer
            minimum: 0
            maximum: 10000
            default: 0
      responses:
        '200':
          description: Workspace, role, quota, and one page of client reports.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgencyContext'
        '400':
          description: limit must be 1-50 and offset 0-10000 (INVALID_PAGINATION).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >
            Key does not carry agency:read (INSUFFICIENT_SCOPE) or the account
            is suspended (ACCOUNT_SUSPENDED). agency:write does not imply it.
            Keys created before 2026-09-09 predate both Agency scopes and always
            fail this check - see the AgencyInsufficientScope response for the
            recovery and the condition on each of its two routes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          $ref: '#/components/responses/AgencyNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    AgencyContext:
      type: object
      properties:
        agency:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
            role:
              type: string
              description: The calling account's role in the workspace.
        quota:
          $ref: '#/components/schemas/AgencyQuota'
        canRunScan:
          type: boolean
          description: >
            Eligibility, not live availability. True only when the role may run
            scans, the workspace is approved, billing setup is done, and quota
            remains. It does not read the service kill switch, the LLM pause or
            the rate limiters, so a start can still answer 503 or 429 while this
            is true. None of those refusals spends a project credit.
        reports:
          type: array
          description: >
            One page of the workspace's client reports, newest first, including
            ones created in the Agency dashboard. Same shape and paging as
            /api/agent/agency/reports.
          items:
            $ref: '#/components/schemas/AgencyReportListItem'
        nextOffset:
          type:
            - integer
            - 'null'
          description: |
            Offset of the next page of reports, or null on the last page.
    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'
    AgencyQuota:
      type: object
      description: Shared project quota for the workspace, same pool as the dashboard.
      properties:
        plan:
          type: string
        isActiveSubscription:
          type: boolean
        trialLimit:
          type: integer
        trialUsed:
          type: integer
        trialExpired:
          type: boolean
        delinquent:
          type: boolean
        monthlyLimit:
          type: integer
        monthlyUsed:
          type: integer
        monthlyRemaining:
          type: integer
        topupRemaining:
          type: integer
        totalRemaining:
          type: integer
        requiresPaymentSetup:
          type: boolean
        canScan:
          type: boolean
        nextResetAt:
          type:
            - string
            - 'null'
          format: date-time
    AgencyReportListItem:
      type: object
      description: One client report in the workspace, without its payload.
      properties:
        reportId:
          type: string
        title:
          type:
            - string
            - 'null'
        status:
          type: string
        scanType:
          type: string
          enum:
            - starter
            - deep
        createdAt:
          type: string
          format: date-time
        reportUrl:
          type: string
          format: uri
    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.
  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'
    AgencyNotFound:
      description: >
        No Agency workspace on this account, or workspace membership was removed
        (AGENCY_NOT_FOUND). Membership is resolved live on every call.
      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.