Skip to content

Organization API

Create, retrieve, update, and delete organizations. Manage default check-in / check-out times.

Endpoints

MethodPathDescription
POST/api/organization/createCreate a new organization
GET/api/organization/:orgidGet organization details
PUT/api/organization/:orgid/updateUpdate organization
GET/api/organization/:orgid/default-timeGet default check-in / check-out times
PUT/api/organization/:orgid/default-timeUpdate default times
DELETE/api/organization/:orgid/deleteDelete organization

Path Parameters

ParameterTypeDescription
orgidstringOrganization ID

Create Organization

POST /api/organization/create

Request Body

json
{
  "name": "Grand Palace Hotel",
  "email": "info@grandpalace.com",
  "phone": "+91-9876543210",
  "gstin": "27AABCG1234H1Z5",
  "pan": "AABCG1234H",
  "address": {
    "line1": "12 Marine Drive",
    "line2": "",
    "city": "Mumbai",
    "state": "Maharashtra",
    "pincode": "400020",
    "country": "India"
  },
  "currency": "INR",
  "timezone": "Asia/Kolkata",
  "logo": "https://storage.example.com/logos/grand-palace.png",
  "defaultCheckInTime": "14:00",
  "defaultCheckOutTime": "11:00"
}

Response — 201 Created

json
{
  "success": true,
  "message": "Organization created successfully",
  "data": {
    "_id": "663f1a2b3c4d5e6f7a8b9c0d",
    "name": "Grand Palace Hotel",
    "email": "info@grandpalace.com",
    "phone": "+91-9876543210",
    "gstin": "27AABCG1234H1Z5",
    "pan": "AABCG1234H",
    "address": {
      "line1": "12 Marine Drive",
      "line2": "",
      "city": "Mumbai",
      "state": "Maharashtra",
      "pincode": "400020",
      "country": "India"
    },
    "currency": "INR",
    "timezone": "Asia/Kolkata",
    "logo": "https://storage.example.com/logos/grand-palace.png",
    "defaultCheckInTime": "14:00",
    "defaultCheckOutTime": "11:00",
    "createdAt": "2026-02-23T10:00:00.000Z",
    "updatedAt": "2026-02-23T10:00:00.000Z"
  }
}

Get Organization

GET /api/organization/:orgid

Response — 200 OK

json
{
  "success": true,
  "data": {
    "_id": "663f1a2b3c4d5e6f7a8b9c0d",
    "name": "Grand Palace Hotel",
    "email": "info@grandpalace.com",
    "phone": "+91-9876543210",
    "gstin": "27AABCG1234H1Z5",
    "pan": "AABCG1234H",
    "address": {
      "line1": "12 Marine Drive",
      "line2": "",
      "city": "Mumbai",
      "state": "Maharashtra",
      "pincode": "400020",
      "country": "India"
    },
    "currency": "INR",
    "timezone": "Asia/Kolkata",
    "logo": "https://storage.example.com/logos/grand-palace.png",
    "defaultCheckInTime": "14:00",
    "defaultCheckOutTime": "11:00",
    "createdAt": "2026-02-23T10:00:00.000Z",
    "updatedAt": "2026-02-23T10:00:00.000Z"
  }
}

Update Organization

PUT /api/organization/:orgid/update

Request Body

json
{
  "name": "Grand Palace Hotel & Spa",
  "phone": "+91-9876543299",
  "address": {
    "line1": "12 Marine Drive",
    "line2": "Tower B",
    "city": "Mumbai",
    "state": "Maharashtra",
    "pincode": "400020",
    "country": "India"
  }
}

Response — 200 OK

json
{
  "success": true,
  "message": "Organization updated successfully",
  "data": {
    "_id": "663f1a2b3c4d5e6f7a8b9c0d",
    "name": "Grand Palace Hotel & Spa",
    "email": "info@grandpalace.com",
    "phone": "+91-9876543299",
    "gstin": "27AABCG1234H1Z5",
    "pan": "AABCG1234H",
    "address": {
      "line1": "12 Marine Drive",
      "line2": "Tower B",
      "city": "Mumbai",
      "state": "Maharashtra",
      "pincode": "400020",
      "country": "India"
    },
    "currency": "INR",
    "timezone": "Asia/Kolkata",
    "logo": "https://storage.example.com/logos/grand-palace.png",
    "defaultCheckInTime": "14:00",
    "defaultCheckOutTime": "11:00",
    "createdAt": "2026-02-23T10:00:00.000Z",
    "updatedAt": "2026-02-23T11:30:00.000Z"
  }
}

Get Default Time

GET /api/organization/:orgid/default-time

Response — 200 OK

json
{
  "success": true,
  "data": {
    "defaultCheckInTime": "14:00",
    "defaultCheckOutTime": "11:00"
  }
}

Update Default Time

PUT /api/organization/:orgid/default-time

Request Body

json
{
  "defaultCheckInTime": "15:00",
  "defaultCheckOutTime": "12:00"
}

Response — 200 OK

json
{
  "success": true,
  "message": "Default times updated successfully",
  "data": {
    "defaultCheckInTime": "15:00",
    "defaultCheckOutTime": "12:00"
  }
}

Delete Organization

DELETE /api/organization/:orgid/delete

Response — 200 OK

json
{
  "success": true,
  "message": "Organization deleted successfully"
}

Released under the MIT License.