Nodeflux Central
Gateway

API Reference — Gateway

Endpoint untuk mengelola IP Whitelist, Whitelist Resource, dan menelusuri Log History request API Gateway.

Semua endpoint memerlukan header Authorization: Bearer <token>. Basis URL mengikuti variabel lingkungan VITE_API_URL yang dikonfigurasi pada instalasi Lenz. Jika Anda belum punya token, lihat halaman Otentikasi.


Whitelist Resource

Whitelist Resource adalah definisi endpoint atau kelompok endpoint yang dilindungi oleh API Gateway. Setiap entri IP Whitelist harus merujuk ke salah satu resource yang terdaftar.

GET
/api/gateway/v1/whitelist/resources

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Query Parameters

page?integer

Nomor halaman, dimulai dari 1.

Default1
page_size?integer

Jumlah item per halaman.

Default20
is_active?boolean

Filter berdasarkan status aktif resource.

sort_by?string

Nama kolom yang digunakan untuk pengurutan, misalnya name atau created_at.

order?string

Arah pengurutan.

Default"DESC"
Value in"ASC" | "DESC"

Response Body

application/json

curl -X GET "https://lenz.example.com/api/gateway/v1/whitelist/resources"
{  "data": [    {      "id": 1,      "name": "Face Recognition",      "route": "/v1/util/face-search/demography",      "description": "Endpoint pencarian wajah dengan data demografi Dukcapil.",      "is_active": true,      "created_at": "2025-01-01T00:00:00Z",      "updated_at": "2025-06-01T08:00:00Z"    },    {      "id": 2,      "name": "Plate Recognition",      "route": "/v1/util/no-pol-korlantas",      "description": "Endpoint pencarian plat nomor kendaraan dari Korlantas.",      "is_active": true,      "created_at": "2025-01-01T00:00:00Z",      "updated_at": "2025-06-01T08:00:00Z"    }  ],  "total": 2,  "page": 1,  "page_size": 20,  "total_pages": 1}
POST
/api/gateway/v1/whitelist/resources

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://lenz.example.com/api/gateway/v1/whitelist/resources" \  -H "Content-Type: application/json" \  -d '{    "name": "NIK Search",    "route": "/v1/util/nik-search"  }'
{  "message": "resource created successfully",  "data": {    "id": 3,    "name": "NIK Search",    "route": "/v1/util/nik-search",    "description": "Pencarian data penduduk berdasarkan NIK.",    "is_active": true,    "created_at": "2026-04-30T08:00:00Z",    "updated_at": "2026-04-30T08:00:00Z"  }}
GET
/api/gateway/v1/whitelist/resources/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik whitelist resource.

Response Body

application/json

application/json

curl -X GET "https://lenz.example.com/api/gateway/v1/whitelist/resources/0"
{  "id": 1,  "name": "Face Recognition",  "route": "/v1/util/face-search/demography",  "description": "Endpoint pencarian wajah dengan data demografi Dukcapil.",  "is_active": true,  "created_at": "2025-01-01T00:00:00Z",  "updated_at": "2025-06-01T08:00:00Z"}
{  "code": 404,  "message": "resource not found"}
PUT
/api/gateway/v1/whitelist/resources/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik whitelist resource.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PUT "https://lenz.example.com/api/gateway/v1/whitelist/resources/0" \  -H "Content-Type: application/json" \  -d '{}'
{  "message": "resource updated successfully",  "data": {    "id": 1,    "name": "Face Recognition (Updated)",    "route": "/v1/util/face-search/demography",    "description": "Versi baru endpoint pencarian wajah.",    "is_active": true,    "created_at": "2025-01-01T00:00:00Z",    "updated_at": "2026-04-30T09:00:00Z"  }}
DELETE
/api/gateway/v1/whitelist/resources/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik whitelist resource.

Response Body

application/json

curl -X DELETE "https://lenz.example.com/api/gateway/v1/whitelist/resources/0"
{  "message": "resource deleted successfully"}

IP Whitelist

Manajemen daftar alamat IP yang diizinkan mengakses endpoint tertentu melalui API Gateway. Setiap entri mengonfigurasi kuota, satuan periode, masa berlaku, dan resource yang dapat diakses.

Alamat IP tidak dapat diubah setelah entri dibuat. Jika perlu mengganti alamat IP, hapus entri lama dan buat entri baru dengan IP yang benar.

GET
/api/gateway/v1/whitelist/ip-addresses

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Query Parameters

page?integer

Nomor halaman, dimulai dari 1.

Default1
limit?integer

Jumlah item per halaman.

Default20
search?string

Pencarian parsial berdasarkan alamat IP, nama resource, atau satuan.

filter[status]?string

Filter berdasarkan status entri.

Value in"active" | "inactive"
filter[type]?integer

Filter berdasarkan whitelist_resource_id.

filter[unit]?string

