Enew Hub
API v1

API Documentation

Reference for integrating Enew Hub files into your application, game, or service.

BASE URLhttps://enewhub.com/api/v1
GETTING STARTED
Quick 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.

  1. 1
    Create a permission group

    Enable only the required actions.

  2. 2
    Create an API User

    Assign it to the group and store the displayed key.

  3. 3
    Validate the connection

    List the root files to confirm the setup.

cURL
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.

HeaderTypeRequiredDescription
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.

Protect your keyDo not publish credentials in repositories, logs, browser JavaScript, or distributed builds.

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.

Headers
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:00

Dates and time zone

A API armazena e retorna timestamps em UTC. Fields ISO terminados em _utc são recomendados para integrações.

STORAGE API
GET List files/files · Root or folder contents

Returns folders and files. Use parent_id to query a specific folder.

ParameterTypeRequiredDescription
parent_idintegerNoFolder ID. When omitted, lists the root.
cURL
curl "https://enewhub.com/api/v1/files?parent_id=42" \
  -H "Accept: application/json" \
  -H "X-API-Key: eh_your_key"
JavaScript
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();
PHP
$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);
200Response
{
  "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.

FieldTypeRequiredDescription
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
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"
200Upload completed
{
  "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.

FieldTypeRequiredDescription
idintegerYesExisting file ID.
filebinaryYesNew content sent as multipart/form-data.
cURL
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"
200File replaced
{
  "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.

ParameterTypeRequiredDescription
idintegerYesFile or folder ID.
Irreversible actionThere is no recycle bin for deletions made through this endpoint.
cURL
curl --request DELETE \
  --url "https://enewhub.com/api/v1/files?id=128" \
  --header "Accept: application/json" \
  --header "X-API-Key: eh_your_key"
200Deletion completed
{
  "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.

ParameterTypeRequiredDescription
idintegerYesID returned by listing or upload.
directbooleanNoDownload directly. When omitted, returns the backward-compatible JSON response.
Direct download
curl --location "https://enewhub.com/api/v1/download?id=128&direct=1" \
  -H "X-API-Key: eh_your_key" \
  --output "game-win64.zip"
Compatible response
curl "https://enewhub.com/api/v1/download?id=128" \
  -H "Accept: application/json" \
  -H "X-API-Key: eh_your_key"
200Response
{
  "url": "https://storage.example.com/...assinatura-temporaria...",
  "endpoint": "https://enewhub.com/api/v1/download?id=128&direct=1",
  "filename": "game-win64.zip"
}
ANALYTICS API
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.

No raw SQLThe API receives structured operations. Enew Hub generates parameterized queries using the organization data source.
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
curl "https://enewhub.com/api/v1/analytics/sources?name=Ranking" \
  -H "Accept: application/json" \
  -H "X-API-Key: eh_your_key"
200Response
{
  "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.

JSON
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.

Lote
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"}
    ]
  }'
200Insert completed
{
  "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.

Query ranking
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"
Delete record
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.

Consulta filtrada
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"
CSV filtrado
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.

Schema
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"}
    ]
  }'
GUIDES AND REFERENCE
C# Unity integrationComplete UnityWebRequest example

For public builds, keep the API key in your backend. Credentials embedded in executables can be extracted.

UnityWebRequest
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
403forbidden

Invalid, revoked, or unauthorized key.

404not_found

File does not exist or belongs to another organization.

422file_required

The file field was not sent.

422id_required

The file or item ID was not sent.

422invalid_file

The file is empty or invalid.

422invalid_name

Invalid name or path.

422duplicate_file

A file with this name already exists.

422max_upload_exceeded

File exceeds the plan limit.

422storage_limit_exceeded

Insufficient storage.

500upload_failed

The upload could not be completed.

500replace_failed

The replacement could not be completed.

500delete_failed

The deletion could not be completed.

429rate_limit_exceeded

Request limit reached.

429monthly_quota_exceeded

Monthly quota exceeded.

Best practicesSecurity and stability checklist
Use HTTPS

Protect the key and data in transit.

Least privilege

Grant only the required permissions.

Separate environments

Use separate keys for testing and production.

Implement backoff

Wait before retrying requests after a 429 response.

Validate responses

Check the HTTP status before parsing JSON.

Revoke keys

Replace exposed credentials immediately.