Fern Website Sources API

Index documentation websites and check indexing job status.

OpenAPI Specification

fern-api-website-sources-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Fern Fern Ask Website Sources API
  description: The Ask Fern API is Fern's hosted, public REST surface for the "Ask Fern" AI documentation-search feature. It lets you index a documentation website and then query it programmatically, so you can build your own support integrations on top of Fern's AI-powered, docs-grounded answers. This is the primary documented hosted REST API that Fern exposes to customers; the rest of the Fern platform (SDK generation, docs generation, API-reference builds) is driven through the open-source `fern` CLI and the Fern dashboard rather than a public REST API. Requests are authenticated with a Bearer token generated by the `fern token` CLI command; the Ask Fern API is available on the Team and Enterprise plans. The website index/status endpoints are grounded in Fern's published API reference; the /ask query endpoint shape is modeled from the documented feature and should be reconciled against the live reference. Not all fields are exhaustively documented here.
  version: '1.0'
  contact:
    name: Fern
    url: https://buildwithfern.com
  license:
    name: Apache-2.0
    url: https://github.com/fern-api/fern/blob/main/LICENSE
servers:
- url: https://fai.buildwithfern.com
  description: Ask Fern API (production)
security:
- bearerAuth: []
tags:
- name: Website Sources
  description: Index documentation websites and check indexing job status.
paths:
  /sources/website/{domain}/index:
    post:
      operationId: indexWebsite
      tags:
      - Website Sources
      summary: Index a documentation website
      description: Start an indexing job that crawls and indexes the pages of a documentation website so its content can be queried through Ask Fern. Returns a job_id used to poll indexing status. (Path and body modeled from the documented feature; reconcile against the live reference.)
      parameters:
      - name: domain
        in: path
        required: true
        description: The documentation domain to index (for example, docs.example.com).
        schema:
          type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                base_url:
                  type: string
                  description: Base URL to begin crawling from.
      responses:
        '200':
          description: Indexing job accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    description: Identifier of the indexing job to poll for status.
        '401':
          $ref: '#/components/responses/Unauthorized'
  /sources/website/{domain}/status:
    get:
      operationId: getWebsiteStatus
      tags:
      - Website Sources
      summary: Get website indexing status
      description: Return the status of a website indexing job, including how many pages were indexed or failed.
      parameters:
      - name: domain
        in: path
        required: true
        description: The documentation domain being indexed.
        schema:
          type: string
      - name: job_id
        in: query
        required: true
        description: The job ID returned from the index endpoint.
        schema:
          type: string
      responses:
        '200':
          description: Indexing job status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebsiteStatus'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    WebsiteStatus:
      type: object
      properties:
        job_id:
          type: string
        status:
          type: string
          description: 'Job status: PENDING, PROCESSING, COMPLETED, or FAILED.'
          enum:
          - PENDING
          - PROCESSING
          - COMPLETED
          - FAILED
        base_url:
          type: string
        pages_indexed:
          type: integer
          description: Count of successfully indexed pages.
        pages_failed:
          type: integer
          description: Count of pages that failed to index.
        error:
          type: string
          nullable: true
          description: Error message if the job failed.
  responses:
    Unauthorized:
      description: Missing or invalid API token.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Bearer token generated with the `fern token` CLI command. Passed as `Authorization: Bearer YOUR_API_TOKEN`. Tokens are scoped to your organization and do not expire.'