डेवलपर प्लेटफॉर्म · API v1

FileMoon API दस्तावेज़

सुरक्षित uploads, remote video import, file management और HLS processing को अपनी application में जोड़ें।

Base URLhttps://filemoon.org/api/v1
API Token बनाएं
API v1
FileMoon REST API

परिचय

FileMoon API एक JSON आधारित HTTP API है, जिससे uploads automate किए जा सकते हैं, अपनी files manage की जा सकती हैं और authorized direct video URLs import किए जा सकते हैं।

Base URLhttps://filemoon.org/api/v1
मौजूदा versionv1
Content-Typeapplication/json / multipart/form-data
Security: हर request के लिए HTTPS उपयोग करें। Token को public code, screenshot, repository या shared logs में expose न करें।
शुरुआत

ऑथेंटिकेशन

Authorization header में Bearer scheme के साथ FileMoon access token भेजें।

HTTP Headers
Authorization: Bearer YOUR_FILEMOON_TOKEN
Accept: application/json
User Panel → API & Remote Upload से token बनाएं। पूरा token सिर्फ एक बार दिखाई देता है।

Token permissions

files:readअकाउंट, files और status पढ़ें।
files:writeअपनी files upload, update और delete करें।
remote:writeRemote jobs create, cancel और retry करें।
HTTP 429

Request limits

Limits हर token और IP पर लागू होती हैं। Active limit response headers में आती है और 60 requests per minute से अधिक नहीं हो सकती।

Response Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
Retry-After: 12
X-Request-ID: 2c7c4d7a-0e4d-4d92-bb53-e32f1e705dda
HTTP 429 के बाद Retry-After के अनुसार इंतजार करें।
शुरुआत

अकाउंट जानकारी

Authenticated account, कुल files, storage usage और remote-job counters return करता है।

GET /account

Parameters

कोई request parameters नहीं।

Request example

cURL
curl -sS "https://filemoon.org/api/v1/account" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response example

200 JSON
{
  "success": true,
  "data": {
    "id": "rk9zKY45m0lY",
    "username": "example_user",
    "email": "[email protected]",
    "status": true,
    "files": 20,
    "storage_bytes": 1846721934,
    "remote_jobs": {
      "pending": 0,
      "running": 0,
      "completed": 1,
      "failed": 0
    }
  }
}
Files

Files की सूची

Paginated list return करता है। नाम से filter करने के लिए search उपयोग करें।

GET /files

Parameters

FieldTypeजरूरीविवरण
search string वैकल्पिक Filter by name or stored filename. Maximum 255 characters.
page integer वैकल्पिक Pagination page. Minimum 1.
per_page integer वैकल्पिक Results per page. Default 25, maximum 100.

Request example

cURL
curl -sS "https://filemoon.org/api/v1/files?search=sample&per_page=25&page=1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response example

200 JSON
{
  "success": true,
  "data": [
    {
      "id": "0JgG7vRZzoYW",
      "name": "sample-video",
      "filename": "sample-video.mp4",
      "mime": "video/mp4",
      "extension": "mp4",
      "size_bytes": 1520849,
      "visibility": "public",
      "password_protected": false,
      "allow_online_watch": true,
      "downloads": 0,
      "stream_views": 0,
      "urls": {
        "page": "https://filemoon.org/0JgG7vRZzoYW/file",
        "watch": "https://filemoon.org/0JgG7vRZzoYW/watch",
        "embed": "https://filemoon.org/0JgG7vRZzoYW/embed"
      }
    }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 1,
    "per_page": 25,
    "total": 1
  }
}
Files

File जानकारी

Public FileMoon ID से अपनी एक file return करता है।

GET /files/{id}

Parameters

FieldTypeजरूरीविवरण
id string (path) हां Public FileMoon file ID owned by the authenticated account.

Request example

cURL
curl -sS "https://filemoon.org/api/v1/files/0JgG7vRZzoYW" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
Files

File और HLS status

File information के साथ HLS conversion status return करता है।

GET /files/{id}/status

Parameters

FieldTypeजरूरीविवरण
id string (path) हां Public FileMoon file ID owned by the authenticated account.

Request example

