Organizations Resource

Description

Organizations represent customer accounts on the platform. Each organization contains configuration for platform integration, including API keys, domain, and webhook URL.


Example

Organization:

{
  "createdAt": number,
  "updatedAt": number,
  "domain": "org-example.com",
  "webhook": "https://org-example.com/xapi",
  "schemaVersion": 1
}

Create Organization - (!Project-Betta Platform Admin or Self-Serve!)

POST /organizations

Example Request:

{
  "domain": "org-example.com",
  "webhook": "https://org-example.com/xapi"
}

Example Response (201 Created):

{
  "success": true,
  "message": "Organization created successfully",
  "data": {
    "_id": "org123",
    "createdAt": number,
    "updatedAt": number,
    "domain": "org-example.com",
    "webhook": "https://org-example.com/xapi",
    "schemaVersion": 1
  }
}

Get All Organizations - (!Project-Betta Platform Admin!)

GET /organizations

Example Response (200 OK):

{
  "success": true,
  "message": "Organizations retrieved successfully",
  "data": [
    {
      "_id": "org123",
      "createdAt": 1672444800000,
      "updatedAt": 1672444800000,
      "domain": "org-example.com",
      "webhook": "https://org-example.com/xapi",
      "schemaVersion": 1
    }
    // ...more organizations
  ]
}

Get Organization by ID

GET /organizations/{organization_id}

Example Response (200 OK):

{
  "success": true,
  "message": "Organization retrieved successfully",
  "data": {
    "_id": "org123",
    "createdAt": 1672444800000,
    "updatedAt": 1672444800000,
    "domain": "org-example.com",
    "webhook": "https://org-example.com/xapi",
    "schemaVersion": 1
  }
}

Update Organization - (!Project-Betta Platform Admin!)

PATCH /organizations/{organization_id}

Example Request:

{
  "domain": "org-new.com", // optional
  "webhook": "https://org-new.com" // optional
}

Example Response (200 OK):

{
  "success": true,
  "message": "Organization updated successfully.",
  "data": {
    "_id": "org123",
    "createdAt": 1672444800000,
    "updatedAt": 1672444800000,
    "domain": "org-example.com",
    "webhook": "https://org-example.com/xapi",
    "schemaVersion": 1
  }
}

Delete Organization - (!Project-Betta Platform Admin!)

DELETE /organizations/{organization_id}

Example Response (200 OK):

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

Last updated