Phone Number Validator

Phone Number Validator · GPT 작업

Sent API

API for extracting, preprocessing, and validating phone numbers from unstructured text using OpenAI and google-libphonenumber.

  • POST /api/phoneExtract, preprocess, and validate phone numbers

    This endpoint takes unstructured text as input, extracts phone numbers, formats them consistently, and validates them using google-libphonenumber. The response includes the validation results for each phone number.

원본 API 스키마
{
  "openapi": "3.1.0",
  "info": {
    "title": "Sent API",
    "description": "API for extracting, preprocessing, and validating phone numbers from unstructured text using OpenAI and google-libphonenumber.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://www.sent.dm"
    }
  ],
  "paths": {
    "/api/phone": {
      "post": {
        "summary": "Extract, preprocess, and validate phone numbers",
        "description": "This endpoint takes unstructured text as input, extracts phone numbers, formats them consistently, \nand validates them using google-libphonenumber. The response includes the validation results for each phone number.\n",
        "operationId": "extractPreprocessValidatePhoneNumbers",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string",
                "description": "Unstructured text containing phone numbers to be extracted, cleaned, and validated.\n"
              },
              "example": "Please contact us at +1 (415) 555-2671 or (442) 071-838750 for further assistance.\n"
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation results for the phone numbers extracted from the unstructured text.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "validationResults": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "original": {
                            "type": "string",
                            "description": "The original phone number."
                          },
                          "isValid": {
                            "type": "boolean",
                            "description": "Whether the phone number is valid."
                          },
                          "formattedNumber": {
                            "type": "string",
                            "description": "The phone number formatted in E.164 format."
                          },
                          "numberType": {
                            "type": "string",
                            "description": "The type of phone number (e.g., mobile, fixed line)."
                          },
                          "regionCode": {
                            "type": "string",
                            "description": "The region code for the phone number."
                          },
                          "error": {
                            "type": "string",
                            "description": "An error message, if any occurred during validation."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "validationResults": [
                    {
                      "original": "+14155552671",
                      "isValid": true,
                      "formattedNumber": "+14155552671",
                      "numberType": "MOBILE",
                      "regionCode": "US"
                    },
                    {
                      "original": "+442071838750",
                      "isValid": true,
                      "formattedNumber": "+442071838750",
                      "numberType": "FIXED_LINE",
                      "regionCode": "GB"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request due to missing or invalid function call arguments, or no valid phone numbers found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "No function call arguments returned"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized request due to missing or invalid Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ValidationResult": {
        "type": "object",
        "properties": {
          "original": {
            "type": "string",
            "description": "The original phone number."
          },
          "isValid": {
            "type": "boolean",
            "description": "Whether the phone number is valid."
          },
          "formattedNumber": {
            "type": "string",
            "description": "The phone number formatted in E.164 format."
          },
          "numberType": {
            "type": "string",
            "description": "The type of phone number (e.g., mobile, fixed line)."
          },
          "regionCode": {
            "type": "string",
            "description": "The region code for the phone number."
          },
          "error": {
            "type": "string",
            "description": "An error message, if any occurred during validation."
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}