openapi: 3.0.0
info:
  title: Cynopsis CRM OAuth2 Token API
  version: '1.0'
servers:
  - url: https://d1.cynopsis.co
    description: Demo Service API URL
  - url: https://util.cynopsis.co
    description: Production Service API URL
paths:
  /oauth/token:
    post:
      summary: Get Access Token
      description: >
        Get JWT access token from Cynopsis CRM (Demo or Production) using the
        OAuth2 client_credentials flow.

        Only the following server URLs are used for this endpoint:
          - Demo: https://crm-demo.cynopsis.co
          - Production: https://crm.cynopsis.co
      servers:
        - url: https://crm-demo.cynopsis.co
          description: Demo Environment (Only for /oauth/token)
        - url: https://crm.cynopsis.co
          description: Production Environment (Only for /oauth/token)
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  example: client_credentials
                client_id:
                  type: string
                  example: your_client_id
                client_secret:
                  type: string
                  example: your_secret_key
              required:
                - grant_type
                - client_id
                - client_secret
      responses:
        '200':
          description: Successful Access Token Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                    example: Bearer
                  expires_in:
                    type: integer
                  scope:
                    type: string
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /service/v2/ocr:
    post:
      summary: Perform OCR and IDV
      description: |
        Perform OCR (Optical Character Recognition) and document verification.
        Requires a Bearer token and domain ID.
        Use the following URLs depending on your environment:
          - Demo: https://d1.cynopsis.co
          - Production: https://util.cynopsis.co
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file0:
                  type: string
                  format: binary
                  description: Main document image file
                file1:
                  type: string
                  format: binary
                  description: (Optional) Second document image file (back, if required)
              required:
                - file0
      parameters:
        - name: X-Domain-Id
          in: header
          required: true
          schema:
            type: string
          description: Domain ID
      responses:
        '201':
          description: OCR and IDV Result
          content:
            application/json:
              schema:
                type: object
              example:
                task_id: b1259f10-1c4e-42d2-b96e-7f553d87c345
                status_task: SUCCESS
                result:
                  last_name: LEE
                  first_name: MICHAEL
                  full_name: MICHAEL LEE
                  full_name2: LEE MICHAEL
                  gender: M
                  race: ASIAN
                  date_of_birth: '1983-11-19'
                  domicile: SINGAPORE
                  address: 123 JURONG WEST, SINGAPORE
                  passport_number: E8573920N
                  document_number: A0123456
                  personal_id_number: S3344556D
                  issuing_country: MALAYSIA
                  country_of_birth: MALAYSIA
                  nationality: MALAYSIAN
                  passport_expiry_date: '2028-12-10'
                  expiry_date: '2028-12-31'
                  issue_date: '2023-01-05'
                  optional_data: null
                  profession: ENGINEER
                  birth date: '1983-11-19'
                  expiry date: '2028-12-31'
                  mrz_raw_string: IDMYS3344556D8301196M2812319<<<<<<<<<<<<<<04
                  identifier: U0987654
                  employer: Acme Corp
                  status: UNCERTAIN
                  document_type: PASSPORT
                  document_type_name: INTERNATIONAL PASSPORT
                  valid genre format: 'true'
                  final hash: 'true'
                  expiry date hash: 'true'
                  optional data hash: 'true'
                  document type format: 'true'
                  valid country code: 'true'
                  valid nationality code: 'true'
                  document number hash: 'true'
                  birth date hash: 'true'
                  document number format: 'true'
                  optional data format: 'true'
                  docver_check:
                    id: 02f54862-c9ba-4a82-abde-c22183f362e1
                    code: 8899
                    person:
                      gender: M
                      idNumber: S3344556D
                      lastName: LEE
                      addresses:
                        - 123 JURONG WEST, SINGAPORE
                      firstName: MICHAEL
                      citizenship: MALAYSIAN
                      dateOfBirth: '1983-11-19'
                      nationality: MALAYSIAN
                      yearOfBirth: 1983
                      placeOfBirth: KUALA LUMPUR
                      pepSanctionMatch: false
                    reason: All document features match specimen.
                    status: approved
                    comments:
                      - Verified by automated system.
                    document:
                      type: PASSPORT
                      state: VALID
                      number: A0123456
                      country: MY
                      validFrom: '2023-01-05'
                      validUntil: '2028-12-31'
                    attemptId: a777aaf8-5daf-498c-ada0-c9121f3aaa2f
                    endUserId: user-99123
                    reasonCode: 100
                    vendorData: Extra info
                    decisionTime: '2026-02-13T09:05:20.105392Z'
                    acceptanceTime: '2026-02-13T09:05:10.388182Z'
                    submissionTime: '2026-02-13T09:05:11.222100Z'
                    additionalVerifiedData: {}
                    recommendation: ''
                  ignored_fields: []
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /service/facecompare:
    post:
      summary: Perform Face Compare
      description: >
        Perform face comparison between two images. Requires Bearer token and
        domain ID. Use the following URLs depending on your environment:
          - Demo: https://d1.cynopsis.co
          - Production: https://util.cynopsis.co
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file0:
                  type: string
                  format: binary
                  description: Selfie image file
                file1:
                  type: string
                  format: binary
                  description: Document image file
              required:
                - file0
                - file1
      parameters:
        - name: X-Domain-Id
          in: header
          required: true
          schema:
            type: string
          description: Domain ID
      responses:
        '201':
          description: Face Compare Result
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    type: string
                    example: cde65789-3a79-43e9-b774-e6d9a1880250
                  status:
                    type: string
                    example: MATCHED
                  status_task:
                    type: string
                    example: SUCCESS
                  result:
                    type: object
                    properties:
                      simiarity:
                        type: number
                        format: float
                        example: 0.9
                      matched:
                        type: boolean
                        example: true
                      error:
                        type: string
                        example: ''
                example:
                  task_id: cde65789-3a79-43e9-b774-e6d9a1880250
                  status: MATCHED
                  status_task: SUCCESS
                  result:
                    simiarity: 0.9
                    matched: true
                    error: ''
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /service/liveness-v2/get_session_token:
    get:
      summary: Liveness - Get Session Token
      description: |
        Get a session token for liveness check.
        Requires Bearer token and domain ID.
        Use the following URLs depending on your environment:
          - Demo: https://d1.cynopsis.co
          - Production: https://util.cynopsis.co
      security:
        - bearerAuth: []
      parameters:
        - name: X-Domain-Id
          in: header
          required: true
          schema:
            type: string
          description: Domain ID
      responses:
        '200':
          description: Liveness session token response
          content:
            application/json:
              schema:
                type: object
                description: Liveness session token result
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /service/liveness-v2/liveness_session:
    get:
      summary: Liveness - Get Session ID
      description: |
        Get a liveness session ID.
        Requires Bearer token and domain ID.
        Use the following URLs depending on your environment:
          - Demo: https://d1.cynopsis.co
          - Production: https://util.cynopsis.co
      security:
        - bearerAuth: []
      parameters:
        - name: X-Domain-Id
          in: header
          required: true
          schema:
            type: string
          description: Domain ID
      responses:
        '200':
          description: Liveness session ID response
          content:
            application/json:
              schema:
                type: object
                description: Liveness session ID result
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
  /service/liveness-v2/liveness_result/{session_id}:
    get:
      summary: Liveness - Get Result
      description: |
        Get the result of a liveness check using the session ID.
        Requires Bearer token and domain ID.
        Use the following URLs depending on your environment:
          - Demo: https://d1.cynopsis.co
          - Production: https://util.cynopsis.co
      security:
        - bearerAuth: []
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
          description: Liveness session ID
        - name: X-Domain-Id
          in: header
          required: true
          schema:
            type: string
          description: Domain ID
      responses:
        '200':
          description: Liveness check result
          content:
            application/json:
              schema:
                type: object
                description: Liveness check result object
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
