# Apply file operations to a site bundle

> Apply file and directory operations atomically against the active bundle.

POST

/sites/{api\_name}/file-operations/

Apply file and directory operations atomically against the active bundle.

For put file operations:

1.  Get a presign: `POST /sites/upload-batches/presign/` with `file_intents` (`client_ref` can be any unique id; `file_name` is the staged basename).
2.  Upload bytes to S3 using `files[].upload_url` and `files[].upload_fields` from the presign response (see `POST /sites/upload-batches/presign/`).
3.  Apply the put: `POST /sites/{api_name}/file-operations/` with `base_bundle_id` set to the site's `current_bundle_id`, and an `operations` item `{ op: put, kind: file, path: <bundle dest>, file_id: <files[].file_id> }`.

### Required Scopes

-   sites.read-write
    

### Request

Path Parameters

**api\_name** string required

The unique api\_name of the site.

**Example:** employee\_portal

-   application/json

**Body**

**base\_bundle\_id** string required

Must match the site's current active bundle. Returns 409 when stale.

**entry\_path** string

Optional bundle entry path. When omitted, the current entry path is kept.

**operations** object\[\] required

Non-empty array of file or directory operations.

Array \[

**op** string required

Operation type. Supported values are put, rename, move, and delete. move is valid for files only; directories support put, rename, and delete.

**kind** string required

Target kind. Supported values are file and directory.

**path** string

Target path for put and delete operations.

**file\_id** string

Staged upload id from POST /sites/upload-batches/presign/ after uploading bytes to S3. Required for put operations on files. The id can be reused for 1 hour from presign, each attach copies the bytes into that site's bundle, a repeat attach before expiry creates another bundle, and the staged object is removed after expiry.

**from\_path** string

Source path for rename and move operations.

**to\_path** string

Destination path for rename and move operations.

**recursive** boolean

When true, delete directory removes nested files. Used by delete directory operations.

\]

## Responses

-   200

Successful response

-   application/json

-   Schema
-   Example (from schema)

**Schema**

**id** string

Identifier field

**name** string

The display name of the custom site

**description** string

The optional description of the custom site

**api\_name** string

The unique api name of the custom site

**logo** string

A Rippling-owned logo URL for the custom site

**current\_bundle\_id** string

The active bundle id for the custom site

**admin\_group\_id** string

The admin group id for the custom site

**viewer\_group\_id** string

The viewer group id for the custom site

**created\_by** string

The ID of the role that created the custom site

**created\_at** string

Record creation date

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "api_name": "string",
  "logo": "string",
  "current_bundle_id": "string",
  "admin_group_id": "string",
  "viewer_group_id": "string",
  "created_by": "string",
  "created_at": "string"
}
```

Source: https://developer.rippling.com/documentation/rest-api/reference/file-operations-sites

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
