openapi: 3.0.0

info:
  description: +Credentials API.
  title: +Credentials.
  version: 2.1.0

tags:
  - name: Credentials
    description: API for managing credentials CRUD
  - name: Flows
    description: API for managing credentials flows operations, to simplify CRUD operations
  - name: Tokens
    description: API for managing tokens
  - name: Magic links
    description: Retrieve magic tokens
  - name: OTP
    description: One-Time Password
  - name: TOTP
    description: Time-based One-time Password
  - name: Devices
    description: API for managing devices sessions

security:
  - bearerAuth: []       

paths:
  "/orgs/{org}/credentials/{username}":
    delete:
      tags: [Credentials]
      description: Delete username credential. The user will not be able to login anymore
      summary: Delete username credential
      operationId: deleteCredential
      parameters:
        - description: a username of Grupo Masmovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Masmovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "204":
          description: " OK"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      

    get:
      tags: [Credentials]
      description: Get usernames credential. It´s main goal its to get information about a
        credential without involving checking directly in BD. It will not return
        credential password
      operationId: RetrieveUsernameCredential
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "200":
          $ref: "#/components/responses/credentialResponse"
        "404":
          $ref: "#/components/responses/customError"

    patch:
      tags: [Credentials]
      description: >-
        Username should be exist.

        The token must exist and must have been created for this user to change their password
      operationId: changeStatus
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InboundChangeStatusCredential"
        description: Password and security token.
        required: true
      responses:
        "204":
          description: " OK"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      summary: Enable/Disable credential.

    post:
      tags: [Credentials]
      description: >-
        Create the user's credential without activating it and without password

        Generate a token required to change the password for this username. With this token, the username will be able to set password with update endpoint
      operationId: createCredential
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "201":
          $ref: "#/components/responses/tokenResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      summary: Create username's credential without password.

    put:
      tags: [Credentials]
      description: >-
        Username should be exist.

        The token must exist and must have been created for this user to change their password
      summary: Update username credential with this password.
      operationId: updateCredential
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InboundCredential"
        description: Password and security token.
        required: true
      responses:
        "204":
          description: " OK"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      

  "/orgs/{org}/credentials/{username}/otp":
    post:
      tags: [OTP]
      description: >-
        Generate an OTP for this username
      summary: Generate an OTP for this username
      operationId: createOTP
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GenerateOTPRequest"
        description: Language of communication
      responses:
        "201":
          $ref: "#/components/responses/generateOTPResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

    put:
      tags: [OTP]
      description: >-
        Validate an OTP for this username
      summary: Validate the OTP
      operationId: validateOTP
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ValidateOTPRequest"
        description: Validate OTP
        required: true
      responses:
        "204":
          description: " OK"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/{username}/devices":
    get:
      tags: [Devices]
      description: >-
        Lists all devices on which a session is active.
      summary: List all devices
      operationId: retrieveDevices
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "200":
          $ref: "#/components/responses/devicesListResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
    delete:
      tags: [Devices]
      description: >-
        Unlink all devices at the same time
      summary: Unlink all devices
      operationId: logoutDevices
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
        - description: Unique identifier for the device
          in: query
          name: scope
          required: true
          schema:
            type: string
            example: "all"
      responses:
        "204":
          description: " Deleted"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
  "/orgs/{org}/credentials/{username}/devices/{device_id}":
    delete:
      tags: [Devices]
      description: >-
        Unlink a device
      summary: Unlink a device
      operationId: unlinkDevice
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
        - description: Unique identifier for the device
          in: path
          name: device_id
          required: true
          schema:
            type: string
            example: "e75ebfe3-b976-4b55-be1d-3f0fb68ff916"
      responses:
        "204":
          description: " Deleted"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/{username}/totp":
    post:
      tags: [TOTP]
      description: >-
        Generate an TOTP for this username
      summary: Generate an TOTP for this username
      operationId: createTOTP
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GenerateOTPRequest"
        description: Language of communication
      responses:
        "201":
          $ref: "#/components/responses/generateTOTPResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
    get:
      tags: [TOTP]
      description: >-
        Retrieve QR code with TOTP for this username
      summary: Retrieve QR code
      operationId: retrieveQrCode
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "201":
          $ref: "#/components/responses/generateTOTPResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

    put:
      tags: [TOTP]
      description: >-
        Validate an TOTP for this username
      summary: Validate the TOTP
      operationId: validateTOTP
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ValidateOTPRequest"
        description: Validate TOTP
        required: true
      responses:
        "204":
          description: " OK"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/{username}/totp/passcode":
    post:
      tags: [TOTP]
      description: >-
        Generate a passcode for the username
      summary: Generate a passcode for the username
      operationId: generatePasscode
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "201":
          $ref: "#/components/responses/generatePasscodeResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/move/{username}":
    post:
      tags: [Credentials]
      description: >-
        Move a credential from one organization to another.

        The credential will be **deleted** from the origin organization and **created** in the destination organization.
      summary: Move credential between organizations
      operationId: moveCredential
      parameters:
        - description: a username of Grupo Masmovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: Origin organization ID
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InboundMigrateCredential"
        description: Destination organization for the credential move
        required: true
      responses:
        "200":
          $ref: "#/components/responses/moveCredentialResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/copy/{username}":
    post:
      tags: [Credentials]
      description: >-
        Copy a credential from one organization to another.

        The credential will **remain** in the origin organization and be **created** in the destination organization.
      summary: Copy credential between organizations
      operationId: copyCredential
      parameters:
        - description: a username of Grupo Masmovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: Origin organization ID
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InboundMigrateCredential"
        description: Destination organization for the credential copy
        required: true
      responses:
        "200":
          $ref: "#/components/responses/copyCredentialResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/discover/{username}":
    get:
      tags: [Credentials]
      description: >-
        Search for credentials across all enabled tenant schemas by username.

        Returns an array of credentials found across different organizations.
      summary: Discover credentials across all tenants
      operationId: discoverCredential
      parameters:
        - description: a username of Grupo Masmovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: Organization ID (context for the request)
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "200":
          $ref: "#/components/responses/discoverCredentialsResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"

  "/orgs/{org}/credentials/{username}/change_password":
    post:
      tags: [Credentials]
      description: >-
        Generate a token required to change the password for this username

        With this token, the username will be able to change password with update endpoint
      operationId: requestChangePassword
      parameters:
        - description: a username of Grupo Mamovil
          in: path
          name: username
          required: true
          schema:
            type: string
            example: heimdall@masmovil.com
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "201":
          $ref: "#/components/responses/tokenResponse"
        "400":
          $ref: "#/components/responses/customError"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "409":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      summary: Request for change the password

  "/orgs/{org}/flows/change_password":
    post:
      tags: [Flows]
      description: Change the user's credential with the new password
      summary: Change username credential (flow).
      operationId: changePasswordFlow
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangePasswordRequest"
      responses:
        "204":
          description: " Updated"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
        "502":
          $ref: "#/components/responses/customError"
        "504":
          $ref: "#/components/responses/customError"
      

  "/orgs/{org}/flows/create_username":
    post:
      tags: [Flows]
      description: Create only the username in +credentials
      operationId: createUsernameFlow
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateUsernameRequest"
      responses:
        "201":
          $ref: "#/components/responses/tokenResponse"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
        "502":
          $ref: "#/components/responses/customError"
        "504":
          $ref: "#/components/responses/customError"
      summary: Create username in +credentials.

  "/orgs/{org}/flows/reset_password":
    post:
      tags: [Flows]
      description: Reset the password for this username
      summary: Reset username credential.
      operationId: resetPasswordFlow
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ResetPasswordRequest"
      responses:
        "204":
          description: " Updated"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "405":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
        "502":
          $ref: "#/components/responses/customError"
        "504":
          $ref: "#/components/responses/customError"
      

  "/orgs/{org}/magiclinks":
    get:
      tags: [Magic links]
      description: Get token and link from customer's token
      summary: Get magic link from customer's token.
      operationId: getMagicLinkToken
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
      responses:
        "200":
          $ref: "#/components/responses/magicLinkResponse"
        "401":
          $ref: "#/components/responses/customError"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
  "/orgs/{org}/tokens/{token}":
    delete:
      tags: [Tokens]
      description: Delete username's token to change o set his credentials
      operationId: deleteToken
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
        - description: Security token
          in: path
          name: token
          required: true
          schema:
            type: string
            example: fruh7GRC-8gdFP1acelpc-p6Vqxcdciowc
      responses:
        "204":
          description: " OK"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      summary: Delete username's token.

    get:
      tags: [Tokens]
      description: Get username relations with this token
      summary: Get username from token.
      operationId: getUsernameToken
      parameters:
        - description: a orgID of Grupo Mamovil
          in: path
          name: org
          required: true
          schema:
            type: string
            example: masmovil
        - description: Security token
          in: path
          name: token
          required: true
          schema:
            type: string
            example: fruh7GRC-8gdFP1acelpc-p6Vqxcdciowc
      responses:
        "200":
          $ref: "#/components/responses/tokenUsernameResponse"
        "403":
          $ref: "#/components/responses/customError"
        "404":
          $ref: "#/components/responses/customError"
        "500":
          $ref: "#/components/responses/customError"
      

