OB

OB39 LTD API DOCS

Base URL: https://api.ob39ltd.com/api

API Base

1. Authentication Endpoints

POST /api/register

Registers a new user account and returns a Sanctum Bearer token.

Payload (JSON)
{
  "name": "ocaa joshua",
  "email": "josh@example.com",
  "password": "password123",
  "password_confirmation": "password123"
}
Response (201 Created)
{
  "user": {
    "id": 1,
    "name": "ocaa joshua",
    "email": "josh@example.com",
    "role": "user"
  },
  "token": "1|sanctum_token_hash..."
}
POST /api/login

Authenticates credentials and returns a Bearer token.

Payload (JSON)
{
  "email": "josh@example.com",
  "password": "password123"
}
Response (200 OK)
{
  "user": {
    "id": 1,
    "name": "Econi Joel",
    "email": "ivan@example.com"
  },
  "token": "2|sanctum_token_hash..."
}
GET /api/user Auth Required

Fetches details of the currently authenticated user.

POST /api/logout Auth Required

Revokes active Bearer token.

2. User Management

GET /api/users

Lists all registered users.

{ "current_page": 1, "data": [ { "id": 10, "name": "Harmon Kisa", "email": "kisa@gmail.com", "email_verified_at": null, "created_at": "2026-07-25T12:51:32.000000Z", "updated_at": "2026-07-25T12:51:32.000000Z", "role": "user", "status": "active", "phone": null } ], "first_page_url": "https://ob39-ltd-api.onrender.com/api/users?page=1", "from": 1, "last_page": 3, "last_page_url": "https://ob39-ltd-api.onrender.com/api/users?page=3", "links": [ { "url": null, "label": "Previous", "page": null, "active": false }, { "url": "https://ob39-ltd-api.onrender.com/api/users?page=1", "label": "1", "page": 1, "active": true }, { "url": "https://ob39-ltd-api.onrender.com/api/users?page=2", "label": "2", "page": 2, "active": false }, { "url": "https://ob39-ltd-api.onrender.com/api/users?page=2", "label": "Next", "page": 2, "active": false } ], "next_page_url": "https://ob39-ltd-api.onrender.com/api/users?page=2", "path": "https://ob39-ltd-api.onrender.com/api/users", "per_page": 10, "prev_page_url": null, "to": 10, "total": 22 }
GET /api/users/{user}

Retrieves details for a single user ID.

POST /api/users/update/{user}

Updates profile information for a user ID.

Payload (JSON)
{
  "name": "redis",
  "email": "postman@gmail.com",
  "phone": "0701705888"
}
Response (200 OK)
{
  "message": "user profile updated",
  "profile": {
    "id": 2,
    "name": "redis",
    "email": "postman@gmail.com",
    "email_verified_at": null,
    "created_at": "2026-07-24T18:11:14.000000Z",
    "updated_at": "2026-07-27T08:51:17.000000Z",
    "role": "admin",
    "status": "active",
    "phone": "0701705888"
  }
}

3. Admin Management 🛡️

POST /api/users/delete/{user} Admin / Super Admin Only

Soft deletes or suspends user access.

POST /api/users/create_admin/{user} Admin / Super Admin Only

Grants administrative privileges to a user.

POST /api/users/demote_admin/{user} Admin / Super Admin Only

Revokes admin status from a user.

4. Event Management 📅

GET /api/events Auth Required

Lists all current events.

POST /api/event/create Admin / Super Admin Only

Creates a new event (supports image upload via multipart/form-data).

POST /api/event/destroy/{event} Admin / Super Admin Only

Deletes an existing event.

5. Inquiry Management ✉️

POST /api/inquiry/create Public Access

Submits an inquiry and notifies platform administrators.

GET /api/inquiry Admin / Super Admin Only

Lists submitted client inquiries.

POST /api/inquiry/archive/{inquiry} Admin / Super Admin Only

Archives a processed inquiry.

6. Notifications 🔔

GET /api/notifications Auth Required

Retrieves notification badge count and active notifications list.

POST /api/notifications/mark-all-read Auth Required

Marks all notifications as read for the logged-in user.

DELETE /api/notifications/{id} Auth Required

Removes a specific notification by ID.

7. AI Assistant 🤖

POST /api/ai/chat Public Access

Sends questions to the OB39 LTD AI Assistant agent.

Payload (JSON)
{
  "message": "Who is the CEO of OB39 Ltd?"
}
Response (200 OK)
{
  "success": true,
  "message": "ceo",
  "response": "The Chief Executive Officer (CEO) of OB39 Ltd is **Ocaa Joshua Solomon**."
}

8. Dashboard Statistics 📊

GET /api/dashboard/stats Auth Required Admin / Super Admin / User

Returns dashboard summary cards and chart data used for analytics and monitoring.

Response (200 OK)

{
  "status": "success",

  "data": {

    "cards": {

      "users": {
        "total": 33,
        "active": 22,
        "suspended": 11
      },

      "inquiries": {
        "total": 39,
        "unreplied": 38,
        "replied": 0
      },

      "events": {
        "total": 26,
        "pending": 6,
        "completed": 0
      }

    },


    "charts": {

      "user_registrations_monthly": [
        {
          "month_num": 7,
          "month": "Jul",
          "count": 33
        }
      ],


      "user_growth_trend": [
        {
          "month": "Jul",
          "cumulative_total": 33
        }
      ]

    }

  }
}

7. Audit Logs 📝

GET /api/logs Auth Required

Retrieves system activity logs including user actions, administrative activities, event creation, updates, and other important system operations.

Headers

Authorization: Bearer <token>
Accept: application/json
      
Response (200 OK)

[
 {
   "id": 10,
   "user_id": 1,
   "action": "created_event",
   "body": "Created Agriculture Training Event",
   "created_at": "2026-07-29T10:20:30Z"
 }
]
      
DELETE /api/logs/{id} Auth Required

Deletes an audit log record using its ID.

POST /api/user/unsuspend/{user} Auth Required

unsuspended user

{ "message": "User unsuspend successiful", "user": { "id": 42, "name": "Ivan Okiria", "email": "redis3@gmail.com", "email_verified_at": null, "created_at": "2026-07-28T13:04:42.000000Z", "updated_at": "2026-07-30T05:14:27.000000Z", "role": "user", "status": "active", "phone": null } }