API Documentation
Reference for integrating Enew Hub files into your application, game, or service.
https://enewhub.com/api/v1Quick startCreate your key and make your first request
Create an API User in the organization settings. The generated key will be used for every request.
- 1Create a permission group
Enable only the required actions.
- 2Create an API User
Assign it to the group and store the displayed key.
- 3Validate the connection
List the root files to confirm the setup.
curl --request GET \
--url "https://enewhub.com/api/v1/files" \
--header "Accept: application/json" \
--header "X-API-Key: eh_your_key"Authentication and permissionsHeaders, security, and access control
Send the key in the X-API-Key header. Each key belongs to an organization and inherits the selected group permissions.
X-API-KeystringYesAPI User key beginning with eh_.AcceptstringRecommendedUse application/json.Actions are independent: View, Upload, Replace, Download, and Delete must be enabled for the API User group. The owner group has every permission.
Usage limits
Every authenticated response returns usage headers for the per-minute limit and the organization monthly quota. Use Retry-After to know how many seconds to wait after a 429 error.
X-RateLimit-Limit: 60
X-RateLimit-Used: 12
X-RateLimit-Remaining: 48
X-RateLimit-Reset: 1781717040
X-RateLimit-Reset-At: 2026-06-17T18:04:00+00:00
X-MonthlyLimit-Limit: 10000
X-MonthlyLimit-Used: 542
X-MonthlyLimit-Remaining: 9458
X-MonthlyLimit-Reset: 1782864000
X-MonthlyLimit-Reset-At: 2026-07-01T00:00:00+00:00Dates and time zone
A API armazena e retorna timestamps em UTC. Fields ISO terminados em _utc são recomendados para integrações.
GET
List files/files · Root or folder contents
Returns folders and files. Use parent_id to query a specific folder.
parent_idintegerNoFolder ID. When omitted, lists the root.curl "https://enewhub.com/api/v1/files?parent_id=42" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"const response = await fetch(
"https://enewhub.com/api/v1/files?parent_id=42",
{ headers: {
"Accept": "application/json",
"X-API-Key": process.env.ENEW_API_KEY
}}
);
const { data } = await response.json();$ch = curl_init("https://enewhub.com/api/v1/files?parent_id=42");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"X-API-Key: " . getenv("ENEW_API_KEY")
]
]);
$data = json_decode(curl_exec($ch), true);{
"data": [{
"id": 42,
"parent_id": null,
"type": "folder",
"name": "Builds",
"mime_type": null,
"size_bytes": 0,
"created_at": "2026-06-10 15:30:00",
"updated_at": "2026-06-10 15:30:00",
"created_at_utc": "2026-06-10T15:30:00+00:00",
"updated_at_utc": "2026-06-10T15:30:00+00:00"
}],
"meta": {
"timezone": "UTC"
}
}
POST
Upload file/upload · Multipart upload with an optional path
Send content as multipart/form-data. Path folders are created automatically. Storage usage is updated when the operation completes.
filebinaryYesFile to be stored.pathstringNoPath such as builds/windows.replacebooleanNoUse 1 to replace a file with the same name. Requires Upload and Replace permissions.curl --request POST \
--url "https://enewhub.com/api/v1/upload" \
--header "Accept: application/json" \
--header "X-API-Key: eh_your_key" \
--form "file=@./build/game-win64.zip" \
--form "path=builds/windows" \
--form "replace=1"{
"ok": true,
"replaced": false,
"file_id": 128,
"name": "game-win64.zip",
"size_bytes": 24832000
}
POST
Replace file/replace · Replaces content while keeping the same ID and name
Replaces an existing file’s content. The system subtracts the previous size, adds the new size, and keeps the file in the same folder. Requires the Replace permission.
idintegerYesExisting file ID.filebinaryYesNew content sent as multipart/form-data.curl --request POST \
--url "https://enewhub.com/api/v1/replace" \
--header "Accept: application/json" \
--header "X-API-Key: eh_your_key" \
--form "id=128" \
--form "file=@./build/game-win64-v2.zip"{
"ok": true,
"replaced": true,
"file_id": 128,
"name": "game-win64.zip",
"old_size": 24832000,
"new_size": 26370000,
"storage_delta": 1538000,
"old_object_deleted": true
}
DELETE
Delete file or folder/files?id=128 · Permanent recursive deletion
Deletes a file or folder. Deleting a folder removes every file and subfolder from storage and the database. Organization usage is reduced by the total deleted bytes. Requires the Delete permission.
idintegerYesFile or folder ID.curl --request DELETE \
--url "https://enewhub.com/api/v1/files?id=128" \
--header "Accept: application/json" \
--header "X-API-Key: eh_your_key"{
"ok": true,
"deleted_items": 6,
"deleted_files": 4,
"deleted_bytes": 26370000
}
GET
Download file/download · Stable endpoint and compatible temporary link
Use the same endpoint with direct=1 to download the content directly from a stable URL. Without this parameter, the previous JSON response remains available for compatibility.
idintegerYesID returned by listing or upload.directbooleanNoDownload directly. When omitted, returns the backward-compatible JSON response.curl --location "https://enewhub.com/api/v1/download?id=128&direct=1" \
-H "X-API-Key: eh_your_key" \
--output "game-win64.zip"curl "https://enewhub.com/api/v1/download?id=128" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"{
"url": "https://storage.example.com/...assinatura-temporaria...",
"endpoint": "https://enewhub.com/api/v1/download?id=128&direct=1",
"filename": "game-win64.zip"
}Analytics permissionsData sources, records, and dashboards
Analytics has permissions separate from Storage. Enable only the required actions in the API User group: view, insert, update, delete, and manage Analytics.
GET
List data sources/analytics/sources · optional search by name
Returns the organization configured data sources. Use name to search for a specific source, such as Ranking.
curl "https://enewhub.com/api/v1/analytics/sources?name=Ranking" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"{
"data": [{
"id": 7,
"name": "Ranking",
"table_name": "enew_ranking",
"schema": [
{"name": "player", "type": "text"},
{"name": "score", "type": "number"}
]
}]
}
POST
Create data source/analytics/sources · can create an external table
Creates a source linked to a connection already registered in the site. If create_table is true, the connection must allow table creation.
curl --request POST "https://enewhub.com/api/v1/analytics/sources" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: eh_your_key" \
--data '{
"connection_id": 3,
"name": "Ranking",
"table_name": "enew_ranking",
"create_table": true,
"fields": [
{"name": "player", "type": "text"},
{"name": "score", "type": "number"},
{"name": "created_at_app", "type": "datetime"}
]
}'
POST
Insert records/analytics/rows?source_id=7 · atomic batch
Inserts one or many records. If any row fails validation or persistence, no row from the batch is saved.
curl --request POST "https://enewhub.com/api/v1/analytics/rows?source_id=7" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: eh_your_key" \
--data '{
"rows": [
{"player": "Ana", "score": 900, "created_at_app": "2026-06-19 15:30:00"},
{"player": "Bruno", "score": 760, "created_at_app": "2026-06-19 15:31:00"}
]
}'{
"ok": true,
"accepted_rows": 2
}
GET
Query and delete records/analytics/rows · read and removal by ID
Query records using source_id ou source_name. Deletion requires Analytics permission and delete permission in the registered connection.
curl "https://enewhub.com/api/v1/analytics/rows?source_name=Ranking&order_by=score&direction=DESC&limit=10" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"curl --request DELETE "https://enewhub.com/api/v1/analytics/rows?source_id=7&row_id=15" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"
GET
Filtros e CSV/analytics/rows e /analytics/rows/csv
Use limit, offset, order_by, direction e filtros estruturados. O CSV usa os mesmos filtros e exporta todos os registros compatÃveis até o limite operacional da API.
curl "https://enewhub.com/api/v1/analytics/rows?source_id=7&limit=100&offset=0&filter_field[]=player&filter_op[]=contains&filter_value[]=Ana" \
-H "Accept: application/json" \
-H "X-API-Key: eh_your_key"curl "https://enewhub.com/api/v1/analytics/rows/csv?source_id=7&separator=;&filter_field[]=score&filter_op[]=gte&filter_value[]=500" \
-H "X-API-Key: eh_your_key" \
--output dados.csv
POST
Alterar colunas/analytics/sources/schema · adicionar, renomear, alterar tipo ou remover
Atualiza a tabela conectada e sincroniza o schema salvo no Enew Hub. Envie old_name para renomear uma coluna existente. Colunas removidas do array também serão removidas da tabela externa quando a conexão permitir.
curl --request POST "https://enewhub.com/api/v1/analytics/sources/schema?source_id=7" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: eh_your_key" \
--data '{
"fields": [
{"old_name": "player", "name": "player_name", "type": "text", "label": "Player"},
{"name": "score", "type": "number", "label": "Score"},
{"name": "device", "type": "text", "label": "Device"}
]
}'Unity integrationComplete UnityWebRequest example
For public builds, keep the API key in your backend. Credentials embedded in executables can be extracted.
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class EnewHubClient : MonoBehaviour
{
[SerializeField] private string apiKey;
private const string BaseUrl = "https://enewhub.com/api/v1";
public IEnumerator ListFiles(int? parentId = null)
{
var url = BaseUrl + "/files";
if (parentId.HasValue)
url += "?parent_id=" + parentId.Value;
using var request = UnityWebRequest.Get(url);
request.SetRequestHeader("Accept", "application/json");
request.SetRequestHeader("X-API-Key", apiKey);
yield return request.SendWebRequest();
Debug.Log(request.downloadHandler.text);
}
}Error codesReturned HTTP statuses and identifiers
forbiddenInvalid, revoked, or unauthorized key.
not_foundFile does not exist or belongs to another organization.
file_requiredThe file field was not sent.
id_requiredThe file or item ID was not sent.
invalid_fileThe file is empty or invalid.
invalid_nameInvalid name or path.
duplicate_fileA file with this name already exists.
max_upload_exceededFile exceeds the plan limit.
storage_limit_exceededInsufficient storage.
upload_failedThe upload could not be completed.
replace_failedThe replacement could not be completed.
delete_failedThe deletion could not be completed.
rate_limit_exceededRequest limit reached.
monthly_quota_exceededMonthly quota exceeded.
Best practicesSecurity and stability checklist
Protect the key and data in transit.
Grant only the required permissions.
Use separate keys for testing and production.
Wait before retrying requests after a 429 response.
Check the HTTP status before parsing JSON.
Replace exposed credentials immediately.