Data Types

FormDataUpload

Upload multiple files with a single HTTP request, using multipart form data:

POST /v2/accounts/{accountId}/uploads/form_data
cURL
1curl "https://api.bytescale.com/v2/accounts/{accountId}/uploads/form_data" \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -F file=@image.jpg # File must exist locally. Always include the '@'.
Response (200)
1{
2 "errors": [
3 {
4 "error": {
5 "code": "error_code",
6 "message": "Error message.",
7 "timestamp": "2024-11-14T15:19:29.471Z"
8 },
9 "formDataFieldName": "file"
10 }
11 ],
12 "files": [
13 {
14 "accountId": "YOUR_ACCOUNT_ID",
15 "etag": "33a64df551425fcc55e4d42a148795d9f25f89d4",
16 "filePath": "/uploads/file.txt",
17 "fileUrl": "https://upcdn.io/A623uY2/raw/uploads/file.txt",
18 "formDataFieldName": "file"
19 }
20 ]
21}

Multipart form data containing the files to upload.

Each multipart form data part must include:

  • The file's contents.
  • The file's MIME type.
  • The file's name (optional).

Your account ID.

This is visible on the settings page:

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

Example: "A623uY2"

Type: String

Length: 7

The file name to upload the file with.

Must not contain /.

Supports path variables.

Conditional: only allowed if filePath is not set.

Example: "image.jpg"

Type: String

Min Length: 0

Max Length: 512

The file name to use if fileName is already taken.

Must not contain /.

Supports path variables.

Conditional: only allowed if fileName is set.

Example: "image.jpg"

Type: String

Min Length: 0

Max Length: 512

If true then path variables like {UTC_DATE} in the fileName will be replaced. You can escape { characters with a \.

If false then path variables like {UTC_DATE} in the fileName will be taken literally.

Default: true

Type: Boolean

The path to upload the file to (including the file's name).

Must begin with / and should end with the file's name.

Does not support path variables.

Conditional: only include if both fileName and folderPath are not set.

Example: "/uploads/image.jpg"

Type: String

Min Length: 0

Max Length: 512

The path to upload the file to (excluding the file's name).

Must begin with / but should not end with /.

Supports path variables.

Conditional: only allowed if filePath is not set.

Example: "/uploads"

Type: String

Min Length: 0

Max Length: 512

If true then path variables like {UTC_DATE} in the folderPath will be replaced. You can escape { characters with a \.

If false then path variables like {UTC_DATE} in the folderPath will be taken literally.

Default: true

Type: Boolean

The tags you specify here determine which rules will be executed for the upload.

You create rules in the Bytescale Dashboard, and choose which tags trigger each rule.

Rules include: max file size checks, traffic limit checks, rate limit checks, etc.

This parameter can be set multiple times.

Example: "example_tag"

Type: String

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 with apikey as your username and your API key as your password.

For advanced options, please see:

https://www.bytescale.com/docs/auth

Type: String

This endpoints requires a multipart form data body.

Type: String

Value: "multipart/form-data"

Arbitrary JSON to store against the file as metadata.

You can retrieve this later via a GetFileDetails request.

Header value must be a complex JSON object, and not wrapped in quotes, e.g. { "hello": "world" }

Type: FileMetadata

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: