swagger: '2.0'
info:
  title: MOB.ID Organization BE endpoints
  description: >
    The MOB.ID REST protocol.
  version: '1.0'
  termsOfService: https://www.mob.id/terms/
  contact:
    name: MOB.ID support
    email: support@mob.id
externalDocs:
  description: Refer to the MOB.ID Developer Portal for additional documentation
  url: https://www.mob.id/sdk/overview/
host: your.organization.host
basePath: /api/v1/
schemes:
  - https
consumes:
  - application/json
produces:
  - application/json

paths:

  /api:
    post:
      tags:
        - mobid
      summary: User passed MOB.ID identification
      description: MOB.ID service provides information about user and expects to get your decision about this user.
      parameters:
        - name: AccountRequest
          in: body
          required: true
          schema:
            $ref: '#/definitions/AccountRequest'
      responses:
        200:
          description: A user is present into your DB and allowed to interact with your Organization
          schema:
            $ref: '#/definitions/AccountResponse'


definitions:

  AccountRequest:
    type: object
    description: Information about the user
    required:
      - derivedIdentityId
      - sessionId
      - data
      - passportFields
      - customFields
      - passportVerificationData
    properties:
      derivedIdentityId:
        type: string
        description: MOB.ID Unique Id of the User
        format: string
        maxLength: 255
      sessionId:
        type: string
        description: Unique Session UI of the User (from UI)
        format: string
        maxLength: 255
      data:
        type: string
        description: Additional data of the User Session
        format: string
      passportFields:
        type: array
        description: Array of Passport Fields of the User (depends on your license)
        items:
          $ref: '#/definitions/PassportField'
      customFields:
        type: array
        description: Array of Custom Fields of the User (user input in mobile app)
        items:
          $ref: '#/definitions/CustomField'
      passportVerificationData:
        $ref: '#/definitions/PassportVerificationData'

  PassportField:
    type: object
    description: Data Field of User's Passport
    required:
      - type
      - value
    properties:
      type:
        type: string
        description: Id of the field
        enum:
          - documentType
          - documentCode
          - issuingState
          - primaryIdentifier
          - secondaryIdentifier
          - nationality
          - documentNumber
          - dateOfBirth
          - gender
          - photo
          - dateOfExpiry
      value:
        type: string
        description: value of the field

  CustomField:
    type: object
    description: Data Field of User input
    required:
      - fId
      - type
      - title
      - value
    properties:
      fId:
        type: string
        description: Id of the field
      type:
        type: string
        description: Data type of the field
      title:
        type: string
        description: UI Title of the field (what User sees in mobile app)
      value:
        type: string
        description: value of the field

  PassportVerificationData:
    type: object
    description: User's passport verification data (passport chip info)
    required:
      - documentSignerCertificateVerified
      - ocrMrzMatchesChipMrz
      - dataGroupHashesVerified
      - signatureVerified
      - aaSupported
      - aaPassed
      - bacSupported
      - bacPassed
      - sacSupported
      - sacPassed
      - caSupported
      - caPassed
      - authDataPresent
    properties:
      documentSignerCertificateVerified:
        type: boolean
      ocrMrzMatchesChipMrz:
        type: boolean
      dataGroupHashesVerified:
        type: boolean
      signatureVerified:
        type: boolean
      aaSupported:
        type: boolean
      aaPassed:
        type: boolean
      bacSupported:
        type: boolean
      bacPassed:
        type: boolean
      sacSupported:
        type: boolean
      sacPassed:
        type: boolean
      caSupported:
        type: boolean
      caPassed:
        type: boolean
      authDataPresent:
        type: boolean


  AccountResponse:
    type: object
    description: Your Organization verdict about this User
    required:
      - status
    properties:
      status:
        type: string
        enum:
          - ACTIVE
          - SUSPENDED
          - REVOKED