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

# Spec Reindex

> Re-index the specified spec's functions.

Re-indexes the functions of the specified spec identified by its API name.
Optionally specify whether to drop the existing index.

Parameters:
- api_name (str): The name of the spec to re-index.
- payload (SpecReindexPayload): Payload containing the drop flag.
- current_user (AuthUser): The current user making the request. Retrieved using dependency injection.

Returns:
- dict: Re-indexing confirmation message or error detail.

Raises:
- HTTPException(500): If an error occurs while re-indexing the functions.



## OpenAPI

````yaml post /api/spec/{api_name}/reindex
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/spec/{api_name}/reindex:
    post:
      tags:
        - Spec
      summary: Spec Reindex
      description: >-
        Re-index the specified spec's functions.


        Re-indexes the functions of the specified spec identified by its API
        name.

        Optionally specify whether to drop the existing index.


        Parameters:

        - api_name (str): The name of the spec to re-index.

        - payload (SpecReindexPayload): Payload containing the drop flag.

        - current_user (AuthUser): The current user making the request.
        Retrieved using dependency injection.


        Returns:

        - dict: Re-indexing confirmation message or error detail.


        Raises:

        - HTTPException(500): If an error occurs while re-indexing the
        functions.
      operationId: spec_reindex
      parameters:
        - name: api_name
          in: path
          required: true
          schema:
            type: string
            title: Api Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpecReindexPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SpecReindexPayload:
      properties:
        drop:
          type: boolean
          title: Drop
          description: Flag indicating whether to drop existing indices before reindexing.
          default: false
        force:
          type: boolean
          title: Force
          description: >-
            When true, revoke any active reindex task for this spec and start a
            new one. If no task is running, behaves like a normal reindex.
          default: false
      type: object
      title: SpecReindexPayload
      description: Payload model for reindexing a specific spec.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````