Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Copy a File Request

Copy a File Request

To create a copy of an existing template file request, all you need is its unique ID, and the ID of the folder to apply the new file request to.

cURL
curl -i -X POST "https://api.box.com/2.0/file_requests/42037322/copy" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -d '{
       "title": "Please upload required documents",
       "description": "Please upload required documents",
       "status": "active",
       "is_email_required": true,
       "is_description_required": false,
       "folder": {
         "id": "2233212",
         "type": "folder"
       }
     }'
TypeScript Gen
await client.fileRequests.createFileRequestCopy(fileRequestId, {
  folder: {
    id: fileRequest.folder.id,
    type: 'folder' as FileRequestCopyRequestFolderTypeField,
  } satisfies FileRequestCopyRequestFolderField,
} satisfies FileRequestCopyRequest);
Python Gen
client.file_requests.create_file_request_copy(
    file_request_id,
    CreateFileRequestCopyFolder(
        id=file_request.folder.id,
        type=CreateFileRequestCopyFolderTypeField.FOLDER.value,
    ),
)
.NET Gen
await client.FileRequests.CreateFileRequestCopyAsync(fileRequestId: fileRequestId, requestBody: new FileRequestCopyRequest(folder: new FileRequestCopyRequestFolderField(id: fileRequest.Folder.Id) { Type = FileRequestCopyRequestFolderTypeField.Folder }));
Swift Gen (Beta)
try await client.fileRequests.createFileRequestCopy(fileRequestId: fileRequestId, requestBody: FileRequestCopyRequest(folder: FileRequestCopyRequestFolderField(id: fileRequest.folder.id, type: FileRequestCopyRequestFolderTypeField.folder)))
Java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
BoxFileRequest.Info fileRequestInfo = fileRequest.new Info();
fileRequestInfo.setDescription("Following documents are requested for your process");
fileRequestInfo.setIsDescriptionRequired(true);
fileRequestInfo.setStatus(BoxFileRequest.Status.ACTIVE);
fileRequestInfo = fileRequest.copyInfo(fileRequestInfo, "folderId");
Python
file_request = client.file_request(file_request_id='123456')
folder = client.folder(folder_id='123456789')
new_file_request = file_request.copy(folder=folder, title="Copied file request")
.NET
var destinationFolder = new BoxRequestEntity
{
    Id = "123456",
    Type = BoxType.folder
};

var copyRequest = new BoxFileRequestCopyRequest
{
    Description = "New file request description",
    Folder = destinationFolder
};

BoxFileRequestObject fileRequest = await client.FileRequestsManager.CopyFileRequestAsync("12345", copyRequest);
Node
client.fileRequests.copy(fileRequestId, {
  folder: {
    id: '157979815648',
    type: 'folder'
  }
}).then((r: FileRequest) => {
  // do something with the copied file request 
  console.log(r)
});
iOS
let destinationFolder = FolderEntity(id: "33333")

let copyRequest = FileRequestCopyRequest(
    title: "New file request title",
    description: "New file request description",
    isEmailRequired: true,
    isDescriptionRequired: false,
    folder: destinationFolder
)

client.fileRequests.copy(fileRequestId: "123456", copyRequest: copyRequest) { result in
    guard case let .success(fileRequest) = result else {
        print("Error copying file request")
        return
    }
    
    print("Copied file request title: \(fileRequest.title ?? "n/a"), description: \(fileRequest.description ?? "n/a")")
}

The ID of a folder and file request can be determined by visiting the Box web app and inspecting the URL.

The folder ID is the number at the end of the URL when visiting a folder, for example app.box.com/folder/123 is the URL for the folder with ID 123.

For a file request, please check our guide on setting up a file request template to learn how to determine a file request ID.

Updating a file request on copy

It is possible to make some basic changes to a file request when copying from a template. The file request's title, description, status and a few more other settings can be updated when the file request is copied from the template.

curl -i -X POST "https://api.box.com/2.0/file_requests/2342235/copy" \
    -H "Authorization: Bearer <ACCESS_TOKEN>" \
    -d '{
      "title": "Please upload required documents",
      "description": "Please upload required documents",
      "status": "active",
      "is_email_required": true,
      "is_description_required": false,
      "folder": {
        "id": "342323423"
      }
    }'

For more details on the different fields that can be updated when creating a template, please see the reference documentation for the POST /file-requests/:id/copy API.