{
  "openapi": "3.0.1",
  "info": {
    "title": "PrefixID API",
    "version": "v1"
  },
  "paths": {
    "/Identification/Authorization": {
      "post": {
        "tags": [
          "Identification"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorizationRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorizationRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Identification/GetDocumentTypes": {
      "get": {
        "tags": [
          "Identification"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DocumentType"
                  }
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "500": {
            "description": "Server Error"
          }
        }
      }
    },
    "/Identification/RecognizeDocument": {
      "post": {
        "tags": [
          "Identification"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeDocumentRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeDocumentRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResult"
                }
              }
            }
          },
          "500": {
            "description": "Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResult"
                }
              }
            }
          }
        }
      }
    },
    "/Identification/RecognizeFace": {
      "post": {
        "tags": [
          "Identification"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeFaceRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeFaceRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RecognizeFaceRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResult"
                }
              }
            }
          },
          "500": {
            "description": "Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OperationResult"
                }
              }
            }
          }
        }
      }
    },
    "/Identification/GetIdentificationData/{request_id}/{with_images}": {
      "get": {
        "tags": [
          "Identification"
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "style": "simple",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "with_images",
            "in": "path",
            "required": true,
            "style": "simple",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IdentificationData"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/Identification/GetWidget": {
      "post": {
        "tags": [
          "Identification"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/WidgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Address": {
        "type": "object",
        "properties": {
          "location_code": {
            "type": "string",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "community": {
            "type": "string",
            "nullable": true
          },
          "residence": {
            "type": "string",
            "nullable": true
          },
          "street": {
            "type": "string",
            "nullable": true
          },
          "buiding": {
            "type": "string",
            "nullable": true
          },
          "apartment": {
            "type": "string",
            "nullable": true
          },
          "postal_index": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AuthorizationRequest": {
        "required": [
          "partner_id",
          "partner_key",
          "request_id"
        ],
        "type": "object",
        "properties": {
          "partner_id": {
            "type": "string",
            "format": "uuid"
          },
          "partner_key": {
            "minLength": 1,
            "type": "string"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "Document": {
        "type": "object",
        "properties": {
          "ssn": {
            "type": "string",
            "nullable": true
          },
          "issuer": {
            "type": "string",
            "nullable": true
          },
          "issue_date": {
            "type": "string",
            "nullable": true
          },
          "expiry_date": {
            "type": "string",
            "nullable": true
          },
          "photo": {
            "type": "string",
            "nullable": true
          },
          "document_status": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DocumentData": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "first_name": {
            "type": "string",
            "nullable": true
          },
          "last_name": {
            "type": "string",
            "nullable": true
          },
          "birth_date": {
            "type": "string",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "nullable": true
          },
          "country_code": {
            "type": "string",
            "nullable": true
          },
          "document_code": {
            "type": "string",
            "nullable": true
          },
          "expiry_date": {
            "type": "string",
            "nullable": true
          },
          "document_number": {
            "type": "string",
            "nullable": true
          },
          "create_datetime": {
            "type": "string",
            "format": "date-time"
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "verified": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "DocumentType": {
        "required": [
          "document_code",
          "document_type"
        ],
        "type": "object",
        "properties": {
          "document_code": {
            "minLength": 1,
            "type": "string"
          },
          "document_type": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "IdentificationData": {
        "type": "object",
        "properties": {
          "document_data": {
            "$ref": "#/components/schemas/DocumentData"
          },
          "score_data": {
            "$ref": "#/components/schemas/ScoreData"
          },
          "identification_images": {
            "$ref": "#/components/schemas/IdentificationImages"
          },
          "provider_data": {
            "$ref": "#/components/schemas/ProviderData"
          }
        },
        "additionalProperties": false
      },
      "IdentificationImages": {
        "type": "object",
        "properties": {
          "front_document": {
            "type": "string",
            "nullable": true
          },
          "back_document": {
            "type": "string",
            "nullable": true
          },
          "selfie": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "OperationResult": {
        "type": "object",
        "properties": {
          "operation_code": {
            "type": "integer",
            "format": "int32"
          },
          "operation_message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Person": {
        "type": "object",
        "properties": {
          "first_name": {
            "type": "string",
            "nullable": true
          },
          "last_name": {
            "type": "string",
            "nullable": true
          },
          "middle_name": {
            "type": "string",
            "nullable": true
          },
          "first_name_eng": {
            "type": "string",
            "nullable": true
          },
          "last_name_eng": {
            "type": "string",
            "nullable": true
          },
          "middle_name_eng": {
            "type": "string",
            "nullable": true
          },
          "birth_date": {
            "type": "string",
            "nullable": true
          },
          "gender": {
            "type": "string",
            "nullable": true
          },
          "nationality": {
            "type": "string",
            "nullable": true
          },
          "citizenship": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "ProviderData": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "format": "uuid"
          },
          "person": {
            "$ref": "#/components/schemas/Person"
          },
          "document": {
            "$ref": "#/components/schemas/Document"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "score": {
            "$ref": "#/components/schemas/Score"
          },
          "create_datetime": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "RecognizeDocumentRequest": {
        "required": [
          "document_code",
          "document_side",
          "imgBase64"
        ],
        "type": "object",
        "properties": {
          "document_code": {
            "minLength": 1,
            "type": "string"
          },
          "document_side": {
            "minLength": 1,
            "type": "string"
          },
          "imgBase64": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "RecognizeFaceRequest": {
        "required": [
          "selfie1Base64",
          "selfie2Base64"
        ],
        "type": "object",
        "properties": {
          "selfie1Base64": {
            "minLength": 1,
            "type": "string"
          },
          "selfie2Base64": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Score": {
        "type": "object",
        "properties": {
          "face_similarity": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ScoreData": {
        "type": "object",
        "properties": {
          "face_similarity": {
            "type": "number",
            "format": "float"
          },
          "face_liveness": {
            "type": "number",
            "format": "float"
          },
          "document_front_score": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "document_back_score": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WidgetRequest": {
        "required": [
          "back_url",
          "document_code"
        ],
        "type": "object",
        "properties": {
          "document_code": {
            "minLength": 1,
            "type": "string"
          },
          "back_url": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "WidgetResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "key": {
            "type": "string",
            "nullable": true
          },
          "qr": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}