> For the complete documentation index, see [llms.txt](https://docs.replicacyber.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.replicacyber.com/developer-guide/butler-api-reference/files.md).

# Files

File actions

## List files or download as zip file

> List or download files from Environment or Enclave

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]}}},"paths":{"/v1/transfer/resources/{id}":{"get":{"summary":"List files or download as zip file","description":"List or download files from Environment or Enclave","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"},{"name":"name","in":"query","required":false,"description":"Set to provide custom zip file name"}],"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}},"application/zip":{"description":"Download a zip file containing Resource files","headers":{"Content-Disposition":"attachment; filename=\"butler.zip\""}}}},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```

## Copy files

> Copy files between Environments and Enclaves

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"TransferFilesRequest":{"type":"object","properties":{"action":{"type":"string","description":"Type of transfer","enum":["copy","export"],"required":true},"sourceId":{"type":"string","required":true,"description":"The source Resource Id"},"sourceName":{"type":"string","required":false,"description":"The source Resource Id"},"sourceType":{"$ref":"#/components/schemas/ResourceType","required":true,"description":"The source Resource Type"},"targetId":{"type":"string","required":false,"description":"The target Resource Id"},"targetType":{"$ref":"#/components/schemas/ResourceType","required":false,"description":"The target Resource Type"}}},"ResourceType":{"type":"string","enum":["environment","storage"]},"ReplicaMessageSuccess":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]},"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}}}},"paths":{"/v1/transfer/resources/{id}":{"post":{"summary":"Copy files","description":"Copy files between Environments and Enclaves","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"}],"requestBody":{"description":"Transfer request body","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferFilesRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageSuccess"},{"type":"object","properties":{"message":{}}}]}}}},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```

## Delete all files

> Delete an Environment or Enclave file

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ReplicaMessageSuccess":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]},"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}}}},"paths":{"/v1/transfer/resources/{id}":{"delete":{"summary":"Delete all files","description":"Delete an Environment or Enclave file","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"}],"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageSuccess"},{"type":"object","properties":{"message":{}}}]}}}},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```

## Download file

> Download a file from Environment or Enclave

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]}}},"paths":{"/v1/transfer/resources/{id}/{name}":{"get":{"summary":"Download file","description":"Download a file from Environment or Enclave","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"},{"name":"name","in":"path","required":true,"description":"The Resource name"}],"responses":{"200":{"description":"Stream file content. Sets response Content-Disposition to attachment and MIME type from file."},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```

## Upload a file

> Upload a file to an Environment or Enclave

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UploadFileRequest":{"type":"object","required":["filesize","filetype"],"properties":{"filesize":{"type":"string","description":"File content size"},"filetype":{"type":"string","description":"File MIME type"},"filestore":{"type":"string","description":"File storage Type","enum":["s3","efs"]}}},"ReplicaMessageSuccess":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]},"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}}}},"paths":{"/v1/transfer/resources/{id}/{name}":{"put":{"summary":"Upload a file","description":"Upload a file to an Environment or Enclave","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"},{"name":"name","in":"path","required":true,"description":"The Resource name"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadFileRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageSuccess"},{"type":"object","properties":{"message":{}}}]}}}},"422":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageSuccess"},{"type":"object","properties":{"message":{}}}]}}}},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```

## Delete a file

> Delete an Environment or Enclave file

```json
{"openapi":"3.0.0","info":{"title":"Replica Butler","version":"4.5.0"},"tags":[{"name":"Files","description":"File actions"}],"servers":[{"url":"/butler/api/","description":"Replica Butler"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ReplicaMessageSuccess":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}},"ReplicaEvent":{"type":"string","enum":["GET","POST","PUT","DELETE","ERROR"]},"ReplicaMessageFailure":{"type":"object","properties":{"statusCode":{"type":"integer"},"success":{"type":"boolean"},"message":{"type":"string"},"event":{"type":"string","$ref":"#/components/schemas/ReplicaEvent"},"items":{"type":"array"}}}}},"paths":{"/v1/transfer/resources/{id}/{name}":{"delete":{"summary":"Delete a file","description":"Delete an Environment or Enclave file","tags":["Files"],"parameters":[{"name":"id","in":"path","required":true,"description":"The Resource Id"},{"name":"name","in":"path","required":true,"description":"The Resource name"}],"responses":{"200":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageSuccess"},{"type":"object","properties":{"message":{}}}]}}}},"500":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ReplicaMessageFailure"},{"type":"object","properties":{"message":{}}}]}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.replicacyber.com/developer-guide/butler-api-reference/files.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
