Data Types

BasicUpload

Upload a file with a single HTTP request:

POST /v2/accounts/{accountId}/uploads/binary
cURL
1curl https://api.upload.io/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`
Response (200)
1{
2 "accountId": "YOUR_ACCOUNT_ID",
3 "filePath": "/uploads/file.txt",
4 "fileUrl": "https://upcdn.io/A623uY2/raw/uploads/file.txt"
5}

Request Body

The file's contents.

Response Body

URL Parameters

accountId

Your account ID.

This is visible on the settings page:

https://upload.io/dashboard/settings

Type: String

Length: 7

Example: A623uY2

In: Path

Required: Yes

fileName

The file name to upload the file with.

Must not contain /.

Conditional: only allowed if filePath is not set.

Type: String

Min Length: 0

Max Length: 512

Example: ?fileName=image.jpg

In: Querystring

Required: No

fileNameVariablesEnabled

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

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

Default: true

Type: Boolean

Example: ?fileNameVariablesEnabled=true

In: Querystring

Required: No

filePath

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

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

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

Type: String

Min Length: 0

Max Length: 512

Example: ?filePath=/uploads/image.jpg

In: Querystring

Required: No

folderPath

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

Must begin with / but should not end with /.

Conditional: only allowed if filePath is not set.

Type: String

Min Length: 0

Max Length: 512

Example: ?folderPath=/uploads

In: Querystring

Required: No

folderPathVariablesEnabled

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

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

Default: true

Type: Boolean

Example: ?folderPathVariablesEnabled=true

In: Querystring

Required: No

originalFileName

The file's original name on the user's device.

Type: String

Min Length: 1

Max Length: 255

Example: ?originalFileName=example.jpg

In: Querystring

Required: No

tag

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

You create rules in the Upload 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.

Type: String

Example: ?tag=images/profile&tag=images/profile

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: Yes

Content-Length

The size of the file (or data) in bytes.

Type: Integer

Minimum: 0

Example: 43182

In: Header

Required: No

Content-Type

The MIME type of the file (or data).

Type: String

Min Length: 3

Max Length: 255

Example: image/jpeg

In: Header

Required: No

X-Upload-Metadata

An arbitrary JSON object 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

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: