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

# Duplicate Agent

> Create a copy of an agent you can access.

Creates a new agent from an existing agent's configuration. The API key must belong to the supplied user, and that user must have access to the source agent.

The response identifies the new agent by its `agentId` and includes its name and owning user ID.


## OpenAPI

````yaml POST /duplicate-agent
openapi: 3.0.1
info:
  title: Phonely API
  description: API for Phonely services including agent management and call summaries
  version: 1.0.0
servers:
  - url: https://app.phonely.ai/api
security: []
paths:
  /duplicate-agent:
    post:
      summary: Duplicate an agent
      description: Create a duplicate of an existing agent for the specified user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateAgentRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicateAgentResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    DuplicateAgentRequest:
      type: object
      required:
        - uid
        - agentId
      properties:
        uid:
          type: string
          description: User ID
        agentId:
          type: string
          description: Agent ID to be duplicated
    DuplicateAgentResponse:
      type: object
      required:
        - uid
        - agentId
        - name
      properties:
        uid:
          type: string
          description: User ID
        agentId:
          type: string
          description: New duplicated Agent ID
        name:
          type: string
          description: New duplicated Agent name
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error code or identifier
        message:
          type: string
          description: Detailed error message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.