Menu
🔐

Auth

Authorization: Bearer YOUR_API_TOKEN

📦

Plan Required

Active S3 Object plan. Generate token from client panel → Storage API.

📁

API Bucket

Auto-created S3 Buckets bucket (s3-buckets) when you buy an S3 Object plan. Omit bucket_id on upload.

⚡

Rate Limit

200 requests/minute per account on storage endpoints.

Get started in minutes

Quick Start — REST API Integration

DcloudX exposes a simple REST API for S3 Object storage. Your files are stored on DigitalOcean Spaces (S3-compatible) behind the scenes — you integrate using HTTP requests and Bearer tokens, not raw S3 credentials.

💡

REST API, S3 storage: You call https://dcloudx.net/api/v1. We handle buckets, quotas, billing, and CDN URLs. Work Spaces plans have no REST API — use the web panel instead.

📁

S3 Buckets system bucket: Created automatically when you purchase an S3 Object plan. All API uploads without bucket_id go here. Cloud folder: YOUR_CLIENT_ID/s3-buckets/. This bucket cannot be deleted from the client panel.

Typical website integration flow

Your backend → POST /upload-object → Get object.id + url → <img src=url> → CDN delivers file
1

Create account & buy an S3 Object plan

Register at DcloudX, purchase an active S3 Object storage plan. Your protected S3 Buckets bucket and cloud folder are provisioned automatically.

2

Generate your API token

Client panel → Storage API (or Developers API) → Generate token. Keep it secret — store it in your server environment, never in frontend JavaScript.

3

Upload files from your backend

Send POST https://dcloudx.net/api/v1/upload-object with multipart/form-data and your Bearer token. Files land in S3 Buckets unless you pass bucket_id. Optional: folder for subfolders inside the bucket.

4

Use the CDN URL on your website

Each upload/list response includes a temporary url field. Put that URL in <img src>, <video src>, or download links for fast delivery via CDN.

5

Refresh URLs before they expire

Default URL lifetime is 1 hour. Call GET /objects/{id}/url to get a fresh link, or re-list objects. Store object.id in your database — not the URL alone.

✅

Best practice: Always call the API from your backend (PHP, Laravel, Node.js). Pass only the CDN url to the browser — never expose your API token to visitors.

Security

Authentication

Every request must identify your account. Use the API token generated in your client panel.

Recommended

Authorization: Bearer YOUR_API_TOKEN

Legacy (body)

api_token in JSON or form data

HTTP Header
Authorization: Bearer YOUR_API_TOKEN
⚠️

Never embed your API token in client-side JavaScript, mobile app bundles, or public GitHub repos. Regenerate the token immediately if it is exposed.

API Reference

Endpoints

All paths are relative to https://dcloudx.net/api/v1. Responses are JSON unless noted (download returns binary).

POST /upload-object

Upload a file to your S3 Buckets system bucket (or a specific bucket). Counts against your monthly storage quota.

Content-Type: multipart/form-data

FieldTypeDescription
filefileRequiredThe file to upload (max ~50 MB per request)
folderstringOptionalSubfolder name, e.g. media or products
bucket_idintegerOptionalTarget bucket ID. Omit to use S3 Buckets (s3-buckets).
Response 201
{
  "message": "Object uploaded successfully.",
  "object": {
    "id": 42,
    "file_name": "photo.jpg",
    "mime_type": "image/jpeg",
    "size_bytes": 204800,
    "folder": "media",
    "bucket_id": 1,
    "bucket_name": "S3 Buckets",
    "bucket_slug": "s3-buckets",
    "created_at": "2026-06-14T10:00:00.000000Z",
    "url": "https://your-bucket.blr1.cdn.digitaloceanspaces.com/...",
    "url_expires_at": "2026-06-14T11:00:00+00:00",
    "url_expires_in": 3600
  },
  "usage": {
    "storage_used_bytes": 5242880,
    "storage_quota_gb": 50,
    "object_count": 12,
    "usage_percent": 0.98
  }
}
GET /objects

List your uploaded objects with pagination. Each item includes a CDN url.

QueryTypeDescription
pageintegerOptionalPage number (default: 1)
per_pageintegerOptional20, 50, or 100 (default: 20)
bucket_idintegerOptionalFilter by bucket
GET /objects/{id}/url

Get a fresh temporary CDN URL for an object. Use this for <img src> on your website.

QueryTypeDescription
expires_inintegerOptionalSeconds until expiry. Min 300, max 604800. Default 3600 (1 hour).
Response 200
{
  "object_id": 42,
  "url": "https://your-bucket.blr1.cdn.digitaloceanspaces.com/...?X-Amz-...",
  "expires_at": "2026-06-14T11:00:00+00:00",
  "expires_in": 3600
}
GET /objects/{id}/download

Download file bytes through DcloudX (proxied). Slower than CDN URL — prefer /url for public website delivery.

DELETE /objects/{id}

Permanently delete an object from storage and your account. Frees storage quota.

Response 200
{ "message": "Object deleted successfully." }
GET /storage-usage

Current storage quota usage for your S3 Object plan.

GET /storage-buckets

List all S3 Object buckets for your account. The system bucket S3 Buckets has is_default: true and is used when bucket_id is omitted on upload.

Response 200
{
  "buckets": [
    {
      "id": 1,
      "name": "S3 Buckets",
      "slug": "s3-buckets",
      "is_default": true
    },
    {
      "id": 2,
      "name": "Media Library",
      "slug": "media-library",
      "is_default": false
    }
  ]
}
Data model

Object Response Fields

Returned by upload, list, and embedded in paginated /objects results.

FieldTypeDescription
idintegerUnique object ID — store this in your database
file_namestringOriginal filename
mime_typestringMIME type, e.g. image/jpeg
size_bytesintegerFile size in bytes
folderstring|nullSubfolder if set during upload
bucket_idintegerStorage bucket ID
bucket_namestringHuman-readable bucket name. System bucket: S3 Buckets
bucket_slugstringBucket slug. System bucket: s3-buckets
created_atdatetimeUpload timestamp (ISO 8601)
urlstring|nullTemporary CDN URL for fast delivery
url_expires_atdatetime|nullWhen the CDN URL expires
url_expires_ininteger|nullURL lifetime in seconds
💾

Save id and file_name in your app database. Refresh url via /objects/{id}/url when displaying files — do not treat URLs as permanent.

Fast delivery

CDN Delivery on Your Website

Files are stored privately on DigitalOcean Spaces. The API gives you a signed CDN URL so visitors load media directly from the CDN edge — not through DcloudX servers.

What happens when a visitor opens your page

Browser → CDN URL (from API) → DigitalOcean CDN → File displayed
HTML — image on your site
<!-- url comes from API response — safe to use in HTML -->
<img src="https://your-bucket.blr1.cdn.digitaloceanspaces.com/..." alt="Product photo" />
⏱️
  • Default URL expires after 1 hour — refresh before expiry for long-lived pages.
  • Use /objects/{id}/url?expires_in=86400 for up to 7-day links when needed.
  • Avoid /download for public images — it is slower and loads your API server.
Copy & paste

Integration Examples

Ready-to-copy samples for every endpoint. Examples use YOUR_API_TOKEN — never paste real tokens into public repos. Run upload/delete from your server, not the browser.

🔒

This page is public — no real tokens are embedded. Logged-in clients can use Developers API for auto-filled copy with your account token.

Optional: paste token for copy only

Token stays in your browser memory only — never sent to DcloudX servers, never saved to disk or cookies. When you click Copy, YOUR_API_TOKEN is replaced locally in the clipboard text.

cURL — Upload file

bash
# Omit bucket_id to upload to S3 Buckets (s3-buckets)
curl -X POST https://dcloudx.net/api/v1/upload-object \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "file=@/path/to/photo.jpg" \
  -F "folder=media"

cURL — List objects

bash
curl "https://dcloudx.net/api/v1/objects?page=1&per_page=20" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

cURL — Get CDN URL

bash
curl "https://dcloudx.net/api/v1/objects/123/url?expires_in=3600" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

cURL — Delete object

bash
curl -X DELETE "https://dcloudx.net/api/v1/objects/123" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

cURL — Storage usage

bash
curl "https://dcloudx.net/api/v1/storage-usage" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

cURL — List buckets

bash
curl "https://dcloudx.net/api/v1/storage-buckets" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

PHP — Upload file

php
<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://dcloudx.net/api/v1/upload-object',
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_TOKEN',
    ],
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile('/path/to/photo.jpg', 'image/jpeg', 'photo.jpg'),
        'folder' => 'media',
    ],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
$cdnUrl = $data['object']['url'] ?? null; // use in <img src>

PHP — Delete object

php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://dcloudx.net/api/v1/objects/123',
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_TOKEN'],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);

Laravel — Upload file

php
use Illuminate\Support\Facades\Http;

$response = Http::withToken('YOUR_API_TOKEN')
    ->attach('file', file_get_contents($path), 'photo.jpg')
    ->post('https://dcloudx.net/api/v1/upload-object', [
        'folder' => 'products',
    ]);

$data = $response->json();
$objectId = $data['object']['id'];
$cdnUrl   = $data['object']['url'];

Laravel — Refresh CDN URL

php
$response = Http::withToken('YOUR_API_TOKEN')
    ->get('https://dcloudx.net/api/v1/objects/' . $objectId . '/url', [
        'expires_in' => 3600,
    ]);

$cdnUrl = $response->json('url');

JavaScript (Node) — Upload with FormData

javascript
const form = new FormData();
form.append('file', fileBuffer, 'photo.jpg');
form.append('folder', 'media');

const res = await fetch('https://dcloudx.net/api/v1/upload-object', {
  method: 'POST',
  headers: { Authorization: 'Bearer YOUR_API_TOKEN' },
  body: form,
});
const { object } = await res.json();
console.log(object.url); // CDN link for your website

JavaScript (Fetch) — List objects

javascript
const res = await fetch('https://dcloudx.net/api/v1/objects?page=1', {
  headers: { Authorization: 'Bearer YOUR_API_TOKEN' },
});
const page = await res.json();
// page.data = array of objects, each with .url for CDN

JavaScript (Fetch) — Get CDN URL

javascript
const res = await fetch('https://dcloudx.net/api/v1/objects/123/url?expires_in=3600', {
  headers: { Authorization: 'Bearer YOUR_API_TOKEN' },
});
const { url } = await res.json();
document.querySelector('#hero-image').src = url;

Node.js (Axios) — Upload file

javascript
const FormData = require('form-data');
const fs = require('fs');
const axios = require('axios');

const form = new FormData();
form.append('file', fs.createReadStream('./photo.jpg'));
form.append('folder', 'media');

const { data } = await axios.post('https://dcloudx.net/api/v1/upload-object', form, {
  headers: {
    ...form.getHeaders(),
    Authorization: 'Bearer YOUR_API_TOKEN',
  },
});
console.log(data.object.url);

Python (requests) — Upload file

python
import requests

with open('photo.jpg', 'rb') as f:
    response = requests.post(
        'https://dcloudx.net/api/v1/upload-object',
        headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
        files={'file': ('photo.jpg', f, 'image/jpeg')},
        data={'folder': 'media'},
    )

data = response.json()
cdn_url = data['object']['url']

Python (requests) — List objects

python
import requests

response = requests.get(
    'https://dcloudx.net/api/v1/objects',
    headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
    params={'page': 1, 'per_page': 20},
)
objects = response.json()['data']

HTML — Display image on your website

html
<!-- Get url from API upload/list response (server-side) -->
<img src="PASTE_CDN_URL_FROM_API" alt="Product photo" width="400" />

<!-- Store object.id in your database; refresh url before it expires -->
Troubleshooting

HTTP Status Codes

All error responses include a message field with a human-readable explanation.

401

Missing or invalid API token.

403

No active S3 Object plan, or account suspended.

404

Object not found or file missing in storage.

422

Validation error — bad file, quota exceeded, or invalid parameters.

429

Rate limit exceeded (200 req/min).

503

Storage not configured — contact support.

Error response shape
{
  "message": "An active S3 Object storage plan is required for API access."
}

Ready to integrate?

Create an account, purchase an S3 Object plan, generate your API token, and start uploading in minutes.