cURL
curl -sS "https://filemoon.org/api/v1/files/0JgG7vRZzoYW/status" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response example

200 JSON
{
  "success": true,
  "data": {
    "file": {
      "id": "0JgG7vRZzoYW",
      "name": "sample-video",
      "allow_online_watch": true
    },
    "conversion": {
      "status": "completed",
      "stage": "adaptive",
      "attempts": 1,
      "duration_seconds": 42,
      "error": null,
      "updated_at": "2026-07-18 19:20:00"
    }
  }
}
Files

Local file upload

multipart/form-data से upload करें। file जरूरी है; visibility में 1 या 0 भेजें।

POST /files/upload

Parameters

FieldTypeजरूरीविवरण
file binary हां Local file attached as multipart/form-data.
visibility boolean वैकल्पिक Use 1 for public or 0 for private.

Request example

cURL
curl -sS -X POST "https://filemoon.org/api/v1/files/upload" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -F "file=@/path/to/video.mp4" \
  -F "visibility=1"
Files

File update

Supported metadata बदलें। केवल बदलने वाले fields भेजें।

PATCH /files/{id}

Parameters

FieldTypeजरूरीविवरण
id string (path) हां Public FileMoon file ID.
name string वैकल्पिक New file name. Maximum 255 characters.
description string|null वैकल्पिक File description. Maximum 1000 characters.
visibility boolean वैकल्पिक Public or private visibility.
allow_online_watch boolean वैकल्पिक Enable or disable online video watch.
password string|null वैकल्पिक Set, change or remove the file password.

Request example

cURL
curl -sS -X PATCH "https://filemoon.org/api/v1/files/0JgG7vRZzoYW" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "updated-video-name",
    "description": "Updated through FileMoon API",
    "visibility": true,
    "allow_online_watch": true
  }'
Files

File delete

File और related data हमेशा के लिए delete करता है।

DELETE /files/{id}

Parameters

FieldTypeजरूरीविवरण
id string (path) हां Public FileMoon file ID.

Request example

cURL
curl -sS -X DELETE "https://filemoon.org/api/v1/files/0JgG7vRZzoYW" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
Remote upload

Remote jobs बनाएं

एक या अधिक direct URLs queue में डालें। HTTP 202 का मतलब background processing के लिए accept हो गए।

Public direct HTTP/HTTPS media URLs स्वीकार करता है। Private networks, localhost, cloud metadata, unsafe redirects, scripts और non-video responses block होते हैं।
POST /remote-uploads

Parameters

FieldTypeजरूरीविवरण
urls array<string> हां One or more public direct HTTP/HTTPS media URLs.
name string|null वैकल्पिक Custom file name. Maximum 240 characters.
description string|null वैकल्पिक Description. Maximum 1000 characters.
folder_id integer|null वैकल्पिक Folder ID owned by the authenticated user.
visibility boolean वैकल्पिक Public or private file.
allow_online_watch boolean वैकल्पिक Allow online video playback.
password string|null वैकल्पिक Optional file password.
blocked_countries array<string> वैकल्पिक Two-letter country codes. Maximum 50 entries.

Request example

cURL
curl -sS -X POST "https://filemoon.org/api/v1/remote-uploads" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://cdn.example.com/video.mp4"],
    "name": "remote-video",
    "description": "Imported through FileMoon API",
    "visibility": true,
    "allow_online_watch": true,
    "blocked_countries": ["US", "GB"]
  }'

Response example

202 JSON
{
  "success": true,
  "message": "Remote upload job(s) queued.",
  "data": [
    {
      "id": "d96f9d69-1d44-42eb-89e3-5a62b052e77d",
      "host": "cdn.example.com",
      "name": "remote-video",
      "status": "pending",
      "stage": "queued",
      "attempts": 0,
      "bytes_downloaded": 0,
      "bytes_total": null,
      "progress_percent": null,
      "error": null,
      "file_id": null
    }
  ]
}

Job status values

pendingrunningcompletedfailedcancelled
Remote upload

Remote jobs की सूची

Account के remote jobs की paginated list return करता है।

GET /remote-uploads

Parameters

FieldTypeजरूरीविवरण
page integer वैकल्पिक Pagination page.
per_page integer वैकल्पिक Default 25, maximum 100.

Request example

cURL
curl -sS "https://filemoon.org/api/v1/remote-uploads?per_page=25&page=1" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
Remote upload

Remote upload status

Progress, stage, error और बनी FileMoon file ID return करता है।

GET /remote-uploads/{id}

Parameters

FieldTypeजरूरीविवरण
id UUID (path) हां Remote-upload job ID.

Request example

cURL
curl -sS "https://filemoon.org/api/v1/remote-uploads/d96f9d69-1d44-42eb-89e3-5a62b052e77d" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response example

200 JSON
{
  "success": true,
  "data": {
    "id": "d96f9d69-1d44-42eb-89e3-5a62b052e77d",
    "host": "cdn.example.com",
    "name": "remote-video",
    "status": "completed",
    "stage": "completed",
    "attempts": 1,
    "bytes_downloaded": 1520849,
    "bytes_total": 1520849,
    "progress_percent": 100,
    "error": null,
    "file_id": "0JgG7vRZzoYW"
  }
}
Remote upload

Remote job cancel

Pending job cancel करें या running job के cancellation की request भेजें।

POST /remote-uploads/{id}/cancel

Parameters

FieldTypeजरूरीविवरण
id UUID (path) हां Remote-upload job ID.

Request example

cURL
curl -sS -X POST "https://filemoon.org/api/v1/remote-uploads/JOB_ID/cancel" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
Remote upload

Remote job retry

Failed या cancelled job को reset करके queue में डालता है।

POST /remote-uploads/{id}/retry

Parameters

FieldTypeजरूरीविवरण
id UUID (path) हां Remote-upload job ID.

Request example

cURL
curl -sS -X POST "https://filemoon.org/api/v1/remote-uploads/JOB_ID/retry" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
HTTP

Errors और status codes

Errors consistent JSON structure उपयोग करते हैं। Support के लिए request_id रखें।

401
UNAUTHENTICATED

Missing or invalid Bearer token.

403
TOKEN_DISABLED / TOKEN_EXPIRED

Token disabled, expired, IP blocked or missing permission.

404
NOT_FOUND

Owned file or remote job could not be found.

409
REMOTE_JOB_NOT_CANCELLABLE

The job can no longer be cancelled.

422
VALIDATION_ERROR

Request fields or uploaded file are invalid.

429
RATE_LIMITED

Too many requests. Use Retry-After.

503
API_DISABLED

The administrator temporarily disabled the API.

Response example

Error JSON
{
  "success": false,
  "error": {
    "code": "TOKEN_ABILITY_DENIED",
    "message": "The token does not have the required permission."
  },
  "request_id": "2c7c4d7a-0e4d-4d92-bb53-e32f1e705dda"
}
Reference

सुरक्षा आवश्यकताएं

API integrate करते समय ये नियम लागू करें।

Tokens trusted server पर रखें और exposed token तुरंत revoke करें।
Minimum required permissions दें।
जहां संभव हो trusted IP या CIDR restriction लगाएं।
केवल authorized content upload करें।
cURL · PHP · JavaScript

Client examples

cURL, PHP और server-side JavaScript के छोटे examples।

cURL
curl -sS "https://filemoon.org/api/v1/account" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
PHP 8+
<?php
$token = getenv('FILEMOON_API_TOKEN');

$ch = curl_init('https://filemoon.org/api/v1/account');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $token,
        'Accept: application/json',
    ],
    CURLOPT_TIMEOUT => 30,
]);

$response = curl_exec($ch);
if ($response === false) {
    throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
if ($status >= 400) {
    throw new RuntimeException($data['error']['message'] ?? 'API request failed');
}
print_r($data);
Node.js / Server-side JS
const token = process.env.FILEMOON_API_TOKEN;

const response = await fetch('https://filemoon.org/api/v1/account', {
  headers: {
    Authorization: `Bearer ${token}`,
    Accept: 'application/json'
  }
});

const data = await response.json();
if (!response.ok) {
  throw new Error(data?.error?.message || 'API request failed');
}
console.log(data);
ऊपर जाएं