Skip to content

REST API Reference

The gateway exposes a uniform REST interface for all 15 domain services. Every collection shares the same 11-endpoint pattern. This document covers the pattern, all available collections, and curl examples using the identity/users collection.

Base URL: http://localhost:3010

All examples assume:

bash
export TOKEN="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
export BASE="http://localhost:3010"

Standard Endpoint Pattern

Every collection at /{service}/{collection} provides these endpoints:

MethodPathScopeDescription
GET/{service}/{collection}/countread:Count matching documents
POST/{service}/{collection}write:Create one document
POST/{service}/{collection}/bulkwrite:Create many documents
GET/{service}/{collection}read:Find with filters and pagination
GET/{service}/{collection}/cursorread:Stream results via SSE
GET/{service}/{collection}/:idread:Find one by ID
PATCH/{service}/{collection}/:idwrite:Update one by ID
PATCH/{service}/{collection}/bulkmanage:Update many matching filter
DELETE/{service}/{collection}/:idwrite:Soft-delete by ID
PUT/{service}/{collection}/:id/restorewrite:Restore soft-deleted document
DELETE/{service}/{collection}/:id/destroymanage:Hard-delete (permanent)

Scope notation: read: = read:{service}:{collection}, e.g. read:identity:users


Detailed Endpoint Descriptions

GET /count — Count Documents

Returns the total number of documents matching the query filter.

bash
# Count all users
curl "$BASE/identity/users/count?query={}" \
  -H "Authorization: Bearer $TOKEN"

# Count users with a specific email domain
curl "$BASE/identity/users/count" \
  --get \
  --data-urlencode 'query={"email":{"$regex":"@example.com"}}' \
  -H "Authorization: Bearer $TOKEN"

Response:

json
{ "total": 42 }

POST / — Create One Document

bash
curl -X POST "$BASE/identity/users" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "jdoe",
    "email": "jdoe@example.com",
    "password": "Str0ng!Pass",
    "name": "John Doe"
  }'

Response:

json
{
  "data": {
    "id": "64a1b2c3d4e5f6a7b8c9d0e1",
    "username": "jdoe",
    "email": "jdoe@example.com",
    "name": "John Doe",
    "created_at": "2026-05-15T10:00:00.000Z",
    "updated_at": "2026-05-15T10:00:00.000Z"
  }
}

Note: Computed fields (id, created_at, updated_at, created_by, etc.) are platform-managed and must not be sent in the request body.


POST /bulk — Create Many Documents

bash
curl -X POST "$BASE/identity/users/bulk" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "username": "alice", "email": "alice@example.com" },
      { "username": "bob",   "email": "bob@example.com" }
    ]
  }'

Response:

json
{
  "data": [
    { "id": "64a1b2c3...", "username": "alice", ... },
    { "id": "64a1b2c4...", "username": "bob",   ... }
  ],
  "count": 2
}

GET / — Find with Filters

Accepts filter, populate, projection, and pagination as query parameters. See Filtering & Pagination for the complete reference.

bash
# Basic: find all (empty query)
curl "$BASE/identity/users?query={}" \
  -H "Authorization: Bearer $TOKEN"

# With pagination
curl "$BASE/identity/users" \
  --get \
  --data-urlencode 'query={}' \
  --data-urlencode 'pagination={"limit":10,"skip":0,"sort":{"created_at":-1}}' \
  -H "Authorization: Bearer $TOKEN"

# With field projection (include only username and email)
curl "$BASE/identity/users" \
  --get \
  --data-urlencode 'query={}' \
  --data-urlencode 'projection={"username":1,"email":1}' \
  -H "Authorization: Bearer $TOKEN"

# Zone filter: only my own documents
curl "$BASE/identity/users?query={}&zone=own" \
  -H "Authorization: Bearer $TOKEN"

Response:

json
{
  "data": [
    { "id": "64a1b2c3...", "username": "alice", ... },
    { "id": "64a1b2c4...", "username": "bob",   ... }
  ],
  "count": 2
}

GET /cursor — Stream via SSE

Returns a chunked Server-Sent Events stream. See Streaming.

bash
curl -N "$BASE/identity/users/cursor?query={}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: text/event-stream"

GET /:id — Find One by ID

bash
curl "$BASE/identity/users/64a1b2c3d4e5f6a7b8c9d0e1" \
  -H "Authorization: Bearer $TOKEN"

Optionally pass a ref query parameter to look up by the ref string field instead:

bash
curl "$BASE/identity/users/my-ref-slug?ref=true" \
  -H "Authorization: Bearer $TOKEN"

Response:

json
{
  "data": {
    "id": "64a1b2c3d4e5f6a7b8c9d0e1",
    "username": "jdoe",
    "email": "jdoe@example.com",
    "created_at": "2026-05-15T10:00:00.000Z"
  }
}

PATCH /:id — Update One by ID

Only include fields you want to change. Omitted fields are left unchanged.

bash
curl -X PATCH "$BASE/identity/users/64a1b2c3d4e5f6a7b8c9d0e1" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Jonathan Doe" }'

Response: same shape as GET /:id with updated fields.


PATCH /bulk — Update Many Documents

Requires manage: scope. Updates all documents matching the query filter.

bash
curl -X PATCH "$BASE/identity/users/bulk" \
  --get \
  --data-urlencode 'query={"status":"inactive"}' \
  -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "archived": true }'

For PATCH /bulk, pass the filter as query params and the update body as JSON.

