Upload files from URLs

Uploadcare can fetch a file from a publicly available URL and then automatically upload the fetched file to your project. #### Upload tokens Requests to the endpoint return a JSON dictionary with a `token` that can be further used to [check the status](/docs/api/upload/upload/from-url-upload-status) of the upload request. **Note:** The token is not a file ID and can't be used to address the file directly. The actual file ID should be retrieved by calling the `/from_url/status/` endpoint. #### Duplicates prevention By default, every call to the `/from_url/` endpoint with the same `source_url` results in a new upload leading to file duplication. If you would like Uploadcare to keep track of the requested URLs and avoid the duplicate uploads, pass the `save_URL_duplicates` and `check_URL_duplicates` parameters described below.

Request

This endpoint expects a multipart form.
pub_keystringRequired
Public key identifying an Uploadcare project your uploads will go to.
source_urlstringRequiredformat: "uri"

Source URL of the file to fetch and upload.

Note: The URL should point to a resource publicly available via HTTP/HTTPS.

storeenumOptionalDefaults to auto
Determines if an uploaded file should be marked as temporary or permanent. The parameter can have the following values: - `0` - do not mark an uploaded file as stored and remove it after 24 hours - `1` - mark the uploaded file as stored - `auto` - delegate the choice of the file-storing behavior to a project-wide setting called [auto-store](https://app.uploadcare.com/projects/-/settings/#storage). The default value depends on the user registration date. For all users registered after February 12, 2024 (UTC 13:30), the default value is `auto`. File-storing behavior depends entirely on what is set in the [storage settings](https://app.uploadcare.com/projects/-/settings/#storage) in the Dashboard. For users registered before February 12, 2024, the default value is `0`. To ensure that file storage in the project matches the settings in the Dashboard, change the value to `auto`.
Allowed values:
filenamestringOptional
Sets the file name of the resource fetched from the source URL. If not defined, the file name is obtained from either HTTP response headers or the `source_url`'s path. **Note:** The filename will be sanitized to only contain the following symbols: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._`.
check_URL_duplicatesenumOptionalDefaults to 0

If set to “1”, enables the source_url duplicates prevention. Specifically, if the source_url had already been fetched and uploaded previously, this request will return information about the already uploaded file.

Allowed values:
save_URL_duplicatesenumOptional

Determines if the requested source_url should be kept in the history of fetched/uploaded URLs. If the value is not defined explicitly, it is set to the value of the check_URL_duplicates parameter.

Allowed values:
metadata[{key}]stringOptional1-512 characters
Arbitrary metadata associated with the file. See [docs](https://uploadcare.com/docs/file-metadata/) and [REST API v0.7](/docs/api/rest/file-metadata/) for more information.
signaturestringOptional
`signature` must be sent along with your upload request if you would like to use signed uploads. The signature should be generated on your backend. **Note**: the process requires knowledge of your Uploadcare Project's Secret key. See [signed uploads](https://uploadcare.com/docs/security/secure-uploads/) for details.
expireintegerOptional
`expire` must be sent along with your upload request if you would like to use signed uploads. The parameter defines the time during which your signature is valid. It's a UNIX timestamp. See [signed uploads](https://uploadcare.com/docs/security/secure-uploads/) for details.

Response

Status Token or File Info of an already downloaded file.
fromURLUploadResponseSchemaobject

/from_url/ upload response.

OR
fileUploadInfoFromURLobject