Filter berdasarkan satuan kuota.

Value in"daily" | "monthly" | "yearly"
filter[ip_address]?string

Filter berdasarkan alamat IP (pencocokan eksak).

filter[valid_after]?string

Filter entri dengan valid_until setelah tanggal tertentu (YYYY-MM-DD).

Formatdate
filter[valid_before]?string

Filter entri dengan valid_until sebelum tanggal tertentu (YYYY-MM-DD).

Formatdate
sort[created_at]?string

Urutkan berdasarkan waktu pembuatan.

Value in"ASC" | "DESC"
sort[ip_address]?string

Urutkan berdasarkan alamat IP.

Value in"ASC" | "DESC"

Response Body

application/json

curl -X GET "https://lenz.example.com/api/gateway/v1/whitelist/ip-addresses"
{  "ok": true,  "message": "successfully get whitelisted ips",  "results": {    "limit": 20,    "current_page": 1,    "total_data": 2,    "total_page": 1,    "whitelisted_ips": [      {        "id": 42,        "ip_address": "203.0.113.45",        "whitelist_resource_id": 1,        "whitelist_resource": {          "id": 1,          "name": "Face Recognition",          "route": "/v1/util/face-search/demography",          "description": "Endpoint pencarian wajah dengan data demografi Dukcapil.",          "is_active": true,          "created_at": "2025-01-01T00:00:00Z",          "updated_at": "2025-06-01T08:00:00Z"        },        "unit": "monthly",        "quota": 1000,        "unlimited_quota": false,        "valid_until": "2026-12-31",        "status": "active",        "created_at": "2025-01-01T08:00:00Z",        "updated_at": "2025-06-15T10:30:00Z"      }    ]  }}
POST
/api/gateway/v1/whitelist/ip-addresses

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://lenz.example.com/api/gateway/v1/whitelist/ip-addresses" \  -H "Content-Type: application/json" \  -d '{    "ip_address": "203.0.113.45",    "whitelist_resource_id": 1,    "unit": "monthly",    "quota": 1000,    "status": "active"  }'
{  "ok": true,  "message": "successfully created whitelisted ip",  "whitelisted_ip": {    "id": 42,    "ip_address": "203.0.113.45",    "whitelist_resource_id": 1,    "whitelist_resource": {      "id": 1,      "name": "Face Recognition",      "route": "/v1/util/face-search/demography",      "description": "Endpoint pencarian wajah dengan data demografi Dukcapil.",      "is_active": true,      "created_at": "2025-01-01T00:00:00Z",      "updated_at": "2025-06-01T08:00:00Z"    },    "unit": "monthly",    "quota": 1000,    "unlimited_quota": false,    "valid_until": "2026-12-31",    "status": "active",    "created_at": "2026-04-30T08:00:00Z",    "updated_at": "2026-04-30T08:00:00Z"  }}
{  "ok": false,  "code": "validation-error",  "errors": [    "ip_address is required"  ],  "message": "validation failed"}
GET
/api/gateway/v1/whitelist/ip-addresses/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik entri IP whitelist.

Response Body

application/json

application/json

curl -X GET "https://lenz.example.com/api/gateway/v1/whitelist/ip-addresses/0"
{  "ok": true,  "message": "successfully get whitelisted ip",  "whitelisted_ip": {    "id": 42,    "ip_address": "203.0.113.45",    "whitelist_resource_id": 1,    "whitelist_resource": {      "id": 1,      "name": "Face Recognition",      "route": "/v1/util/face-search/demography",      "description": "Endpoint pencarian wajah dengan data demografi Dukcapil.",      "is_active": true,      "created_at": "2025-01-01T00:00:00Z",      "updated_at": "2025-06-01T08:00:00Z"    },    "unit": "monthly",    "quota": 1000,    "unlimited_quota": false,    "valid_until": "2026-12-31",    "status": "active",    "created_at": "2025-01-01T08:00:00Z",    "updated_at": "2025-06-15T10:30:00Z"  }}
{  "ok": false,  "code": "not-found",  "errors": [],  "message": "whitelisted ip not found"}
PUT
/api/gateway/v1/whitelist/ip-addresses/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik entri IP whitelist.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X PUT "https://lenz.example.com/api/gateway/v1/whitelist/ip-addresses/0" \  -H "Content-Type: application/json" \  -d '{    "ip_address": "203.0.113.45",    "whitelist_resource_id": 1,    "unit": "monthly",    "quota": 2000,    "status": "active"  }'
{  "ok": true,  "message": "successfully updated whitelisted ip"}
DELETE
/api/gateway/v1/whitelist/ip-addresses/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*integer

ID numerik entri IP whitelist.

Response Body

application/json

curl -X DELETE "https://lenz.example.com/api/gateway/v1/whitelist/ip-addresses/0"
{  "ok": true,  "message": "successfully deleted whitelisted ip"}

On this page