Your Cart

Your cart is empty.

File API v1

API Documentation

Integrate your FiveM server or external applications with Code Art's secure file hosting system. Authenticate, list, and download files with simple REST calls.

Quick Navigation

Authentication

Every request must include your API Key in the request header:

HTTP Header
Authorization: Bearer YOUR_API_KEY
Without a valid API Key, the server will return a 401 Unauthorized error.

Base URL

Base URL
http://code-art.codes/api/v1

All API endpoints are relative to this base URL.

How to Get Your API Key

Step-by-step Guide

  1. Register or log in to the website.
  2. Go to Dashboard → select your Bot.
  3. Navigate to the Settings tab.
  4. Scroll to API Keys section.
  5. Click Generate Key.
  6. Copy your key and store it safely — it will not be shown again.

Endpoints

GET /api/v1/ping Test your connection and API key

Check that your API key is valid and the server is reachable.

Success Response (200)
JSON
{
  "status": "ok",
  "message": "Connection successful",
  "user": "your_username",
  "bot": "My Bot Name"
}
GET /api/v1/files List all available files

Returns a list of all files uploaded to your bot.

Success Response (200)
JSON
{
  "status": "ok",
  "files": [
    {
      "name": "config.lua",
      "size": "2.45 KB",
      "sizeBytes": 2510,
      "type": "text/x-lua",
      "uploaded_at": "2026-04-01T12:00:00.000Z"
    }
  ]
}
GET /api/v1/files/:filename Download a specific file

Downloads the file content directly. Replace :filename with the actual filename.

Success Response (200)

Returns the raw file content with appropriate Content-Type and Content-Disposition headers.

Error Response (404)
JSON
{
  "status": "error",
  "message": "File not found"
}

Error Codes

Code Meaning Description
401 Unauthorized Missing or invalid API key
403 Forbidden Account suspended
404 Not Found File does not exist
429 Rate Limited Too many requests (60/min)

Rate Limits

The API enforces rate limiting to ensure fair usage and system stability.

60 Requests per minute
10 MB Max file size
30 MB Total storage per bot

Code Examples

JavaScript (Node.js)

JavaScript
const API_KEY = 'ca_your_api_key_here';
const BASE_URL = 'https://yourdomain.com/api/v1';

// Test connection
async function testConnection() {
  const res = await fetch(`${BASE_URL}/ping`, {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  });
  const data = await res.json();
  console.log(data);
}

// List all files
async function listFiles() {
  const res = await fetch(`${BASE_URL}/files`, {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  });
  const data = await res.json();
  console.log(data.files);
}

// Download a specific file
async function downloadFile(filename) {
  const res = await fetch(`${BASE_URL}/files/${filename}`, {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  });
  const blob = await res.blob();
  // Save or process the file...
}

🌙 Lua (FiveM)

Lua
local API_KEY = "ca_your_api_key_here"
local BASE_URL = "https://yourdomain.com/api/v1"

-- Test connection
PerformHttpRequest(BASE_URL .. "/ping", function(code, text, headers)
  if code == 200 then
    print("✅ Connected: " .. text)
  else
    print("❌ Failed: " .. tostring(code))
  end
end, "GET", "", {
  ["Authorization"] = "Bearer " .. API_KEY
})

-- List files
PerformHttpRequest(BASE_URL .. "/files", function(code, text, headers)
  if code == 200 then
    local data = json.decode(text)
    for _, file in ipairs(data.files) do
      print(file.name .. " (" .. file.size .. ")")
    end
  end
end, "GET", "", {
  ["Authorization"] = "Bearer " .. API_KEY
})

-- Download a file
PerformHttpRequest(BASE_URL .. "/files/config.lua", function(code, text, headers)
  if code == 200 then
    -- Save or use the file content
    SaveResourceFile(GetCurrentResourceName(), "downloaded.lua", text, -1)
    print("✅ File downloaded!")
  end
end, "GET", "", {
  ["Authorization"] = "Bearer " .. API_KEY
})

$ cURL

Shell
# Test ping
curl -H "Authorization: Bearer ca_your_api_key" \
  https://yourdomain.com/api/v1/ping

# List files
curl -H "Authorization: Bearer ca_your_api_key" \
  https://yourdomain.com/api/v1/files

# Download a file
curl -H "Authorization: Bearer ca_your_api_key" \
  -o downloaded_file.lua \
  https://yourdomain.com/api/v1/files/config.lua