> ## 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 Clone

> Clone a spec to create a private copy.

Creates a complete copy of the spec including:
- Spec document (spec, examples, llm_summary, agentic_metadata, etc.)
- Spec configuration (security_info, operations_state, common_parameters)

The cloned spec will be tenant-specific (not global) and independent.
All metadata (created_by, created_at, updated_at) will be updated.

Parameters:
- api_name (str): The name of the source spec to clone.
- payload (SpecClonePayload): Payload containing clone_api_title.

Returns:
- dict: Dictionary containing api_name of the cloned spec.

Raises:
- HTTPException(400): If clone_api_title validation fails (invalid characters or exceeds 100 characters).
- HTTPException(404): If the source spec is not found.
- HTTPException(409): If the clone_api_title already exists.
- HTTPException(500): If an error occurs while cloning the spec.



## OpenAPI

````yaml post /api/spec/{api_name}/clone
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}/clone:
    post:
      tags:
        - Spec
      summary: Spec Clone
      description: >-
        Clone a spec to create a private copy.


        Creates a complete copy of the spec including:

        - Spec document (spec, examples, llm_summary, agentic_metadata, etc.)

        - Spec configuration (security_info, operations_state,
        common_parameters)


        The cloned spec will be tenant-specific (not global) and independent.

        All metadata (created_by, created_at, updated_at) will be updated.


        Parameters:

        - api_name (str): The name of the source spec to clone.

        - payload (SpecClonePayload): Payload containing clone_api_title.


        Returns:

        - dict: Dictionary containing api_name of the cloned spec.


        Raises:

        - HTTPException(400): If clone_api_title validation fails (invalid
        characters or exceeds 100 characters).

        - HTTPException(404): If the source spec is not found.

        - HTTPException(409): If the clone_api_title already exists.

        - HTTPException(500): If an error occurs while cloning the spec.
      operationId: spec_clone
      parameters:
        - name: api_name
          in: path
          required: true
          schema:
            type: string
            title: Api Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpecClonePayload'
      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:
    SpecClonePayload:
      properties:
        clone_api_title:
          type: string
          title: Clone Api Title
          description: Title (human-readable) for the cloned spec
      type: object
      required:
        - clone_api_title
      title: SpecClonePayload
      description: Request body model for cloning a 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}'

````