{
  "openapi": "3.1.0",
  "info": {
    "title": "numberRank API",
    "version": "1.0.0",
    "description": "Check whether a phone number reads as VoIP or a real carrier line. Free, no auth, open CORS. Source of truth: Twilio Lookup line type intelligence.",
    "license": {
      "name": "Free to use"
    }
  },
  "servers": [
    {
      "url": "https://numberrank.dev"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkNumber",
        "summary": "Line type, score and grade for a phone number",
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A US number (10 digits, or 11 starting with 1) or any E.164 number starting with + and its country code.",
            "example": "+15551234567"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "text"
              ]
            },
            "description": "text returns one or two plain lines an agent can read back."
          },
          {
            "name": "ref",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Name your agent or app."
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Check"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "invalid_number"
          },
          "429": {
            "description": "rate_limited, about 20 checks per minute per IP"
          },
          "502": {
            "description": "lookup_failed"
          }
        }
      }
    },
    "/api/directory": {
      "get": {
        "operationId": "directory",
        "summary": "The numberRank directory as JSON, numbers masked",
        "responses": {
          "200": {
            "description": "Board"
          }
        }
      }
    },
    "/api/badge": {
      "get": {
        "operationId": "badge",
        "summary": "shields.io endpoint badge for a number's grade",
        "parameters": [
          {
            "name": "number",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "shields.io endpoint JSON"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Check": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "display": {
            "type": "string"
          },
          "valid": {
            "type": "boolean"
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "mobile",
              "landline",
              "fixedVoip",
              "nonFixedVoip",
              "voip",
              "tollFree",
              "personal",
              "premium",
              "sharedCost",
              "uan",
              "voicemail",
              "pager",
              "unknown",
              null
            ]
          },
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "mcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "mnc": {
            "type": [
              "string",
              "null"
            ]
          },
          "score": {
            "type": [
              "integer",
              "null"
            ],
            "description": "mobile 95, fixedVoip 45, nonFixedVoip 15, voip 15, landline 10, otherwise null"
          },
          "grade": {
            "type": [
              "string",
              "null"
            ],
            "description": "A 90-100, B 70-89, C 50-69, D 30-49, F 0-29"
          },
          "verdict": {
            "type": "object",
            "properties": {
              "pass": {
                "type": "boolean"
              },
              "label": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            }
          },
          "provider": {
            "type": "string"
          }
        }
      }
    }
  }
}
