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

# Copy Agent

> Copy an existing agent with all its configurations and datastore associations. The copied agent will have "[COPY]" appended to its name.



## OpenAPI

````yaml api-reference/openapi.json post /agents/{agent_id}/copy
openapi: 3.1.0
info:
  title: Endpoints
  version: '1.0'
servers:
  - url: https://api.contextual.ai/v1
security:
  - BearerAuth: []
paths:
  /agents/{agent_id}/copy:
    post:
      tags:
        - /agents
      summary: Copy Agent
      description: >-
        Copy an existing agent with all its configurations and datastore
        associations. The copied agent will have "[COPY]" appended to its name.
      operationId: Copy_Agent_agents__agent_id__copy_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: ID of the agent to copy
            title: Agent Id
          description: ID of the agent to copy
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentOutput'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateAgentOutput:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: ID of the agent
        datastore_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Datastore Ids
          description: >-
            IDs of the datastores associated with the agent. If no datastore was
            provided as part of the request, this is a singleton list containing
            the ID of the automatically created datastore.
      type: object
      required:
        - id
        - datastore_ids
      title: CreateAgentOutput
      description: Response to POST /agents request
    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
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````