swagger: "2.0"
openapi: 3.0.3
theme:

info:
  title: RiskBase SCIM Version 2.0
  description: |
    # API

    RiskBase implements version 2.0 of the SCIM specification. The API allows you to provision groups and users in RiskBase.  If you're interested in using the API or need any help, get in touch at support@riskbase.uk

    ## Authentication

    To start using the SCIM API, you first need to get an API token for your organisation from Settings in the RiskBase app. This token should be sent with all requests as a Bearer token in the Authorization HTTP header.

    ```shell
    POST /sso/{organisationId}/scim/v2/Groups
    Host: api3.riskbase.uk
    Authorization: Bearer 5d2e9eff0e253e3ef4544...
    ```

    ## Enabling SCIM

    To enable the SCIM endpoints for your organisation, head over to **SSO and Provisioning** in Settings in the RiskBase app.

    ## Configuring

    ### Users

    RiskBase supports and requires the following attributes for users:

    | Your Attribute | RiskBase Attribute | Type |
    | ---------- | ---------- | ---- |
    | Email Address | userName | Email |
    | Is Active | active | Boolean |
    | Forename | name.givenName | String |
    | Surname | name.familyName | String |

    ### Groups

    RiskBase supports and requires the following attributes for groups:

    | Your Attribute | RiskBase Attribute | Type |
    | ---------- | ---------- | ---- |
    | Name | displayName | String |
    | Members | members | Array of Objects { value: userName }[] |

    ## Responses

    All API responses are formatted as JSON. Successful requests return a ``2xx`` HTTP status code. Each endpoint's payload and response is detailed later in this documentation.
  _termsOfService: https://riskbase.uk/terms
  _contact:
    email: support@riskbase.uk
  x-logo:
    url: "/assets/RiskBaseLogo.svg"
    altText: RiskBase
    href: https://riskbase.uk
servers:
  - url: https://api3.riskbase.uk/sso/{organisationId}/scim/v2
tags:
  - name: Groups
    description: ""
  - name: Users
    description: ""
schemes:
  - https
security:
  - Bearer Authentication: []
