{
  "openapi": "3.0.0",
  "info": {
    "description": "Entitlement Service handles user management and permissions within the Data Ecosystem.\n\n```plain {% title=\"Client ID\" %}\n963f2cc6915e479fa0fcb73ec2ec90e7\n```\n",
    "title": "Entitlements Service V2",
    "version": "2.0.0",
    "x-product-id": "OSDU-Entitlements-Service-V2",
    "contact": {
      "name": "SLB Customer Support for Digital",
      "url": "https://customersupport.digital.slb.com"
    }
  },
  "tags": [
    {
      "name": "Entitlements Groups Administration",
      "description": "Group creation and listing groups for a member."
    },
    {
      "name": "Entitlements Members Administration",
      "description": "Membership and member management."
    },
    {
      "name": "Info",
      "description": "Build and git information."
    },
    {
      "name": "count-members-api",
      "description": "Endpoint for counting the members of a group."
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "servers": [
    {
      "url": "https://as5.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (SGP)"
    },
    {
      "url": "https://br5.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB SaaS OSDU (BRS)"
    },
    {
      "url": "https://eu5.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (WEU)"
    },
    {
      "url": "https://eu6.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB SaaS OSDU (EUT)"
    },
    {
      "url": "https://eu7.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (MDE)"
    },
    {
      "url": "https://us5.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (PSC)"
    },
    {
      "url": "https://us7.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (USC)"
    },
    {
      "url": "https://us8.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (WUS)"
    },
    {
      "url": "https://as6.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (SAS)"
    },
    {
      "url": "https://eu8.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (SWC)"
    },
    {
      "url": "https://as7.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (MYW)"
    },
    {
      "url": "https://za1.api.enterprisedata.slb.com/api/entitlements/v2",
      "description": "SLB Saas OSDU (ZAN)"
    }
  ],
  "paths": {
    "/groups": {
      "get": {
        "tags": [
          "Entitlements Groups Administration"
        ],
        "summary": "List all the groups that the user belongs to in the given data partition.",
        "description": "This API lists all the groups that the user belongs to in the given data partition. Required roles: users.datalake.viewers",
        "operationId": "groups",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          }
        ],
        "responses": {
          "200": {
            "description": "List of groups",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupList"
                }
              }
            }
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Entitlements Groups Administration"
        ],
        "summary": "Create a new group with the original caller as the OWNER of the group being created",
        "description": "This creates a new group with the original caller as the OWNER of the group being created. Required roles: users.datalake.admins",
        "operationId": "createGroup",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsertGroupBodyReq"
              }
            }
          },
          "description": "Payload"
        },
        "responses": {
          "201": {
            "description": "Group details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupRes"
                }
              }
            }
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "409": {
            "description": "Conflict. Failed to insert group. Entity already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/members/{member_email}/groups": {
      "get": {
        "tags": [
          "Entitlements Groups Administration"
        ],
        "summary": "List all the groups on behalf of the given member in the given data partition.",
        "description": "This lists all the groups of the given member in the given data partition. Required roles: users.datalake.admins",
        "operationId": "listGroupsOnBehalfOf",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "member_email",
            "in": "path",
            "description": "member email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "member@{domain}.com"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "type",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NONE",
                "DATA",
                "USER",
                "SERVICE"
              ],
              "default": "NONE"
            }
          },
          {
            "name": "appid",
            "in": "query",
            "description": "appid",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of all the groups that the given member belongs to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GroupList"
                }
              }
            }
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/groups/{group_email}": {
      "delete": {
        "tags": [
          "Entitlements Groups Administration"
        ],
        "summary": "Delete a group",
        "description": "This hard deletes an entitlements group. Required roles: users.datalake.admins who is OWNER of the requested group",
        "operationId": "deleteGroup",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "group email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "data.test.group@{datapartition}.{domain}.com"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The group is deleted."
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Server Error"
          }
        }
      },
      "patch": {
        "tags": [
          "Entitlements Groups Administration"
        ],
        "summary": "Update Group",
        "description": "Update Group",
        "operationId": "updateGroup",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "Group Email",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/UpdateGroupOperation"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateGroupResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "403": {
            "description": "User not authorized to perform the action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "502": {
            "description": "Bad Gateway",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/groups/{group_email}/members": {
      "get": {
        "tags": [
          "Entitlements Members Administration"
        ],
        "summary": "List the direct members of a group",
        "description": "This lists the direct members of a group. This API requires the users.datalake.viewers permission who is OWNER of the requested group or users.datalake.admins",
        "operationId": "listMembers",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "group email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "users.datalake.viewers@{datapartition}.{domain}.com"
            }
          },
          {
            "name": "role",
            "in": "query",
            "description": "role",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OWNER",
                "MEMBER"
              ],
              "default": "OWNER"
            }
          },
          {
            "name": "includeType",
            "in": "query",
            "description": "include member type in the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of members with in a group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MemberList"
                }
              }
            }
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Entitlements Members Administration"
        ],
        "summary": "Add members to an existing group",
        "description": "This API adds members to an existing group. Required roles: users.datalake.viewers and OWNER of the requested group.",
        "operationId": "createMembers",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "group email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "users.datalake.viewers@{datapartition}.{domain}.com"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InsertMemberBodyReq"
              }
            }
          },
          "description": "array of member emails"
        },
        "responses": {
          "200": {
            "description": "Added member into a group. This change takes effect immediately.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsertMemberResBody"
                }
              }
            }
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "409": {
            "description": "Conflict. Failed to create a member. Member already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/groups/{group_email}/members/{member_email}": {
      "delete": {
        "tags": [
          "Entitlements Members Administration"
        ],
        "summary": "Delete a member from a group",
        "description": "This API deletes a member from a group. Required roles: users.datalake.viewers and OWNER of the requested group.",
        "operationId": "deleteMember",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "group email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "users.datalake.viewers@{datapartition}.{domain}.com"
            }
          },
          {
            "name": "member_email",
            "in": "path",
            "description": "member email",
            "required": true,
            "schema": {
              "type": "string",
              "default": "member@{domain}.com"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted member from a group. This change takes effect immediately."
          },
          "401": {
            "description": "User is unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppError"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Server Error"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/info": {
      "get": {
        "tags": [
          "Info"
        ],
        "summary": "Version info",
        "description": "For deployment available public `/info` endpoint,  which provides build and git related information.",
        "operationId": "Version info",
        "responses": {
          "200": {
            "description": "Version info.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VersionInfo"
                }
              }
            }
          }
        }
      }
    },
    "/groups/{group_email}/membersCount": {
      "get": {
        "tags": [
          "count-members-api"
        ],
        "summary": "countGroupMembers",
        "description": "Returns the number of members in the specified group, optionally filtered by role.",
        "operationId": "countGroupMembersUsingGET",
        "parameters": [
          {
            "$ref": "#/components/parameters/data-partition-id"
          },
          {
            "name": "group_email",
            "in": "path",
            "description": "The email of the group whose members are counted.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role",
            "in": "query",
            "description": "Optional role filter applied when counting members.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MEMBER",
                "OWNER"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MembersCountResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          }
        },
        "security": [
          {
            "bearer": []
          }
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "data-partition-id": {
        "name": "data-partition-id",
        "in": "header",
        "description": "desired data partition id",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "User Token from SLB Authenticator Service"
      }
    },
    "schemas": {
      "MembersCountResponseDto": {
        "type": "object",
        "description": "Response containing the number of members in a group.",
        "properties": {
          "groupEmail": {
            "type": "string",
            "description": "The email of the group whose members were counted."
          },
          "membersCount": {
            "type": "integer",
            "format": "int32",
            "description": "The number of members in the group."
          },
          "partitionId": {
            "type": "string",
            "description": "The data partition id the group belongs to."
          }
        }
      },
      "AppError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "description": "An error that occurs during normal application logic"
      },
      "InsertMemberBodyReq": {
        "description": "InsertMemberBodyReq is the message format of the member.",
        "type": "object",
        "required": [
          "email",
          "role"
        ],
        "properties": {
          "email": {
            "type": "string",
            "example": "member@{domain}.com"
          },
          "role": {
            "type": "string",
            "enum": [
              "OWNER",
              "MEMBER"
            ],
            "example": "MEMBER"
          }
        },
        "example": {
          "email": "member@{domain}.com",
          "role": "MEMBER"
        }
      },
      "InsertGroupBodyReq": {
        "description": "InsertGroupBodyReq is the message format of the group",
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "users.example.viewers"
          },
          "description": {
            "type": "string",
            "example": "This is an user group for example viewers."
          }
        },
        "example": {
          "name": "users.example.viewers",
          "description": "This is an user group for example viewers."
        }
      },
      "GroupRes": {
        "description": "GroupRes is the group details",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        },
        "example": {
          "name": "users.example.viewers,",
          "email": "users.datalake.viewers@{datapartition}.{domain}.com,",
          "description": "This is an user group for example viewers."
        },
        "x-go-package": "entitlements/group"
      },
      "GroupList": {
        "description": "GroupList contains a list of Groups",
        "type": "object",
        "properties": {
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GroupRes"
            }
          }
        },
        "x-go-package": "entitlements/group"
      },
      "InsertMemberResBody": {
        "description": "InsertMemberResBody is the body of the InsertMember API response.",
        "type": "array",
        "items": {
          "type": "string",
          "description": "Email of the member."
        },
        "x-go-package": "entitlements/member"
      },
      "MemberResBody": {
        "description": "MemberResBody is the body of the MemberRes response.",
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Email of the member."
          },
          "role": {
            "type": "string",
            "description": "Role of the member in the group."
          },
          "memberType": {
            "type": "string",
            "description": "Member type (USER or GROUP) of the member. Only return when includeType query parameter is true."
          },
          "dataPartitionId": {
            "type": "string",
            "description": "Data partition the group belongs to. Only shown if the member type is GROUP."
          }
        },
        "x-go-package": "entitlements/member"
      },
      "MemberList": {
        "description": "MemberList contains a list of members.",
        "type": "object",
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemberResBody"
            }
          }
        },
        "x-go-package": "member"
      },
      "VersionInfo": {
        "type": "object",
        "properties": {
          "groupId": {
            "type": "string",
            "description": "Maven artifact group ID."
          },
          "actifactId": {
            "type": "string",
            "description": "Maven artifact ID."
          },
          "version": {
            "type": "string",
            "description": "Maven artifact version"
          },
          "buildTime": {
            "type": "string",
            "description": "Maven artifact build time"
          },
          "branch": {
            "type": "string",
            "description": "Current git branch"
          },
          "commitId": {
            "type": "string",
            "description": "Latest commit hash"
          },
          "commitMessage": {
            "type": "string",
            "description": "Latest commit message"
          },
          "connectedOuterServices": {
            "type": "array",
            "description": "Connected outer services information",
            "items": {
              "$ref": "#/components/schemas/ConnectedOuterService"
            }
          }
        },
        "description": "Version info."
      },
      "ConnectedOuterService": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Connected outer service name."
          },
          "version": {
            "type": "string",
            "description": "Connected outer service version."
          }
        },
        "description": "Connected outer service information."
      },
      "UpdateGroupOperation": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Update Group Path"
          },
          "value": {
            "type": "array",
            "description": "list of values to be updated",
            "items": {
              "type": "string",
              "description": "list of values to be updated"
            }
          },
          "op": {
            "type": "string",
            "description": "Update Group Operation"
          }
        },
        "description": "Represents a model for the Update Group Operation"
      },
      "UpdateGroupResponseDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the Updated Group"
          },
          "email": {
            "type": "string",
            "description": "Email of the Updated Group"
          },
          "appIds": {
            "type": "array",
            "description": "List of AppId of the Updated Group",
            "items": {
              "type": "string",
              "description": "List of AppId of the Updated Group"
            }
          }
        },
        "description": "Represents a model for the Update Group Response"
      }
    }
  }
}