> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJmZjliMDk2NS1lZTVjLTQzNzAtOGU0MC1jMGE0ODE2ODBkY2QiLCJleHAiOjE3NzgyNTkzNTEsImlhdCI6MTc3ODI1OTA1MX0.AiZ5cgtbCmoFTBKMQLP_2ltjKHXgbUIkPX_NdEaTTzU
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# Algolia search credentials

GET https://docs.example.com/api/fern-docs/search/v2/key

Get Algolia search credentials for querying documentation.

Reference: https://buildwithfern.com/learn/docs/fern-api-reference/get-search-key

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: mcp-tools
  version: 1.0.0
paths:
  /api/fern-docs/search/v2/key:
    get:
      operationId: get-search-key
      summary: Algolia search credentials
      description: Get Algolia search credentials for querying documentation.
      tags:
        - ''
      parameters:
        - name: FERN_API_KEY
          in: header
          description: Fern API key, from `fern token`.
          required: true
          schema:
            type: string
        - name: ROLES
          in: header
          description: >-
            Comma-separated list of roles (only with FERN_API_KEY). Sets roles
            for returned search key if provided, otherwise, roles are empty.
          required: false
          schema:
            type: string
        - name: x-fern-host
          in: header
          description: Documentation domain (required on preview URLs)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successfully retrieved search credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getSearchKey_Response_200'
        '400':
          description: Bad request (local preview or unsupported preview URL)
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized (invalid Fern API key)
          content:
            application/json:
              schema:
                description: Any type
        '403':
          description: >-
            Forbidden (API key does not belong to this domain's Fern
            organization)
          content:
            application/json:
              schema:
                description: Any type
servers:
  - url: https://docs.example.com
components:
  schemas:
    getSearchKey_Response_200:
      type: object
      properties:
        appId:
          type: string
          description: Algolia application ID
        apiKey:
          type: string
          description: Short-lived Algolia search API key
        roles:
          type: array
          items:
            type: string
          description: Roles included in the search key (only with FERN_API_KEY auth)
      required:
        - appId
        - apiKey
      title: getSearchKey_Response_200
  securitySchemes:
    FernApiKey:
      type: apiKey
      in: header
      name: FERN_API_KEY
      description: Fern API key, from `fern token`.
    FernToken:
      type: apiKey
      in: header
      name: FERN_TOKEN
      description: JWT token for this user.

```