{
  "openapi": "3.0.0",
  "info": {
    "title": "x-gateway-external-api",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://api.xgateway.tech/api/v2"
    }
  ],
  "paths": {
    "/customer/{id}/bank-transfer/kyc": {
      "get": {
        "operationId": "GetKycApplicationDetails",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppSuccessResponse_KycApplicationDetailsResponse_"
                },
                "examples": {
                  "No customer or customer profile exists": {
                    "value": {
                      "data": {
                        "id": "00000000-0000-0000-0000-000000000000",
                        "status": null
                      },
                      "success": true
                    }
                  },
                  "User exists, KYC applicant not created": {
                    "value": {
                      "data": {
                        "id": "00000000-0000-0000-0000-000000000000",
                        "status": "CREATED"
                      },
                      "success": true
                    }
                  },
                  "Example 1": {
                    "value": {
                      "data": {
                        "id": "00000000-0000-0000-0000-000000000000",
                        "status": "SOFT_KYC_FAILED",
                        "docsMissing": [
                          {
                            "docType": "PASSPORT"
                          },
                          {
                            "docType": "DRIVERS"
                          },
                          {
                            "docType": "ID_CARD"
                          },
                          {
                            "docType": "RESIDENCE_PERMIT"
                          },
                          {
                            "docType": "SELFIE"
                          }
                        ],
                        "kycEndUserErrorMessage": "Enter your date of birth exactly as it is on your identity document."
                      },
                      "success": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppAuthenticationErrorResponse"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "errors": [
                        {
                          "code": "unauthorized",
                          "message": "You do not have permission to access this resource."
                        }
                      ],
                      "success": false
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppErrorResponse"
                }
              }
            }
          }
        },
        "description": "Retrieves the details of a Know Your Customer (KYC) application for a specified customer.\r\nThis includes the KYC status, any missing documents, and details about any issues or rejections in the KYC process.\r\n\r\nAccess to this endpoint requires a valid API key. The API key is sent in the `x-api-key` header on requests.\r\n\r\n**Status values:**\r\n- `null` - No customer or customer profile exists yet. Customer needs to be created and have an profile.\r\n- `\"CREATED\"` - Customer exists, but KYC applicant has not been created yet.\r\n- Other values - KYC process is in progress or completed (e.g., \"FULL_USER\", \"SOFT_KYC_FAILED\", etc.).",
        "summary": "Retrieves the details of a Know Your Customer (KYC) application for a specified customer.",
        "tags": [
          "Customer"
        ],
        "security": [
          {
            "api_key": []
          }
        ],
        "parameters": [
          {
            "description": "- The external identifier for the customer for whom to retrieve KYC details.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AppClientErrorResponseCode": {
        "type": "string",
        "enum": [
          "bad_request",
          "db_violation",
          "unauthorized",
          "payment_required",
          "forbidden",
          "not_found",
          "method_not_allowed",
          "not_acceptable",
          "proxy_authentication_required",
          "request_timeout",
          "conflict",
          "db_unique_violation",
          "gone",
          "length_required",
          "precondition_failed",
          "payload_too_large",
          "uri_too_long",
          "unsupported_media_type",
          "range_not_satisfiable",
          "expectation_failed",
          "misdirected_request",
          "unprocessable_content",
          "db_non_null_violation",
          "locked",
          "failed_dependency",
          "upgrade_required",
          "precondition_required",
          "too_many_requests",
          "request_header_fields_too_large",
          "unavailable_for_legal_reasons"
        ],
        "nullable": false,
        "description": "The AppClientErrorResponseCode object contains all client error response codes."
      },
      "AppServerErrorResponseCode": {
        "type": "string",
        "enum": [
          "internal_server_error",
          "not_implemented",
          "bad_gateway",
          "service_unavailable",
          "gateway_timeout",
          "http_version_not_supported",
          "variant_also_negotiates",
          "insufficient_storage",
          "loop_detected",
          "not_extended",
          "network_authentication_required"
        ],
        "nullable": false,
        "description": "The AppServerErrorResponseCode object contains all server error response codes."
      },
      "IAppError": {
        "description": "The IAppError interface represents an application error message.",
        "properties": {
          "code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppClientErrorResponseCode"
              },
              {
                "$ref": "#/components/schemas/AppServerErrorResponseCode"
              }
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppErrorResponse": {
        "description": "The AppErrorResponse object contains general information about the error message.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array"
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppAuthenticationErrorResponse": {
        "description": "The AppAuthenticationErrorResponse object contains general information about the authentication\r\nerror.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": false
          },
          "errors": {
            "items": {
              "$ref": "#/components/schemas/IAppError"
            },
            "type": "array",
            "default": [
              {
                "code": "unauthorized",
                "message": "You do not have permission to access this resource."
              }
            ]
          }
        },
        "required": [
          "success",
          "errors"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "UnblockKycSubType": {
        "description": "Represents possible customer verification statuses in Unblock system.",
        "enum": [
          "CREATED",
          "FULL_USER",
          "KYC_NEEDED",
          "PENDING_KYC_DATA",
          "KYC_PENDING",
          "SOFT_KYC_FAILED",
          "HARD_KYC_FAILED",
          "SUSPENDED"
        ],
        "type": "string"
      },
      "CustomerBankAccountStatus": {
        "allOf": [
          {
            "$ref": "#/components/schemas/UnblockKycSubType"
          }
        ],
        "nullable": true,
        "description": "Type alias for customer bank account KYC status.\r\nActs as a naming mask to avoid exposing \"Unblock\" provider name in OpenAPI specification.\r\nRepresents all possible KYC verification statuses for a bank transfer customer."
      },
      "KycProcessingStatus": {
        "description": "Represents the current in-flight KYC operation for a customer provider profile.\r\nThis is an internal X-Gateway operational state, separate from the provider-defined KYC lifecycle.\r\nThe column is null when no operation is in progress.",
        "enum": [
          "USER_CREATION_IN_PROGRESS",
          "APPLICANT_CREATION_IN_PROGRESS",
          "DOCUMENT_UPLOAD_IN_PROGRESS",
          "VERIFICATION_IN_PROGRESS"
        ],
        "type": "string"
      },
      "UnblockKYCDocType": {
        "enum": [
          "ID_CARD",
          "PASSPORT",
          "DRIVERS",
          "RESIDENCE_PERMIT",
          "UTILITY_BILL",
          "SELFIE",
          "VIDEO_SELFIE",
          "PROFILE_IMAGE",
          "ID_DOC_PHOTO",
          "AGREEMENT",
          "CONTRACT",
          "DRIVERS_TRANSLATION",
          "VEHICLE_REGISTRATION_CERTIFICATE",
          "PAYMENT_METHOD",
          "BANK_CARD",
          "COVID_VACCINATION_FORM",
          "OTHER"
        ],
        "type": "string"
      },
      "UnblockLegalDocType": {
        "enum": [
          "PRIVACY_POLICY",
          "TERMS_AND_CONDITIONS",
          "TERMS_OF_SERVICE",
          "MERCHANT_CUSTOM_DOCUMENT"
        ],
        "type": "string"
      },
      "KycApplicationDetailsResponse": {
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/CustomerBankAccountStatus"
          },
          "kycProcessingStatus": {
            "allOf": [
              {
                "$ref": "#/components/schemas/KycProcessingStatus"
              }
            ],
            "nullable": true
          },
          "docsMissing": {
            "items": {
              "properties": {
                "docType": {
                  "$ref": "#/components/schemas/UnblockKYCDocType"
                }
              },
              "required": [
                "docType"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "kycEndUserErrorMessage": {
            "type": "string"
          },
          "kycRejectLabel": {
            "type": "string"
          },
          "missingLegalDocuments": {
            "items": {
              "properties": {
                "docType": {
                  "$ref": "#/components/schemas/UnblockLegalDocType"
                }
              },
              "required": [
                "docType"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "status"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "AppSuccessResponse_KycApplicationDetailsResponse_": {
        "description": "The AppSuccessResponse object contains general information about the success execution.",
        "properties": {
          "success": {
            "type": "boolean",
            "default": true
          },
          "data": {
            "$ref": "#/components/schemas/KycApplicationDetailsResponse"
          }
        },
        "required": [
          "success",
          "data"
        ],
        "type": "object",
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "api_key": {
        "in": "header",
        "name": "x-api-key",
        "type": "apiKey"
      }
    }
  }
}