Skip to content

Backend Base Integration Guide

KISUM PLATFORM — BASE BACKEND INTEGRATION GUIDE

Section titled “KISUM PLATFORM — BASE BACKEND INTEGRATION GUIDE”

Version: 1.0.0
Audience: junior frontend developers, junior backend developers, QA, partners
Status: integration guide


This document explains how to call the Base Backend correctly in the new architecture.

It covers:

  • how auth works from the caller point of view
  • how to send Authorization
  • how to send x-org
  • what sequence to follow
  • how to think about errors
  • working request examples
  • what not to do

This is the “how to integrate” document.

For full architecture, see:

  • KISUM_BASE_ARCHITECTURE.md

For the API catalog, see:

  • KISUM_BASE_API.md

You do not log in through Base Backend.

You:

  1. authenticate through Auth Backend
  2. obtain a JWT
  3. choose the active company
  4. call Base Backend with:
    • Authorization: Bearer <JWT>
    • x-org: <COMPANY_ID>

Base Backend then:

  • validates the JWT
  • validates x-org
  • resolves effective access from Auth
  • checks basic module
  • checks permission
  • allows or denies the route

Every protected request must include:

Authorization: Bearer <JWT_FROM_AUTH_SERVICE>
x-org: <COMPANY_ID>
Content-Type: application/json

Must be a token issued by Auth.

Must be the active company ID for the request.

Usually application/json, unless the route uses uploads.


The user signs in through Auth, not Base.

Result:

  • JWT token
  • authenticated user session

Caller can use Auth-side identity endpoints as needed.

The UI or caller determines the current company context.

That value is then sent in:

x-org: <COMPANY_ID>

Send the business request with:

  • JWT
  • x-org

Base validates:

  • JWT
  • x-org
  • effective access from Auth
  • basic module
  • permission

Terminal window
curl -X GET 'http://localhost:3099/api/events?type=all&page=1&limit=20' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>'
  • token valid
  • company exists in user access scope
  • basic module enabled
  • user has event view permission
  • success → 200
  • bad token → 401
  • bad company → 400 or 403
  • no access → 403
  • access resolution unavailable → 503

Terminal window
curl -X GET 'http://localhost:3099/api/artists' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>'
Terminal window
curl -X POST 'http://localhost:3099/api/agencies' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>' -H 'Content-Type: application/json' -d '{
"key": "agency-001",
"name": "Example Agency"
}'
Terminal window
curl -X PUT 'http://localhost:3099/api/agencies/{id}' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>' -H 'Content-Type: application/json' -d '{
"name": "Updated Agency Name"
}'
Terminal window
curl -X DELETE 'http://localhost:3099/api/agencies/{id}' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>'
Terminal window
curl -X POST 'http://localhost:3099/api/files/upload' -H 'Authorization: Bearer <JWT>' -H 'x-org: <COMPANY_ID>' -F 'file=@example.pdf'

Base is not the login service.

If the route is tenant-scoped, x-org is required.

The UI or calling layer must know the active company and send it explicitly.

Just because a button is visible or hidden does not mean the backend will allow the route.

Do not use:

  • Auth
  • Users
  • Company Users
  • Invitations
  • Teams
  • Packages
  • Permissions
  • Role
  • Subscription

Those moved to Auth/Core.


Usually means:

  • missing x-org
  • malformed x-org
  • bad request payload

Usually means:

  • missing token
  • invalid token
  • expired token
  • token rejected during validation

Usually means:

  • membership not valid for x-org
  • basic module missing
  • permission missing

Usually means:

  • Base could not resolve effective access from Auth
  • Auth service unavailable
  • network failure / timeout between services

503 must not become temporary access.
The request must fail closed.


Do not do any of the following:

  • call /auth/* on Base
  • use Base as the source of identity
  • use Base as the source of package/subscription truth
  • infer access from the JWT alone
  • assume company from frontend state without sending x-org
  • silently retry with a different company
  • bypass permission checks because a user is “probably admin”

A typical frontend flow should look like this:

  1. User signs in with Auth
  2. Frontend stores current JWT securely
  3. Frontend gets or already knows active company
  4. Frontend calls Base with JWT + x-org
  5. If route denied:
    • show proper error
    • do not guess fallback
  6. If 503:
    • show service unavailable / retry flow
    • do not fake access

If another internal backend calls Base on behalf of a user:

  1. obtain or forward a valid Auth-issued JWT
  2. send explicit x-org
  3. call Base route
  4. respect 401 / 403 / 503
  5. do not add local bypass logic

Examples of route-level access expectations:

  • GET /dashboardbasic.dashboard.view
  • GET /artistsbasic.artist.view
  • POST /artistsbasic.artist.create
  • PUT /artists/{id}basic.artist.edit
  • DELETE /artists/{id}basic.artist.delete
  • GET /eventsbasic.event.view
  • POST /eventsbasic.event.create
  • PUT /events/{id}basic.event.edit
  • DELETE /events/{id}basic.event.delete
  • GET /vendorsbasic.vendor.view
  • POST /vendorsbasic.vendor.create
  • GET /venuesbasic.venue.view

These examples are helpful for integration teams even if the exact permission map is maintained elsewhere.


13. Active route families commonly used by integrations

Section titled “13. Active route families commonly used by integrations”

Integrations will most often use:

  • Agencies
  • Agreements
  • Ai
  • Approval
  • Artists
  • Avails
  • Companies (business metadata only)
  • Dashboard
  • Events
  • Event Expense
  • Event Expense - Approval
  • Event Income
  • Event Ticket
  • Files
  • Notifications
  • Offer
  • Tasks
  • Vendors
  • Venues
  • Xero

For full route group listing, see:

  • KISUM_BASE_API.md

If a request fails:

Is the token present?

Is the token issued by Auth and still valid?

Is x-org present?

Is x-org the intended company?

Does the user belong to that company?

Does the user have basic module?

Does the user have the specific basic.* permission?

Is Auth reachable for effective access resolution?


To call Base successfully, always think:

Auth first
Company context second
Base business route third

If any of those are wrong, the request should fail.