Vertopal
API Menu

Upload from Device

POST /v1/upload/file

Upload the file from the device to Vertopal.

Request

Field Keys

file string<path> required

The field that sends the file.
The value of this field is the local file path in the device.

The example code of this section shows the structure of the Upload from Device request. You may see the other request structure keys such as data keys and see how the request is authenticated.
HTTP
cURL
CLI
Python
PHP
POST https://api.vertopal.com/v1/upload/file
Authorization: Bearer [APP_TOKEN]

data={
    "app": "[APP_ID]"
}
file=@"/path/to/sample.png"
curl -L -X POST 'https://api.vertopal.com/v1/upload/file' \
-H 'Authorization: Bearer [APP_TOKEN]' \
-F 'data={
    "app": "[APP_ID]"
}'
-F 'file=@"/path/to/sample.png"'
vertopal api -v 1 upload/file \
--app "[APP_ID]" \
--token "[APP_TOKEN]" \
-F data='{
    "app": "%app-id%"
}'
file='@/path/to/sample.png'
from vertopal.api.v1 import API

API.upload(
    filename="sample.png",
    filepath="/path/to/sample.png",
    app="[APP_ID]",
    token="[APP_TOKEN]",
)
use Vertopal\API\Credential;
use Vertopal\API\V1;

require "vendor/autoload.php";

$credential = new Credential("[APP_ID]", "[APP_TOKEN]");

V1::upload(
    "sample.png",
    "/path/to/sample.png",
    $credential
);

Response

Output Keys

connector string<uuid>

The connector for connecting to another task as the data key.

name string

The original name of the uploaded file.

size number<integer>

The original size of the uploaded file in bytes.

expires_at string<datetime>

When the uploaded file will be deleted from the Vertopal.

HTTP Status Codes

OK 200

The task has been executed successfully without any errors.

EMPTY_FILE 200

The submitted file is empty.

LIMIT_UPLOAD_SIZE 200

The max size of the file is [MAXSIZE] KB; the current is [FILESIZE] KB.

NOT_VALID_EXTENSION 200

File extension [EXTENSION] is not valid.

ONLY_DEVELOPMENT_FILE 200

The only file with the registered hash is allowed in development.

The example code of this section shows the structure of the Upload from Device response. You may see the other response structure keys such as entity keys.
JSON
{
    "result": {
        "output": {
            "connector": "[CONNECTOR]",
            "name": "sample.png",
            "size": 391517,
            "expires_at": "2023-03-24 05:47:02"
        },
        "error": {},
        "warning": {}
    }
}
Loading, Please Wait...