• General
  • My Apps
  • SDKs
  • Protocols
  • Structures
  • Methods
  • Errors
Log in Register Log out
  • General

  • My Apps

  • SDKs
    • C
    • Java
    • Javascript
    • Php
    • Swift

  • Protocols
    • HTTP JSON Protocol
      • Authentication
      • Single Connection
      • Uploading Files
    • Binary Protocol
      • Sending Binary Request
      • Sending Files
      • Receiving Binary Response
      • Receiving Files Data

  • Structures
    • Datetime
    • Event
    • Filenames
    • Metadata
    • Share
    • Tree

  • Methods
    • Intro
      • Global Parameters
      • Authentication
    • General
      • getdigest
      • userinfo
      • supportedlanguages
      • setlanguage
      • feedback
      • currentserver
      • diff
      • getfilehistory
      • getip
      • getapiserver
    • Folder
      • createfolder
      • createfolderifnotexists
      • listfolder
      • renamefolder
      • deletefolder
      • deletefolderrecursive
      • copyfolder
    • File
      • uploadfile
      • uploadprogress
      • downloadfile
      • downloadfileasync
      • copyfile
      • checksumfile
      • deletefile
      • renamefile
      • stat
    • Auth
      • sendverificationemail
      • verifyemail
      • changepassword
      • lostpassword
      • resetpassword
      • register
      • invite
      • userinvites
      • logout
      • listtokens
      • deletetoken
      • sendchangemail
      • changemail
      • senddeactivatemail
      • deactivateuser
    • Streaming
      • getfilelink
      • getvideolink
      • getvideolinks
      • getaudiolink
      • gethlslink
      • gettextfile
    • Archiving
      • getzip
      • getziplink
      • savezip
      • extractarchive
      • extractarchiveprogress
      • savezipprogress
    • Sharing
      • sharefolder
      • listshares
      • sharerequestinfo
      • cancelsharerequest
      • acceptshare
      • declineshare
      • removeshare
      • changeshare
    • Public Links
      • getfilepublink
      • getfolderpublink
      • gettreepublink
      • showpublink
      • getpublinkdownload
      • copypubfile
      • listpublinks
      • listplshort
      • deletepublink
      • changepublink
      • getpubthumb
      • getpubthumblink
      • getpubthumbslinks
      • savepubthumb
      • getpubzip
      • getpubziplink
      • savepubzip
      • getpubvideolinks
      • getpubaudiolink
      • getpubtextfile
      • getcollectionpublink
    • Thumbnails
      • getthumblink
      • getthumbslinks
      • getthumb
      • savethumb
    • Upload Links
      • createuploadlink
      • listuploadlinks
      • deleteuploadlink
      • changeuploadlink
      • showuploadlink
      • uploadtolink
      • uploadlinkprogress
      • copytolink
    • Revisions
      • listrevisions
      • revertrevision
    • Newsletter
      • newsletter_subscribe
      • newsletter_check
      • newsletter_verifyemail
      • newsletter_unsubscribe
      • newsletter_unsibscribemail
    • Trash
      • trash_list
      • trash_restorepath
      • trash_restore
      • trash_clear
    • Collection
      • collection_list
      • collection_details
      • collection_create
      • collection_rename
      • collection_delete
      • collection_linkfiles
      • collection_unlinkfiles
      • collection_move
    • OAuth 2.0
      • authorize
      • oauth2_token
    • Transfer
      • uploadtransfer
      • uploadtransferprogress

  • Errors

copypubfile

Name

copypubfile

Auth

yes

Description

Copies the file from the public link to the current user's filesystem

Expects as parameter code that can be either 'code' or 'shortcode'.

The code could be obtained from:

  • getfilepublink - link to a single file
  • getfolderpublink - link to a folder
  • gettreepublink - link to a tree
  • getcollectionpublink - link to a collection
If the link is to a folder also expects fileid.

As with copyfile you can either specify topath or tofolderid (with optional toname).

Also the optional noover works as usual.

Since no actual downloading or traffic happens, using this method does not increment the download nor traffic counters of the public link.

Consequently copypubfile can be performed even if the public link has run out of downloads or traffic quota.

Implementations are advised to advertise this function when getpublinkdownload returns an error code identifying out of downloads or out of traffic condition. Unauthenticated users, of course, will have to first register/log in in this case.

URL

https://api.pcloud.com/copypubfile

Required

ParameterDescription
codestring either 'code' or 'shortcode'
fileidint File id, if the link is to a folder
pathstring path to the target file
tofolderidint id of destination folder
topathstring destination path
Note that not all are required at single method call

Optional

ParameterDescription
tonamestring name of the destination file. If omitted, then the original filename is used
nooverint If it is set and file with the specified name already exists, no overwriting will be preformed

Output

When successful, copies the file from the public link to the current user's account and returns the new file's metadata.

Example

{
    "result": 0,
    "metadata": {
        "category": 1,
        "width": 900,
        "thumb": true,
        "created": "Wed, 02 Oct 2013 15:05:17 +0000",
        "hash": 10681749967730527559,
        "icon": "image",
        "ismine": true,
        "name": "Simple image.jpg",
        "modified": "Wed, 02 Oct 2013 15:05:17 +0000",
        "isfolder": false,
        "contenttype": "image\/jpeg",
        "fileid": 1732283,
        "isshared": false,
        "id": "f1732283",
        "size": 73269,
        "parentfolderid": 28110,
        "height": 600
    }
}

Errors

CodeDescription
1000Log in required.
1004No fileid or path provided.
1016No full topath or toname/tofolderid provided.
1028Please provide link 'code'.
1029Please provide 'fileid'.
2000Log in failed.
2001Invalid file/folder name.
2002A component of parent directory does not exist.
2003Access denied. You do not have permissions to preform this operation.
2004File or folder alredy exists.
2008User is over quota.
2009File not found.
2010Invalid path.
4000Too many login tries from this IP address.
5000Internal error. Try again later.
7001Invalid link 'code'.
7002This link is deleted by the owner.
7004This link has expired.
7005This link has reached its traffic limit.
7006This link has reached maximum downloads.
2014 © pCloud. Terms and Conditions. Privacy Policy. Intellectual Property.
© pCloud. Terms and Conditions. Privacy Policy. Intellectual Property.
Reset Password
Check your e-mail for further instructions.
Reset