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

# TAM Builder

> Build your TAM (Total Addressable Market) from a natural-language query.

<Info>**No API key yet?** [Sign up via Agent Auth](/agent-auth/agent-auth/agent-sign-up) to get your `X-API-Key` - the only required header for this endpoint.</Info>

## Input
Provide a single natural-language description of your TAM.

Examples:
- Build my TAM for cloud observability and monitoring tools
- Build my TAM for hospitals and health systems in the US.
- Build my TAM for neobanks and digital banks worldwide.
- Build my TAM for B2B SaaS companies, Series B+, in North America.
- Build my TAM for home service companies serving primarily residential customers.

## Results
The endpoint immediately returns a `job_id`. Poll `GET /api/v1/tam/build/{job_id}` until `status` is `completed`, then walk the result pages using `next_cursor`.

## Cancelling a job
If you need to stop a running or pending job early, call `POST /api/v1/tam/build/{job_id}/cancel`. The job moves to a transient `cancelling` state and stops at its next checkpoint; whatever companies were already delivered stay readable via the poll endpoint, and you are charged only for the delivered companies.

## Pausing and resuming a job
If you need to pause a running or pending job, call `POST /api/v1/tam/build/{job_id}/pause`. The job moves to a transient `pausing` state, the in-flight process finishes and is written, then it settles to `paused`. Delivered companies stay readable via the poll endpoint, and you are charged only for what's been delivered so far.

To resume a paused job, call the `POST /api/v1/tam/build/{job_id}/resume` endpoint. It will continue from the checkpoint where it was paused, only new companies delivered are charged.



## OpenAPI

````yaml agent-primitives/openapi.json POST /api/v1/tam/build
openapi: 3.1.0
info:
  title: OpenFunnel Agent Primitives
  version: 1.0.0
servers:
  - url: https://api.openfunnel.dev
security: []
paths:
  /api/v1/tam/build:
    post:
      tags:
        - TAM Builder
      summary: TAM Builder
      description: >-
        Build your TAM (Total Addressable Market) from a natural-language query.


        <Info>**No API key yet?** [Sign up via Agent
        Auth](/agent-auth/agent-auth/agent-sign-up) to get your `X-API-Key` -
        the only required header for this endpoint.</Info>


        ## Input

        Provide a single natural-language description of your TAM.


        Examples:

        - Build my TAM for cloud observability and monitoring tools

        - Build my TAM for hospitals and health systems in the US.

        - Build my TAM for neobanks and digital banks worldwide.

        - Build my TAM for B2B SaaS companies, Series B+, in North America.

        - Build my TAM for home service companies serving primarily residential
        customers.


        ## Results

        The endpoint immediately returns a `job_id`. Poll `GET
        /api/v1/tam/build/{job_id}` until `status` is `completed`, then walk the
        result pages using `next_cursor`.


        ## Cancelling a job

        If you need to stop a running or pending job early, call `POST
        /api/v1/tam/build/{job_id}/cancel`. The job moves to a transient
        `cancelling` state and stops at its next checkpoint; whatever companies
        were already delivered stay readable via the poll endpoint, and you are
        charged only for the delivered companies.


        ## Pausing and resuming a job

        If you need to pause a running or pending job, call `POST
        /api/v1/tam/build/{job_id}/pause`. The job moves to a transient
        `pausing` state, the in-flight process finishes and is written, then it
        settles to `paused`. Delivered companies stay readable via the poll
        endpoint, and you are charged only for what's been delivered so far.


        To resume a paused job, call the `POST
        /api/v1/tam/build/{job_id}/resume` endpoint. It will continue from the
        checkpoint where it was paused, only new companies delivered are
        charged.
      parameters:
        - name: X-API-Key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TamBuildRequest'
      responses:
        '200':
          description: Job accepted. Returns a `job_id` to poll for status and results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TamBuildSubmitResponse'
              example:
                job_id: 8a8e8a97-8192-48ff-849a-d8a96e949732
                status: pending
                message: >-
                  TAM build started. Poll GET
                  /api/v1/tam/build/8a8e8a97-8192-48ff-849a-d8a96e949732 for
                  status and results.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit reached for this API key or user.
        '503':
          description: >-
            Bulk lookalike search is temporarily unavailable. Please try again
            shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableResponse'
components:
  schemas:
    TamBuildRequest:
      type: object
      title: TamBuildRequest
      description: Request body for the async TAM Builder.
      required:
        - query
      properties:
        query:
          type: string
          minLength: 1
          maxLength: 500
          title: Query
          description: >-
            Natural-language description of the market to build (e.g. 'cloud
            observability and monitoring tools').
    TamBuildSubmitResponse:
      type: object
      title: TamBuildSubmitResponse
      description: Returned immediately when a TAM build job is submitted.
      required:
        - job_id
        - message
      properties:
        job_id:
          type: string
          title: Job Id
          description: >-
            Async job id. Poll `GET /api/v1/tam/build/{job_id}` for status and
            results.
        status:
          type: string
          default: pending
          title: Status
          description: Job status at submit time (always `pending`).
        message:
          type: string
          title: Message
          description: Human-readable next-step hint.
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ServiceUnavailableResponse:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable explanation of why the service is unavailable.
      title: ServiceUnavailableResponse
    ValidationError:
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string

````