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

# Swap Proxy

> Swaps the proxy server with another proxy server.

Swap a proxy server for a new one from any available ISP and location. This will remove the old proxy server and replace it with a new one.

<Warning>
  The name of the proxy and port will change after swapping. The server IP may change as well. You have the option to
  use `copy_settings` to transfer configurations like: `auto_change`, `auto_change_time`, `auth_method`, `username`,
  `password` and `whitelist`.
</Warning>


## OpenAPI

````yaml POST /v1/proxies/swap/{proxyName}
openapi: 3.0.1
info:
  title: Illusory API Reference
  description: Interact with Illusory proxies
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://cmd.illusory.io
security: []
paths:
  /v1/proxies/swap/{proxyName}:
    post:
      description: Swaps the proxy server with another proxy server.
      parameters:
        - name: proxyName
          in: path
          description: Replace `{proxyName}` in the url path with `YOUR_PROXY`.
          required: true
          schema:
            type: string
      requestBody:
        description: Swap proxy details
        content:
          application/json:
            schema:
              type: object
              properties:
                isp:
                  type: string
                  description: Name of the Internet Service Provider e.g. `Verizon`
                  example: Verizon
                location:
                  type: string
                  description: City of the proxy server e.g. `Austin`
                  example: Austin
                copy_settings:
                  type: boolean
                  description: >-
                    Indicates whether to copy the settings of the proxy being
                    swapped with. Default: `false`
                  example: true
              required:
                - isp
                - location
      responses:
        '202':
          description: Server response
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    description: Indicates whether the request was successful e.g., `true`
                  message:
                    type: string
                    description: Success message
                    example: Proxy swap command sent to device successfully.
                  data:
                    $ref: '#/components/schemas/proxy-swap'
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error--422-proxy-low-stock'
      security:
        - bearerAuth: []
components:
  schemas:
    proxy-swap:
      type: object
      properties:
        proxy_name:
          type: string
          description: Unique identifier of the proxy server
          example: ILL-US-AU1-9999
    Error:
      type: object
      properties:
        ok:
          type: boolean
          description: Indicates the request was unsuccessful e.g., `false`
        data:
          type: object
          description: Additional error data
          properties:
            proxy_name:
              type: string
              description: Unique identifier of the proxy server
        message:
          type: string
          description: Error message
      example:
        ok: false
        data:
          proxy_name: ILL-US-AU1-9999
        message: Proxy not found
    error--422-proxy-low-stock:
      type: object
      properties:
        ok:
          type: boolean
          description: Indicates the request was unsuccessful e.g., `false`
        data:
          type: object
          description: Additional error data
          properties:
            count:
              type: integer
              description: Amount of product stock available
            amount:
              type: integer
              description: Amount of product requested
            location:
              type: string
              description: Location of stock with discrepancy
            isp:
              type: string
              description: ISP of stock with discrepancy
        message:
          type: string
          description: Error message
      example:
        ok: false
        data:
          count: 0
          amount: 1
          location: Cleveland
          isp: AT&T
        message: >-
          The amount requested is lower than the available stock. Please review
          your cart as it may have been revised.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: apiKey
      description: >-
        The `Authorization` header is used to authenticate with the API using
        your `Master` API key. Value is of the format `Bearer YOUR_KEY_HERE`.

````