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

# /v1/apps/{appId}/files/move

> This endpoint moves files or directories of an application into another directory.

> [!WARNING]
>
> This endpoint has a rate limit of 1 request every 3 seconds, shared with the other endpoints that change files (upload, delete, rename, move and create).

> [!NOTE]
>
> Items are moved one by one. If one of them fails, the items before it have already been moved.


## OpenAPI

````yaml PATCH /v1/apps/{appId}/files/move
openapi: 3.1.0
info:
  title: CamposCloud API Documentation
  description: >-
    This documentation provides an overview of the CamposCloud API, including
    authentication, endpoints, and data structures. It is designed to help
    developers integrate with the CamposCloud platform effectively.
  version: 1.0.0
servers:
  - url: https://api.camposcloud.com
security:
  - bearerAuth: []
paths:
  /v1/apps/{appId}/files/move:
    patch:
      tags:
        - File System
      description: >-
        Moves files or directories of an application into another directory,
        keeping their names. The target directory must already exist. The owner
        of the application must have an active plan. For team applications the
        `canEditApplicationFiles` permission is required.


        Paths are relative to the root of the application; a leading `/` is
        optional. A path must have 1 to 1024 characters and must not contain
        `..` segments, backslashes, control characters or any of `< > : " | ?
        *`.
      parameters:
        - name: appId
          in: path
          required: true
          description: ID of the application.
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - filePath
                - pathTarget
              properties:
                filePath:
                  type: array
                  minItems: 1
                  maxItems: 50
                  description: >-
                    Paths of the files or directories to move. Between 1 and 50
                    paths. None of them can be the application root.
                  items:
                    type: string
                    minLength: 1
                    maxLength: 1024
                  example:
                    - src/a.js
                    - src/b.js
                pathTarget:
                  type: string
                  minLength: 1
                  maxLength: 1024
                  description: >-
                    Directory to move the items into. Use `/` for the
                    application root.
                  example: lib
      responses:
        '200':
          description: Every item was moved.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Files moved successfully
        '400':
          description: >-
            `appId` is not a valid ID, the body is invalid, or one of the paths
            is not allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: '''filePath'' must be a non-empty array of strings.'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            You are not allowed to edit files of the application (team
            applications require the `canEditApplicationFiles` permission), or
            the owner of the application has no active plan. Also returned when
            the path resolves outside the application folder.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  You do not have permission to perform this action on this
                  application.
        '404':
          description: Application not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  Application not found or you do not have permission to access
                  it.
        '429':
          description: >-
            A rate limit was exceeded. This endpoint accepts 1 request every 3
            seconds. The counter is shared by upload, delete, rename, move and
            create.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: File upload limit reached, please try again later
        '500':
          description: >-
            Unexpected error. Also returned when one of the items or the target
            directory does not exist. Items are moved one by one, so the ones
            before the failing item have already been moved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: >-
                  Error from worker: Failed to move file 'src/a.js': ENOENT: no
                  such file or directory
components:
  schemas:
    Error:
      type: object
      description: >-
        Every error returned by the API has this shape. The message can be in
        English or in Portuguese depending on the endpoint.
      required:
        - error
      properties:
        error:
          type: string
          description: Human readable description of the error.
          example: Application not found.
  responses:
    Unauthorized:
      description: >-
        The `Authorization` header is missing or malformed, or the API token is
        invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid developer token
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your CamposCloud API token, sent as `Authorization: Bearer <token>`.'

````

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