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

The file's contents.

Your account ID.

This is visible on the settings page:

https://www.bytescale.com/dashboard/settings

Example: A623uY2

Type: String

Length: 7

In: Path

Required: Yes

Absolute path to a file. Begins with a /.

Example: /uploads/image.jpg

Type: String

Min Length: 1

Max Length: 512

In: Path

Required: Yes

The name of the File Processing API (e.g. "image", "video", "audio") or transformation preset (created in the Bytescale Dashboard) to use when processing the file.

Example: thumbnail

Type: String

Min Length: 1

Max Length: 100

In: Path

Required: Yes

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

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

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

Specifies whether to cache the transformed result in the Bytescale 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 Bytescale CDN's edge cache or perma-cache, so will have minimal latency.

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

Type: String

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

In: Querystring

Required: No

Specifies the maximum amount of time, in seconds, the transformed result will be cached on the user's device and in the Bytescale 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 Bytescale Dashboard.

Type: Number

In: Querystring

Required: No

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

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

Example: ?download=true

Type: Boolean

In: Querystring

Required: No

Only set this parameter to true if you expect the HTTP response body for the transformation request to be over 6MB.

We recommend leaving this parameter unset (so it defaults to false) and controlling the HTTP response body size via transformation parameters. E.g. for Image Processing API requests, you can shrink the HTTP response body by reducing the output image's dimensions and/or quality.

Setting this parameter to true will route the request via an alternative CDN path, which allows responses over 6MB, but incurs a ~200ms latency on all CDN edge cache misses for the URL.

Setting this parameter to false (default) results in faster routing. If a response over 6MB is returned, the initial response will be a JSON error indicating the response was too large to return. All subsequent requests to the same URL will successfully return the transformed file (forever).

Default: false

Type: Boolean

In: Querystring

Required: No

Add this parameter and increment its value to force the file to be reprocessed.

The Bytescale CDN caches files based on the full URL (including the querystring), meaning this parameter is useful when dealing with changes made to transformation presets. By contrast, File Processing 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

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: