Ubidots Developer Guides
Help CenterAPI ReferenceData APICommunity
  • Welcome to our Dev Guides
  • ⚡️ Getting Started
    • What is Ubidots?
    • Devices, Variables, and Dots
    • Technical FAQs
    • Business FAQs
  • 🧩Integration Guides
    • Industrial IoT
      • Advantech
      • Amplified Engineering
      • AWS
      • Azimut
      • Balena
      • Bivocom
      • CESVA
      • Controllino
      • Digital Communications Technologies (DCT)
      • Everactive
      • Golioth
      • Kepware
      • Kunbus
      • Monnit
      • MultiTech
      • NCD.io
      • Node-RED
      • Omicron IoT
      • Red Lion
      • Robustel
      • Senquip
      • Sielco
      • Siemens
      • Strega
      • vNode
      • WAGO
      • Weintek
      • YuDash
    • Cellular
      • Blues Wireless
      • Digi International
      • Hologram
      • Monogoto
      • Particle
      • Quectel
      • Soracom
    • LoRaWAN
      • AonChip
      • Chirpstack
      • Decentlab
      • Helium
      • ioThings
      • LORIOT
      • Milesight
      • MOKOSmart
      • RAKwireless
      • Sagemcom
      • Seeed Studio
      • Senet
      • The Things Industries
        • The Things Stack
        • The Things Network
    • Sigfox
      • Digital Matter
      • McThings
      • Sigfox
      • Suntech
      • Thinxtra
      • UnaBiz
    • Satellite
      • Swarm
    • Dev Kits
      • Adafruit
      • Advantech
      • AloriumTech
      • Arduino
      • Blues Wireless
      • DFRobot
      • Dragino
      • Electric Imp
      • Espressif Systems
      • McThings
      • Microchip Technology
      • Onion
      • Particle
      • Pycom
      • RAKwireless
      • Raspberry Pi
      • Seeed Studio
      • Sodaq
      • STMicroelectronics
      • Texas Instruments
      • Thinxtra
      • Verse Technology
    • Weather
      • Weather Plugins
      • Ambient Weather
    • Tools
      • Gambit Communications
      • PubNub
  • 📊Dashboards & Widgets
    • HTML Canvas
      • 3rd party packages
      • Preload Dashboard data
      • Built-in library
        • Properties
        • Methods
        • Listening events
        • API
      • Examples
        • Basics
        • Create an LCD screen with the HTML Canvas
        • Interacting with dashboard data
        • Change header's custom style
        • Adding real time using Socket.IO
        • Delete Variable data from a Device
        • Delete Variable data from Groups or Types of Devices
        • Navigation through Dashboard
        • Using a React library
      • Code editor
        • HTML Tab
        • CSS Tab
        • JavaScript Tab
    • Custom UI
      • Paragraph
      • Input combo
        • Text
        • Numeric
        • Numeric with buttons
        • Date
        • Time
        • Toggle
        • Dropdown
        • Multiple selection dropdown
      • Button
    • Custom Style
      • Dashboards
      • Widgets
    • Line chart
    • Pages
      • Getting started
      • Development
      • API
        • Page creation
        • Publish
  • 🤖UbiFunctions
    • Getting Started
      • Creating an UbiFunction
      • Coding an UbiFunction
      • Testing an UbiFunction
      • Authentication
      • Execution Time
      • Logs
    • Runtimes
      • Python
      • NodeJS
      • Custom Runtimes
    • Invocation
      • Time-based Trigger
      • HTTPS
      • MQTT Publish
      • Ubidots Event
    • Advanced
      • Account Token
      • Execution time
      • Raw Functions
      • CORS Policy
      • Async Execution
      • DaaS (Decoder as a Service)
      • Developing and Managing UbiFunctions with Ubidots CLI
    • Examples
    • Specs and Limits
    • Storage
      • File Storage API
      • Mutiple files
  • 🧩Plugins
    • What is a plugin?
    • Public vs. Private
    • Public plugins
      • Cron
      • Webhook
    • Private Plugins
      • Cron
      • Webhook
      • Widget
      • Device
    • Plugins development
      • Getting started
      • Cron
      • Webhook
      • Widget
      • Device
      • view.xml
      • view_widget.xml
    • Plugins deployment
      • Cron and Webhook
      • Widget
      • Device
    • Using the plugins
      • Cron and Webhook
      • Widget
      • Device
  • 📈SYNTHETIC VARIABLES
    • Getting started
      • Creating synthetic variables
      • Synthetic Variables' editor
    • Expressions
      • Mathematical
      • Date range
      • Rolling
      • Special functions
    • Specs and limits
    • Examples
      • Mathematical
      • Date range
      • Rolling
      • Special functions
  • ⌨️Developer tools
    • Javascript SDK
      • Overview
      • Getting started
      • Ubidots class
        • Get methods
        • Filter methods
        • Ubidots objects
          • Entity object
          • Paginator
      • Examples
    • CLI
      • Overview
      • Installing
      • Usage
      • SDK for UbiFunctions
  • 🏗️Apps
    • App builder
      • Custom sidebar
