# 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.1
info:
  title: Algolia search credentials
  version: endpoint_.getSearchKey
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: Header authentication of the form `undefined <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: {}
        '401':
          description: Unauthorized (invalid Fern API key)
          content: {}
        '403':
          description: >-
            Forbidden (API key does not belong to this domain's Fern
            organization)
          content: {}
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

```