servers:
  - url: https://credentials.masstack.com/v1/
    description: production
  - url: https://credentials.sta.masstack.com/v1/
    description: staging
components:
  responses:
    credentialResponse:
      description: Credential retrieved during check process
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Credential"
    customError:
      description: Error response
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorDto"
    tokenResponse:
      description: Security token to set or change password
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/TokenResponse"
    tokenUsernameResponse:
      description: Username associated with the token
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/TokenUsernameResponse"
    generateOTPResponse:
      description: OTP Time to live
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/GenerateOTPResponse"
    generatePasscodeResponse:
      description: User passcode
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/GeneratePasscodeResponse"
    generateTOTPResponse:
      description: TOTP
      content:
        image/png:
          schema:
            type: string
            format: binary
    magicLinkResponse:
      description: Token and link associated with the customer's token
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/MagicLinkResponse"
    devicesListResponse:
      description: Devices list associated with the customer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/DevicesListResponse"
    moveCredentialResponse:
      description: Credential move successful response
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/MoveCredentialResponse"
    copyCredentialResponse:
      description: Credential copy successful response
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/CopyCredentialResponse"
    discoverCredentialsResponse:
      description: List of credentials found across different organizations
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: "#/components/schemas/CredentialDiscoverResponse"
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    ChangePasswordRequest:
      properties:
        language:
          type: string
          description: Customer's preferred language for communications
        new_password:
          type: string
          description: New password
        old_password:
          type: string
          description: Old password
        username:
          type: string
          description: Customer username
      required:
        - username
        - old_password
        - new_password
      type: object
    CreateUsernameRequest:
      properties:
        customer_id:
          type: string
          description: Internal identification of the customer
        msisdn:
          type: string
          description: Msisdn belonging to the customer
        username:
          type: string
          description: Username to be linked to the customer
      required:
        - username
        - msisdn
        - customer_id
      type: object
    Credential:
      description: |-
        Credential
        represents an user (email or msisdn) credential.
      properties:
        created_at:
          format: date-time
          type: string
          description: Creation date
        deleted_at:
          $ref: "#/components/schemas/DeletedAt"
        enabled:
          type: boolean
          description: If true it's enabled
        require2fa:
          type: boolean
          description: If true the 2fa is required
        id:
          type: string
        last_login_at:
          format: date-time
          type: string
          description: Date of last successful login
        updated_at:
          format: date-time
          type: string
          description: Date of last update
        username:
          type: string
          description: Username
        crm:
          description: the crm where the credential belongs to
          type: string
          example: qvantel
      required:
        - created_at
        - enabled
        - last_login_at
        - updated_at
        - username
        - crm
      type: object
    DeletedAt:
      properties:
        Time:
          format: date-time
          description: Deletion date
          type: string
        Valid:
          type: boolean
          description: true is valid
      description: Deletion date. It's a nullTime which represents a time.Time that may be null.
      type: object
    ErrorDto:
      description: ErrorDto defines an extended error
      properties:
        componentMsg:
          type: string
          description: Internal message
        id:
          type: string
          description: Unique id identifying the error
        msg:
          type: string
          description: Display message
        sentryCode:
          type: string
          description: Unique id identifying the error
        status:
          format: int64
          type: integer
          description: Equivalent http error code
      required:
        - id
        - msg
        - status
        - componentMsg
      type: object
    InboundChangeStatusCredential:
      properties:
        enabled:
          description: Enables or disables the credential
          type: boolean
        require2fa:
          type: boolean
          description: If true the 2fa is required
      required:
        - enabled
      type: object
    InboundCredential:
      properties:
        password:
          type: string
          description: New password for the customer credential 
        token:
          type: string
          description: Security token issued in order to change passwords
      required:
        - password
        - token
      type: object
    GenerateOTPRequest:
      properties:
        language:
          type: string
          description: Customer's preferred language for communications
          example: "es"
        hint:
          type: string
          description: Customer's preferred channel to send otp 
          example: "user@masmovil.com"
      type: object
    ValidateOTPRequest:
      properties:
        code:
          type: string
          description: OTP to validate
          example: "280597"
      type: object
    GenerateOTPResponse:
      properties:
        expires_in:
          format: int64
          type: integer
          example: 300
          description: Time to live in seconds
      required:
        - expires_in
      type: object
    GeneratePasscodeResponse:
      properties:
        expires_in:
          format: int64
          type: integer
          example: 30
          description: Time to live in seconds
        passcode:
          type: string
          description: OTP to validate
          example: "280597"
      required:
        - expires_in
      type: object
    ResetPasswordRequest:
      properties:
        language:
          type: string
          description: Customer's preferred language for communications
        username:
          type: string
          description: Customer username
        hint:
          type: string
          description: Customer's preferred channel to send otp 
          example: "user@masmovil.com"
      required:
        - username
      type: object
    TokenResponse:
      properties:
        token:
          type: string
          description: Security token issued in order to change passwords
          example: "ed7f4ab1-6234-46e6-a4de-fd3d4de3d414@masmovil@h7sn381lTBopU7pLIljv36pWzPTEy-FlswJznI_JqVoxbUXi40XJP8ekJ_1Owtrvzo4FOqIXCtABHhLPJ7rrHAa2UchVqWHuYQZyBCcutP_ryfegNNjC8OWYNc0Mf-mAg1O_GEA50pEXh9UkXINuCikK_XmgDonQhOmRwHC_qiU="
      required:
        - token
      type: object
    TokenUsernameResponse:
      properties:
        username:
          type: string
          description: Customer username
          example: myemail@gmail.com
      required:
        - username
      type: object
    MagicLinkResponse:
      properties:
        token:
          type: string
          description: Security token issued to be able to login without using credentials
          example: "ed7f4ab1-6234-46e6-a4de-fd3d4de3d414@masmovil@h7sn381lTBopU7pLIljv36pWzPTEy-FlswJznI_JqVoxbUXi40XJP8ekJ_1Owtrvzo4FOqIXCtABHhLPJ7rrHAa2UchVqWHuYQZyBCcutP_ryfegNNjC8OWYNc0Mf-mAg1O_GEA50pEXh9UkXINuCikK_XmgDonQhOmRwHC_qiU="
        link:
          type: string
          description: Link to Authn where the issued security token is sent to be able to login without using credentials.
          example: "https://{{authn-host}}/magiclink?token=ed7f4ab1-6234-46e6-a4de-fd3d4de3d414@masmovil@h7sn381lTBopU7pLIljv36pWzPTEy-FlswJznI_JqVoxbUXi40XJP8ekJ_1Owtrvzo4FOqIXCtABHhLPJ7rrHAa2UchVqWHuYQZyBCcutP_ryfegNNjC8OWYNc0Mf-mAg1O_GEA50pEXh9UkXINuCikK_XmgDonQhOmRwHC_qiU="
      required:
        - token
        - link
      type: object
    Device:
      type: object
      properties:
        device_id:
          type: string
          description: Unique identifier for the device
          example: "e75ebfe3-b976-4b55-be1d-3f0fb68ff916"
        user_agent:
          type: string
          description: User agent of the device
          example: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
        user_agent_alias:
          type: string
          description: User agent alias of the device
          example: "My Iphone 16"
        created_at:
          type: integer
          description: Timestamp (in Unix time) when the device was connected
          example: 1718618235
        expires_at:
          type: integer
          description: Timestamp (in Unix time) when the device's connection expires
          example: 1726411355
    DevicesListResponse:
      type: object
      properties:
        devices:
          type: array
          items:
            $ref: '#/components/schemas/Device'
    InboundMigrateCredential:
      type: object
      properties:
        destinationOrg:
          type: string
          description: Destination organization ID
          example: "yoigo"
      required:
        - destinationOrg
    MoveCredentialResponse:
      type: object
      properties:
        message:
          type: string
          description: Success message
          example: "credential moved successfully"
        username:
          type: string
          description: Username that was moved
          example: "heimdall@masmovil.com"
        from:
          type: string
          description: Origin organization
          example: "masmovil"
        to:
          type: string
          description: Destination organization
          example: "yoigo"
      required:
        - message
        - username
        - from
        - to
    CopyCredentialResponse:
      type: object
      properties:
        message:
          type: string
          description: Success message
          example: "credential copied successfully"
        username:
          type: string
          description: Username that was copied
          example: "heimdall@masmovil.com"
        from:
          type: string
          description: Origin organization
          example: "masmovil"
        to:
          type: string
          description: Destination organization
          example: "yoigo"
      required:
        - message
        - username
        - from
        - to
    CredentialDiscoverResponse:
      type: object
      properties:
        org:
          type: string
          description: Organization where the credential was found
          example: "masmovil"
        id:
          type: string
          description: Credential ID
          example: "123e4567-e89b-12d3-a456-426614174000"
        created_at:
          format: date-time
          type: string
          description: Creation date
        enabled:
          type: boolean
          description: If true it's enabled
        require2fa:
          type: boolean
          description: If true the 2fa is required
        last_login_at:
          format: date-time
          type: string
          description: Date of last successful login
        updated_at:
          format: date-time
          type: string
          description: Date of last update
        username:
          type: string
          description: Username
          example: "heimdall@masmovil.com"
        crm:
          description: The CRM where the credential belongs to
          type: string
          example: "qvantel"
      required:
        - org
        - created_at
        - enabled
        - updated_at
        - username