Data Types

ProcessFile

To process files:

  1. Replace raw in your file URLs with one of:

  2. Add querystring parameters per the API docs above. (None required if using a preset.)

For example, given the original image:

https://upcdn.io/W142hJk/raw/example.jpg

To process this image with the Image Processing API:

https://upcdn.io/W142hJk/image/example.jpg?w=800&h=600&fit=crop&tint=377DFF

Tip: results are cached for fast subsequent downloads.

For private files: you must append ?auth=true to your URLs and have a valid JWT cookie (see: authorization). Alternatively, you can process private files using API keys like in the examples below.

To process files using code:

GET https://upcdn.io/{accountId}/{transformation}/{filePath}{?params}
cURL
1curl "https://upcdn.io/{accountId}/{transformation}/{filePath}{?params}" \
2 -H "Authorization: Bearer YOUR_API_KEY"
Response (200)
1Binary response

Response Body

The file's contents.

URL Parameters

accountId

Your account ID.

This is visible on the settings page:

https://upload.io/dashboard/settings

Example: A623uY2

Type: String

Length: 7

In: Path

Required: Yes

filePath

Absolute path to a file. Begins with a /.

Example: /uploads/image.jpg

Type: String

Min Length: 1

Max Length: 512

In: Path

Required: Yes

transformation

The transformation preset (created in the Upload Dashboard) or transformation API to use:

Archive Processing API: archive

Image Processing API: image

When using transformation APIs: please refer to the documentation for the additional querystring parameters required by that API.

Example: thumbnail

Type: String

Min Length: 1

Max Length: 100

In: Path

Required: Yes

artifact

Some transformations output multiple files, called artifacts.

You can download each individual transformation artifact by specifying its path with this parameter

Example: ?artifact=/example/video/part-a.ts

Type: String

In: Querystring

Required: No

auth

Must be set when using JWT cookies to download private files.

Do not include this parameter otherwise.

Default: false

Type: Boolean

In: Querystring

Required: No

cache

Specifies whether to cache the transformed result.

If set to false the transformation will be executed on every request.

Recommendation: instead of disabling the cache, a more performant solution is to use the version parameter and to increment it each time you require an updated result.

Default: true

Type: Boolean

In: Querystring

Required: No

cache_perm

Specifies whether to cache the transformed result in the Upload CDN perma-cache.

Perma-caching works by storing your file permanently, or until a manual cache purge is performed.

When cache=false this parameter is automatically set to false.

When cache_perm=auto the perma-cache will only be used for files that take more than 1000ms to process.

When the perma-cache is used, approximately 200ms of latency is added to the initial request. Thereafter, files will be served from the Upload CDN's edge cache or perma-cache, so will have minimal latency.

Default: Please refer to your account's default cache settings in the Upload Dashboard.

Type: String

Allowed Values: "auto", "false", "true"

In: Querystring

Required: No

cache_ttl

Specifies the maximum amount of time, in seconds, the transformed result will be cached on the user's device and in the Upload CDN's edge cache.

If the file is perma-cached, then the file will not be reprocessed on edge cache misses.

If the file is not perma-cached, then the file will be reprocessed on edge cache misses.

For more information on perma-caching, see: cache_perm

Default: Please refer to your account's default cache settings in the Upload Dashboard.

Type: Number

In: Querystring

Required: No

download

Forces the browser to display a download prompt for the file, instead of displaying the file in the browser.

When set to true, the Upload CDN will add a content-disposition: attachment header to the HTTP response.

Example: ?download=true

Type: Boolean

In: Querystring

Required: No

large

Set to true to return transformed files over 6MB in the initial HTTP response.

By default, transformations that produce files larger than 6MB require a subsequent HTTP request to return the result: the initial HTTP request will process the file and return a JSON result instructing the requester the transformation has been performed. All subsequent requests will return the transformed file. Enable this flag to ensure the transformed file is always returned in the initial response.

Recommendation: set large=true only if you require transformation results over 6MB. A small amount of latency is incurred on edge cache misses when this flag is enabled. In general, we recommend adjusting your transformation parameters to keep files below this size, instead of enabling this flag.

Default: false

Type: Boolean

In: Querystring

Required: No

version

Add this parameter and increment its value to force the reprocessing of a file.

The Upload CDN caches based on the full URL (including the querystring), meaning this parameter is useful when dealing with changes made to transformation presets. By contrast, transformation APIs (like the Image Processing API) shouldn't ever require this parameter, since the URL/querystring naturally changes each time you adjust a parameter, causing a cache miss and the file to be reprocessed with the new querystring parameters.

The value of the version parameter can be anything, e.g. an incremental number, a timestamp, etc.

You only need to provide and update this value if/when you make changes to a transformation preset's settings.

Example: ?version=1

Type: String

In: Querystring

Required: No

Request Headers

Authorization

Add one of these Authorization header values to your request:

Option 1: prefix "Bearer " to your API key. The result is your Authorization header value.

Option 2: use HTTP basic authorization, specifying apikey as your username, and your API key as your password.

Type: String

In: Header

Required: No

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: