๐ก๏ธAuthentication Options
- Session: Login at
/loginin your browser, then call APIs. - API Key: Send header
X-API-Key: <YOUR_KEY>with requests.
โ๏ธSet or Change API Key
- Login at
/loginwith your credentials. - Open /settings/api-key (Settings โ API Key).
- Enter a new key (8+ characters) and Save. It is stored in
.envasAPI_KEY=....
Tip: You can also set
API_KEY directly in your .env file.๐ฅList Images
GET /api/images
Query params: category (optional), name (contains), ext (png|jpg|jpeg|gif|webp), offset (0), limit (100)
curl -H "X-API-Key: <YOUR_KEY>" "http://127.0.0.1:8000/api/images"
Response:
{
"count": 2,
"items": [
{"category": "Inventory", "filename": "image.jpg", "url": "/media_storage/Inventory/image.jpg", "size": 12345, "modified": 1732380234.0}
]
}โฌ๏ธUpload Image
POST /api/images
Form-data: file (binary), category (existing)
curl -H "X-API-Key: <YOUR_KEY>" -F "category=Inventory" -F "file=@C:\\path\\to\\image.jpg" http://127.0.0.1:8000/api/images
Response:
{"category":"Inventory","filename":"image.jpg","url":"http://127.0.0.1:8000/media_storage/Inventory/image.jpg"}๐๏ธDelete Image
DELETE /api/images/{category}/{filename}
curl -H "X-API-Key: <YOUR_KEY>" -X DELETE "http://127.0.0.1:8000/api/images/Inventory/image.jpg"
Response: 204 No Content on success.
๐Security Tips
- Use long, random API keys and rotate them if exposed.
- Prefer HTTPS when exposing your server on a network.
- Restrict access to the server to trusted clients only.
๐ฎFiveM screenshot-basic Integration
The citizenfx/screenshot-basic resource can upload client screenshots directly to this server.
Since it canโt send custom headers, use the query param key with your API key.
Endpoint: POST /api/screenshot-upload?category=Inventory&key=YOUR_KEY
- Multipart field name: any (e.g.
file,files[]) โ the server detects the first file. - Category: via query (
category) or form fieldcategory. Defaults toUncategorized. - Auto-creates the category folder if it doesnโt exist.
Client example (Lua):
-- fxmanifest includes 'screenshot-basic' as a dependency