Upload a file with a single HTTP request:
1curl "https://api.bytescale.com/v2/accounts/{accountId}/uploads/binary" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: text/plain" `# change to match the file's MIME type` \4 -d "Example Data" `# to upload a file: --data-binary @file.jpg`
1{2 "accountId": "YOUR_ACCOUNT_ID",3 "filePath": "/uploads/file.txt",4 "fileUrl": "https://upcdn.io/A623uY2/raw/uploads/file.txt"5}
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
The file name to upload the file with.
Must not contain /.
Supports path variables.
Conditional: only allowed if filePath is not set.
Example: ?fileName=image.jpg
Type: String
Min Length: 0
Max Length: 512
In: Querystring
Required: No
The file name to use if fileName is already taken.
Must not contain /.
Supports path variables.
Conditional: only allowed if fileName is set.
Example: ?fileNameFallback=image.jpg
Type: String
Min Length: 0
Max Length: 512
In: Querystring
Required: No
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
In: Querystring
Required: No
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: ?filePath=/uploads/image.jpg
Type: String
Min Length: 0
Max Length: 512
In: Querystring
Required: No
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: ?folderPath=/uploads
Type: String
Min Length: 0
Max Length: 512
In: Querystring
Required: No
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
In: Querystring
Required: No
The file's original name on the user's device.
Example: ?originalFileName=example.jpg
Type: String
Min Length: 1
Max Length: 255
In: Querystring
Required: No
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: ?tag=example_tag&tag=example_tag
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: Yes
The size of the file (or data) in bytes.
Example: 43182
Type: Integer
Minimum: 0
In: Header
Required: No
The MIME type of the file (or data).
Example: image/jpeg
Type: String
Min Length: 3
Max Length: 255
In: Header
Required: No
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
In: Header
Required: No
This website uses cookies. By continuing you are consenting to the use of cookies per our cookie policy.
This website requires a modern web browser -- the latest versions of these browsers are supported: