Tax ID Validator API - Ruby Gem

Tax ID Validator is a comprehensive tool for validating US Tax IDs including Social Security Numbers (SSN), Employer Identification Numbers (EIN), and Individual Taxpayer Identification Numbers (ITIN).

Installation

Add this line to your application's Gemfile:

gem 'apiverve_taxidvalidator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_taxidvalidator

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_taxidvalidator'

# Initialize the client
client = APIVerve::Taxidvalidator::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ taxid: "123-45-6789" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ taxid: "123-45-6789" })
  puts response["data"]
rescue APIVerve::Taxidvalidator::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Taxidvalidator::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Taxidvalidator::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "valid": true,
    "taxid": "123-45-6789",
    "type": "SSN",
    "type_full": "Social Security Number",
    "format": "XXX-XX-XXXX",
    "normalized": "123-45-6789",
    "digits_only": "123456789",
    "masked": "***-**-6789",
    "last4": "6789",
    "is_placeholder": true,
    "validation_details": {
      "format_valid": true,
      "area_number_valid": true,
      "group_number_valid": true,
      "serial_number_valid": true
    },
    "risk_score": 35,
    "risk_level": "medium",
    "error": null
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.