Skip to main content

Introduction to API Integration Guide

Let's discover M-Hub in less than 5 minutes.

Getting Started

Follow these steps to integrate the API into your system:


1. Get Your Company's Subdomain

  • Each company has a unique subdomain. You will find it in the URL when using the system.
  • Format:
    https://<company>.m-api.souqbox.io
    Example:
    https://example.m-api.souqbox.io

2. Authenticate and Generate Token

  • Use the Login API to get your authentication token.

  • Endpoint:

    POST https://<company>.m-api.souqbox.io/api/v1/admin/staff/login
  • Request Body Example:

    {
    "email": "your-email@example.com",
    "password": "your-password"
    }
  • Successful Response Example:

    {
    "data": {
    "token": "your-generated-token",
    "message": "success",
    "user": {
    "id": "user-id",
    "name": "Your Name",
    "email": "your-email@example.com"
    }
    },
    }

3. Use the Token for API Requests

  • All subsequent API requests must include the token in the Authorization header.

  • Format:

    Authorization: Bearer <your-generated-token>
  • Example Request:

    GET https://<company>.m-api.souqbox.io/api/v1/endpoint
    Authorization: Bearer your-generated-token

4. Begin Communication with Other APIs

  • After authentication, you can call other available endpoints.

  • Always include the Bearer token in your requests.

  • Example:

    GET https://<company>.m-api.souqbox.io/api/v1/admin/staff/get-current
    Authorization: Bearer your-generated-token
    Content-Type: application/json
  • Successful Response Example:

    {
    "data": {
    "id": "user-id",
    "name": "Your Name",
    "email": "your-email@example.com"
    }
    }

✅ Summary

  1. Get the company subdomain (<company>.m-api.souqbox.io).
  2. Login using admin/staff/login with email and password.
  3. Retrieve the generated token.
  4. Use the token with Bearer Authorization to access all other APIs.