Powered by GitBook
On this page
  • Overview
  • Storage & Security Constraints
  • Supported API Operations
  • API Response Codes

Was this helpful?

Export as PDF
  1. UbiFunctions
  2. Storage

File Storage API

The Ubidots File Storage API enables account owners to securely upload, retrieve, manage, and delete files within Ubifunctions.

Overview

The Ubidots File Storage API provides a secure and efficient way for users to store and manage files within their Ubidots accounts. This service is available from the Industrial license onwards and is designed to offer seamless integration for file storage, retrieval, and management.

Storage & Security Constraints

To ensure optimal usage and security, the following limitations apply:

Storage Limit: Each Ubidots account is allocated 50MB of storage.

Restricted File Extensions: To enhance security, potentially malicious file types are blocked. The following extensions are not allowed:

.js, .exe, .sh, .php, .bat, .cmd, .msi, .vbs, and other executable/script files.

Request Rate Limit

The API enforces a maximum of 5 requests per second per client IP to ensure fair usage and system stability. Excessive requests beyond this limit will result in a 429 Too Many Requests response.

Filename Rules: Only the following characters are allowed in filenames:

  • Letters (a-z, A-Z)

  • Numbers (0-9)

  • Underscores (_), dashes (-), and dots (.)

Token Authentication: All API requests must include an X-Auth-Token in the header for authentication. Only account-level tokens are accepted (organization and device tokens are rejected).

Supported API Operations

1️Uploading a File

Upload a file to your Ubidots storage.

API Endpoint:

POST https://files.api.ubidots.com/files/{username}/{filename}

Example Request (cURL)

curl -X POST "https://files.api.ubidots.com/files/yourusername/file.txt" \
     -H "X-Auth-Token: YOUR_AUTH_TOKEN" \
     -F "file=@path/to/your/file.txt"

Example Response

{
    "message": "File uploaded successfully",
    "filename": "file.txt",
    "username": "yourusername",
    "used_storage_mb": "10.5"
}

2️Downloading a File

Retrieves a file from your Ubidots storage.

API Endpoint:

GET https://files.api.ubidots.com/files/{username}/{filename}

Example Request (cURL)

curl -X GET "https://files.api.ubidots.com/files/yourusername/testfile1.txt" \
     -H "X-Auth-Token: YOUR_AUTH_TOKEN" \
     -o fileDownloaded.txt

Response:

✅ If successful (200 OK): The file is downloaded. ❌ If the file does not exist (404 Not Found):


3️Deleting a File

Removes a file from your storage.

API Endpoint:

DELETE https://files.api.ubidots.com/files/{username}/{filename}

Example Request (cURL)

curl -X DELETE "https://files.api.ubidots.com/files/yourusername/test1.txt" \
     -H "X-Auth-Token: YOUR_AUTH_TOKEN"

Example Response

{
    "message": "File 'test1.txt' deleted successfully"
}

4️Listing All Files

Retrieves a list of all stored files and current storage usage.

API Endpoint:

GET https://files.api.ubidots.com/files/{username}

Example Request (cURL)

curl -X GET "https://files.api.ubidots.com/files/yourusername" \
     -H "X-Auth-Token: YOUR_AUTH_TOKEN"

Example Response

{
    "username": "yourusername",
    "total_files": 2,
    "used_storage_mb": 18.42,
    "remaining_storage_mb": 31.58,
    "files": [
        {"filename": "test1.txt", "size_mb": 8.42},
        {"filename": "backup.zip", "size_mb": 10.0}
    ]
}

API Response Codes

Each API operation returns specific HTTP status codes based on the request outcome:

Status Code

Description

200 OK

Request was successful (file uploaded, downloaded, listed, or deleted).

400 Bad Request

The request contained invalid parameters, such as an incorrect filename.

401 Unauthorized

The provided X-Auth-Token is missing or invalid.

403 Forbidden

The user is not authorized to access this resource (wrong username or insufficient permissions).

404 Not Found

The requested file does not exist in the storage.

413 Payload Too Large

The file exceeds the maximum storage limit of 50MB.

415 Unsupported Media Type

The file has a restricted extension and cannot be uploaded.

429 Too Many Requests

Exceeded the limit of 5 requests per second from the same client IP or token.

500 Internal Server Error

An unexpected error occurred on the server (e.g., S3 failure or token validation issue).

503 Service Unavailable

The authentication service or storage backend is temporarily unreachable.

PreviousStorageNextMutiple files

Last updated 3 months ago

Was this helpful?

🤖