components:
  securitySchemes:
    Bearer Authentication:
      type: http
      scheme: bearer
      description: "`Authorization: Bearer {AuthorizationToken}`"
    None / Bearer Authentication:
      type: http
      scheme: none / bearer
      description:
        "This endpoint will return even when no bearer is provided.<br>`Authorization:
        Bearer {AuthorizationToken}`"
paths:
  "/Groups":
    get:
      tags:
        - Groups
      summary: List Groups
      parameters:
        - in: query
          name: filter
          schema:
            type: string
            examples:
              - id eq "cksq4ybpq104zwgwh2gd1vvha"
              - displayName eq "Admin" OR displayName ew "Tasks"
            description: |
              The following filters are available:

              - `id` with comparison operators `eq` `co` `sw` `ew`
              - `displayName` with comparison operators `eq` `co` `sw` `ew`

              Multiple filters can be used with the logical operators `and` `or`
        - in: query
          name: startIndex
          description: Index of the first query result
          schema:
            type: integer
            default: 1
        - in: query
          name: count
          description: Maximun numer of query results per page
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 500
        - in: query
          name: sortBy
          schema:
            type: string
            enum: [id, name, displayName]
            default: id
        - in: query
          name: sortOrder
          schema:
            type: string
            enum: [ascending, descending]
            default: ascending
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:ListResponse]
                  totalResults:
                    type: int
                    example: 2
                  startIndex:
                    type: int
                    example: 1
                  itemsPerPage:
                    type: int
                    example: 500
                  Resources:
                    type: array
                    items:
                      type: object
                      properties:
                        schemas:
                          type: array
                          items:
                            type: string
                            enum: [urn:ietf:params:scim:schemas:core:2.0:Group]
                        id:
                          type: string
                        displayName:
                          type: string
                        name:
                          type: string
                          description: Duplicate of `displayName`
                        description:
                          type: string
                        members:
                          type: array
                          items:
                            type: object
                            properties:
                              value:
                                type: string
                        meta:
                          type: object
                          properties:
                            resourceType:
                              type: string
                              enum: [Group]
                            created:
                              type: string
                            lastModified:
                              type: string
                            location:
                              type: string
                    example:
                      - schemas: [urn:ietf:params:scim:schemas:core:2.0:Group]
                        id: cksq4ybpq104zwgwh2gd1vvha
                        displayName: Admin
                        name: Admin
                        description: Access to admin features
                        members:
                          - jo8woo84ow880s88wc4o8gw8
                        meta:
                          resourceType: Group
                          created: 2020-04-20T12:34:44Z
                          lastModified: 2021-03-23T15:42:06Z
                          location: https://api3.riskbase.uk/sso/{organisationId}/scim/v2/Groups/cksq4ybpq104zwgwh2gd1vvha
                      - schemas: [urn:ietf:params:scim:schemas:core:2.0:Group]
                        id: ow4kswcsskwkc84s0g88okwc
                        displayName: Tasks
                        name: Tasks
                        description: Users with access to tasks
                        members:
                          - jo8woo84ow880s88wc4o8gw8
                          - q0ssgs84sswkss4oo0s4008w
                        meta:
                          resourceType: Group
                          created: 2020-04-20T12:34:44Z
                          lastModified: 2021-03-23T15:42:06Z
                          location: https://api3.riskbase.uk/sso/{organisationId}/scim/v2/Groups/ow4kswcsskwkc84s0g88okwc
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    example: ["urn:ietf:params:scim:api:messages:2.0:Error"]
                  scimType:
                    type: string
                    enum: [invalidFilter]
                  detail:
                    type: string
                    enum: [Invalid filter]
                  status:
                    type: int
                    enum: [400]
    post:
      tags:
        - Groups
      summary: Create Group
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                schemas:
                  type: array
                  items:
                    type: string
                    example: urn:ietf:params:scim:schemas:core:2.0:Group
                name:
                  type: string
                  required: true
                  example: Admin
                description:
                  type: string
                  example: Access to admin features
                members:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                  example:
                    - value: jo8woo84ow880s88wc4o8gw8
      responses:
        "201":
          description: See **Get Group**. Store the response's `id` and use this in future requests related to this group.
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [displayName is required]
                  status:
                    type: int
                    enum: [400]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [displayName must be unique]
                  status:
                    type: int
                    enum: [409]
  "/Groups/{id}":
    get:
      tags:
        - Groups
      summary: Get Group
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:schemas:core:2.0:Group]
                  id:
                    type: string
                  displayName:
                    type: string
                  name:
                    type: string
                  description:
                    type: string
                  members:
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          type: string
                  meta:
                    type: object
                    properties:
                      resourceType:
                        type: string
                        enum: [Group]
                      created:
                        type: string
                      lastModified:
                        type: string
                      location:
                        type: string
              example:
                schemas: [urn:ietf:params:scim:schemas:core:2.0:Group]
                id: cksq4ybpq104zwgwh2gd1vvha
                displayName: Admin
                name: Admin
                description: Access to admin features
                members:
                  - jo8woo84ow880s88wc4o8gw8
                meta:
                  resourceType: Group
                  created: 2020-04-20T12:34:44Z
                  lastModified: 2021-03-23T15:42:06Z
                  location: https://api3.riskbase.uk/sso/{organisationId}/scim/v2/Groups/cksq4ybpq104zwgwh2gd1vvha
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
    put:
      tags:
        - Groups
      summary: Overwrite Group
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                schemas:
                  type: array
                  items:
                    type: string
                    enum: [urn:ietf:params:scim:schemas:core:2.0:Group]
                name:
                  type: string
                  required: true
                  example: Admin
                description:
                  type: string
                  example: Access to admin features
                members:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                  example:
                    - value: jo8woo84ow880s88wc4o8gw8
      responses:
        "200":
          description: See **Get Group**
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required, displayName is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [displayName must be unique]
                  status:
                    type: int
                    enum: [409]
    patch:
      tags:
        - Groups
      summary: Update Group
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - Operations
              properties:
                schemas:
                  type: array
                  items:
                    type: string
                    enum: [urn:ietf:params:scim:schemas:core:2.0:Group]
                Operations:
                  type: array
                  items:
                    type: object
                    properties:
                      op:
                        type: string
                        enum: [add, replace, remove]
                      path:
                        type: string
                        enum: [name, description, members]
                      value:
                        type: string | object
                  required: true
                  example:
                    - op: replace
                      path: name
                      value: Admin Users
                    - op: remove
                      path: description
                    - op: add
                      path: members
                      value:
                        - value: pl34dje3i099d2djwoo2nhm2
                        - value: ks9dii37ow890s88wd4o2nm8
                    - op: remove
                      path: members
                      value:
                        - value: jo8woo84ow880s88wc4o8gw8
      responses:
        "200":
          description: See **Get Group**
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [displayName must be unique]
                  status:
                    type: int
                    enum: [409]
    delete:
      tags:
        - Groups
      summary: Delete Group
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Complete
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
  "/Users":
    get:
      tags:
        - Users
      summary: List Users
      description: Returns a paginated list of users
      parameters:
        - in: query
          name: filter
          schema:
            type: string
            examples:
              - id eq "cksq4ybpq104zwgwh2gd1vvha"
              - (name.givenName sw "Ben" OR name.givenName sw "Brandon") AND email ew "@riskbase.uk"
            description: |
              The following filters are available:

              - `id` with comparison operators `eq` `co` `sw` `ew`
              - `userName` with comparison operators `eq` `co` `sw` `ew`
              - `name.familyName` with comparison operators `eq` `co` `sw` `ew`
              - `name.givenName` with comparison operators `eq` `co` `sw` `ew`
              - `email` with comparison operators `eq` `co` `sw` `ew`
              - `active` with comparison operators `eq`

              Multiple filters can be used with the logical operators `and` `or`
        - in: query
          name: startIndex
          description: Index of the first query result
          schema:
            type: integer
            default: 1
        - in: query
          name: count
          description: Maximun numer of query results per page
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 500
        - in: query
          name: sortBy
          schema:
            type: string
            enum: [userName, email, givenName, familyName]
            default: userName
        - in: query
          name: sortOrder
          schema:
            type: string
            enum: [ascending, descending]
            default: ascending
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:ListResponse]
                  totalResults:
                    type: int
                    example: 1
                  startIndex:
                    type: int
                    example: 1
                  itemsPerPage:
                    type: int
                    example: 500
                  Resources:
                    type: array
                    items:
                      type: object
                      properties:
                        schemas:
                          type: array
                          items:
                            type: string
                            enum: [urn:ietf:params:scim:schemas:core:2.0:User]
                        id:
                          type: string
                        externalId:
                          type: string
                        userName:
                          type: string
                        active:
                          type: boolean
                        emails:
                          type: array
                          items:
                            type: object
                            properties:
                              value:
                                type: email
                              type:
                                type: string
                                enum: [work]
                              primary:
                                type: boolean
                        name:
                          type: object
                          properties:
                            formatted:
                              type: string
                            givenName:
                              type: string
                            familyName:
                              type: string
                        authenticationType:
                          type: enum
                          enum: ["saml", "passwordless"]
                        roles:
                          type: array
                          items:
                            type: object
                            properties:
                              value:
                                type: string
                        meta:
                          type: object
                          properties:
                            resourceType:
                              type: string
                              enum: [User]
                            created:
                              type: string
                            lastModified:
                              type: string
                            location:
                              type: string
                    example:
                      - schemas: [urn:ietf:params:scim:schemas:core:2.0:User]
                        id: cksq4ybpq104zwgwh2gd1vvha
                        email:
                          - value: ben.boyd@riskbase.uk
                            type: "work"
                            primary: true
                        name:
                          formatted: Ben Boyd
                          givenName: Ben
                          familyName: Boyd
                        authenticationType: saml
                        roles:
                          - value: cksq4ybpq104zwgwh2gd1vvha
                        meta:
                          resourceType: User
                          created: 2020-04-20T12:34:44Z
                          lastModified: 2021-03-23T15:42:06Z
                          location: https://api3.riskbase.uk/sso/{organisationId}/scim/v2/Users/cksq4ybpq104zwgwh2gd1vvha
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    example: ["urn:ietf:params:scim:api:messages:2.0:Error"]
                  scimType:
                    type: string
                    enum: [invalidFilter]
                  detail:
                    type: string
                    enum: [Invalid filter]
                  status:
                    type: int
                    enum: [400]
    post:
      tags:
        - Users
      summary: Create User
      description: |
        The POST request is used to create a new user.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - userName
                - emails
                - name
              properties:
                schemas:
                  type: array
                  example: ["urn:ietf:params:scim:schemas:core:2.0:User"]
                userName:
                  type: string
                  format: email
                  required: true
                  description: Your unique immutable ID
                emails:
                  description: |
                    The first email with `primary: true` is used; all other emails are discarded.
                    The first email address is used if no emails have `primary: true`; all other emails are discarded
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: email
                      primary:
                        type: boolean
                  example:
                    - value: ben.boyd@riskbase.uk
                      primary: true
                name:
                  type: object
                  properties:
                    givenName:
                      type: string
                      example: Ben
                      required: true
                    familyName:
                      type: string
                      example: Boyd
                      required: true
                authenticationType:
                  type: enum
                  enum: ["saml", "passwordless"]
                  default: saml
                  description: |
                    User should sign-in through your own IdP-initiated SAML SSO or directly into RiskBase with a passwordless account.

                    This cannot currently be changed once the user has been added. If you'd like to change an existing user's `authenticationType`, please get in touch with support@riskbase.uk
                roles:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                active:
                  type: boolean
                  default: false
                  example: true
      responses:
        "201":
          description: See **Get User**. Store the response's `id` and use this in future requests related to this user.
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [userName must be an email]
                  status:
                    type: int
                    enum: [400]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      example: urn:ietf:params:scim:api:messages:2.0:Error
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [userName must be a unique email]
                  status:
                    type: int
                    enum: [409]
  "/Users/{id}":
    get:
      tags:
        - Users
      summary: Get User
      description: Return a single user
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:schemas:core:2.0:User]
                  id:
                    type: string
                  externalId:
                    type: string
                  userName:
                    type: string
                  active:
                    type: boolean
                  emails:
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          type: email
                        type:
                          type: string
                        primary:
                          type: boolean
                  name:
                    type: object
                    properties:
                      formatted:
                        type: string
                      givenName:
                        type: string
                      familyName:
                        type: string
                  roles:
                    type: array
                    items:
                      type: object
                      properties:
                        value:
                          type: string
                  meta:
                    type: object
                    properties:
                      resourceType:
                        type: string
                        enum: [User]
                      created:
                        type: string
                      lastModified:
                        type: string
                      location:
                        type: string
              example:
                schemas: [urn:ietf:params:scim:schemas:core:2.0:User]
                id: cksq4ybpq104zwgwh2gd1vvha
                email:
                  - value: ben.boyd@riskbase.uk
                    type: "work"
                    primary: true
                name:
                  formatted: Ben Boyd
                  givenName: Ben
                  familyName: Boyd
                roles:
                  - value: cksq4ybpq104zwgwh2gd1vvha
                meta:
                  resourceType: User
                  created: 2020-04-20T12:34:44Z
                  lastModified: 2021-03-23T15:42:06Z
                  location: https://api3.riskbase.uk/sso/{organisationId}/scim/v2/Users/cksq4ybpq104zwgwh2gd1vvha
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    num: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
    put:
      tags:
        - Users
      summary: Overwrite User
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - userName
                - emails
                - name
              properties:
                schemas:
                  type: array
                  enum: [urn:ietf:params:scim:schemas:core:2.0:User]
                emails:
                  description: |
                    The first email with `primary: true` is used; all other emails are discarded.
                    The first email address is used if no emails have `primary: true`; all other emails are discarded
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: email
                      primary:
                        type: boolean
                  example:
                    - value: ben.boyd@riskbase.uk
                      primary: true
                name:
                  type: object
                  properties:
                    givenName:
                      type: string
                      example: Ben
                      required: true
                    familyName:
                      type: string
                      example: Boyd
                      required: true
                roles:
                  type: array
                  items:
                    type: object
                    properties:
                      value:
                        type: string
                active:
                  type: boolean
                  default: false
                  example: true
      responses:
        "200":
          description: See **Get User**
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required, userName must be an email]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [userName must be a unique email]
                  status:
                    type: int
                    enum: [409]
    patch:
      tags:
        - Users
      summary: Update User
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - Operations
              properties:
                schemas:
                  type: array
                  items:
                    type: string
                    enum: [urn:ietf:params:scim:schemas:core:2.0:User]
                Operations:
                  type: array
                  items:
                    type: object
                    properties:
                      op:
                        type: string
                        enum: [add, replace, remove]
                      path:
                        type: string
                        enum:
                          [
                            name,
                            name.givenName,
                            name.familyName,
                            emails,
                            active,
                            roles,
                          ]
                      value:
                        type: string | array | object
                  required: true
                  example:
                    - op: replace
                      path: userName
                      value: new.email@riskbase.uk
                    - op: replace
                      path: name.givenName
                      value: Brandon
                    - op: replace
                      path: name
                      value:
                        familyName: Kenney
                    - op: replace
                      path: emails
                      value:
                        - value: brandon.kenney@riskbase.uk
                          primary: true
                    - op: remove
                      path: roles
                      value:
                        - value: cksq4ybpq104zwgwh2gd1vvha
                    - op: add
                      path: roles
                      value:
                        - value: cd2q4d0pq104zwgwh2gd1jkha
                        - value: jw4w8gcs48s48w808kg4g0ck
      responses:
        "200":
          description: See **Get User**
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required, userName must be an email]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
        "409":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    items:
                      type: string
                      enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [uniqueness]
                  detail:
                    type: string
                    enum: [userName must be a unique email]
                  status:
                    type: int
                    enum: [409]
    delete:
      tags:
        - Users
      summary: Delete User
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Complete
        "400":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [id is required]
                  status:
                    type: int
                    enum: [400]
        "404":
          content:
            application/json:
              schema:
                properties:
                  schemas:
                    type: array
                    enum: [urn:ietf:params:scim:api:messages:2.0:Error]
                  scimType:
                    type: string
                    enum: [invalidValue]
                  detail:
                    type: string
                    enum: [Resource not found]
                  status:
                    type: int
                    enum: [404]
definitions:
  Category:
    type: object
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
    xml:
      name: Category