Response:

json
{ "total": 5 }

DELETE /:id — Soft Delete

Sets deleted_at on the document. The document is hidden from normal queries but not permanently removed. Requires write: scope.

bash
curl -X DELETE "$BASE/identity/users/64a1b2c3d4e5f6a7b8c9d0e1" \
  -H "Authorization: Bearer $TOKEN"

Response: the soft-deleted document with deleted_at populated.


PUT /:id/restore — Restore a Soft-Deleted Document

Clears deleted_at, making the document visible again. Requires write: scope.

bash
curl -X PUT "$BASE/identity/users/64a1b2c3d4e5f6a7b8c9d0e1/restore" \
  -H "Authorization: Bearer $TOKEN"

DELETE /:id/destroy — Hard Delete (Permanent)

Permanently removes the document from MongoDB. Irreversible. Requires manage: scope.

bash
curl -X DELETE "$BASE/identity/users/64a1b2c3d4e5f6a7b8c9d0e1/destroy" \
  -H "Authorization: Bearer $TOKEN"

All Collections

Auth Service (/auth)

CollectionBase pathDescription
Auths/authAuthentication, token, logout
APTs/auth/aptsAuth Personal Tokens (API keys)
Grants/auth/grantsOAuth permission grants

/auth is special: it provides token/verify/logout/check/can instead of the standard CRUD pattern. See Authentication.

Identity Service (/identity)

CollectionBase pathDescription
Users/identity/usersUser accounts
Profiles/identity/profilesExtended user profile data
Sessions/identity/sessionsActive sessions

Financial Service (/financial)

CollectionBase pathDescription
Accounts/financial/accountsFinancial accounts
Wallets/financial/walletsWallets per account
Invoices/financial/invoicesBilling invoices
Transactions/financial/transactionsPayment transactions
Currencies/financial/currenciesSupported currencies

Career Service (/career)

CollectionBase pathDescription
Businesses/career/businessesBusiness entities
Branches/career/branchesBusiness branches
Employees/career/employeesEmployee records
Products/career/productsProduct catalog
Services/career/servicesOffered services
Stocks/career/stocksInventory
Stores/career/storesStore locations
Customers/career/customersCustomer records

Domain Service (/domain)

CollectionBase pathDescription
Apps/domain/appsOAuth applications
Clients/domain/clientsOAuth clients

Essential Service (/essential)

CollectionBase pathDescription
Sagas/essential/sagasDistributed saga orchestrations
Saga Stages/essential/saga-stagesIndividual saga steps

Context Service (/context)

CollectionBase pathDescription
Configs/context/configsApplication configurations
Settings/context/settingsUser/tenant settings

General Service (/general)

CollectionBase pathDescription
Activities/general/activitiesActivity log entries
Artifacts/general/artifactsGeneric binary artifacts
Comments/general/commentsComment threads
Events/general/eventsCalendar/system events
Workflows/general/workflowsProcess workflow definitions

Special Service (/special)

CollectionBase pathDescription
Files/special/filesFile uploads (public)
Stats/special/statsAggregated statistics

Touch Service (/touch)

CollectionBase pathDescription
Emails/touch/emailsOutbound email records
Notices/touch/noticesIn-app notifications
Pushes/touch/pushesPush notification records
SMS/touch/smsSMS records
Histories/touch/historiesNotification delivery history

Content Service (/content)

CollectionBase pathDescription
Notes/content/notesNotes / rich-text documents
Posts/content/postsPublished posts / articles
Tickets/content/ticketsSupport tickets

Logistic Service (/logistic)

CollectionBase pathDescription
Locations/logistic/locationsGeographic locations
Drivers/logistic/driversDriver profiles
Vehicles/logistic/vehiclesVehicle registry
Travels/logistic/travelsTrip / route records
Cargoes/logistic/cargoesCargo manifests

Conjoint Service (/conjoint)

CollectionBase pathDescription
Accounts/conjoint/accountsMessaging accounts
Channels/conjoint/channelsCommunication channels
Contacts/conjoint/contactsContact entries
Members/conjoint/membersChannel membership
Messages/conjoint/messagesIndividual messages

Thing Service (/thing)

CollectionBase pathDescription
Devices/thing/devicesIoT device registry
Sensors/thing/sensorsSensor definitions
Metrics/thing/metricsSensor metric readings

Response Envelope

All responses are wrapped in a consistent envelope:

Single document

json
{
  "data": { ...document fields... }
}

Collection

json
{
  "data": [ ...documents... ],
  "count": 42
}

Count / total

json
{ "total": 42 }

Boolean result

json
{ "result": true }

Common Fields on Every Document

These fields are platform-managed and present on every entity returned by the API:

FieldTypeDescription
idstringMongoDB ObjectId (as string)
refstringOptional human-readable unique reference
ownerstringMongoId of the owning user
sharesstring[]MongoIds of users with shared access
groupsstring[]Email/FQDN list for group access
clientsstring[]MongoIds of OAuth clients
created_atISO 8601Creation timestamp
updated_atISO 8601Last update timestamp
deleted_atISO 8601 | nullSoft-delete timestamp
versionnumberOptimistic concurrency version
tagsstring[]Free-form tags
propsobjectFree-form extra properties

Swagger UI

The full interactive API documentation with request/response schemas is available at:

http://localhost:3010/api

The raw OpenAPI JSON spec is at:

http://localhost:3010/api-json