Random Address Generator API: Generate Fake Addresses for Testing

Need realistic address data for testing forms, e-commerce checkouts, or shipping integrations? The Random Address Generator API creates properly formatted fake addresses for any country, complete with streets, cities, states, and postal codes.

Why Generate Fake Addresses?

Testing applications that handle addresses requires realistic test data. Using random strings or obviously fake data like "123 Test Street" can miss formatting bugs and does not properly test validation logic.

Our API generates addresses that follow real-world formatting patterns, include valid state/province codes, and use realistic postal code formats - catching issues that simpler test data would miss.

Supported Address Formats

The API generates addresses with country-specific formatting:

United States

Street number, street name, city, state abbreviation, 5 or 9-digit ZIP code

United Kingdom

Building number, street, city, county, postcode

Canada

Street address, city, province, postal code (A1A 1A1 format)

Australia

Street address, suburb, state abbreviation, 4-digit postcode

Legal Note: Generated addresses are fictional and should not be used for fraud or deception. They are intended solely for testing and development purposes.

Using the Random Address API

TinyFn provides a flexible endpoint to generate random addresses:

API Request
GET https://api.tinyfn.io/v1/generate/address?country=US
Headers: X-API-Key: your-api-key
Response
{
  "address": {
    "street": "4521 Oak Valley Drive",
    "street2": "Apt 302",
    "city": "Springfield",
    "state": "IL",
    "state_full": "Illinois",
    "postal_code": "62704",
    "country": "US",
    "country_full": "United States"
  },
  "formatted": "4521 Oak Valley Drive, Apt 302\nSpringfield, IL 62704\nUnited States"
}

Parameters

Parameter Type Description
country string ISO country code: US, UK, CA, AU, DE, FR (default: US)
include_street2 boolean Include apartment/suite number (default: random)
state string Specific state/province code (optional)
count integer Generate multiple addresses (1-100, default: 1)

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/generate/address?country=US&include_street2=true',
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const { address, formatted } = await response.json();
console.log(formatted);
// Use individual fields
console.log(`City: ${address.city}, State: ${address.state}`);

Python

import requests

response = requests.get(
    'https://api.tinyfn.io/v1/generate/address',
    headers={'X-API-Key': 'your-api-key'},
    params={'country': 'UK', 'count': 5}
)
data = response.json()
for addr in data['addresses']:
    print(f"{addr['street']}, {addr['city']}")

cURL

curl "https://api.tinyfn.io/v1/generate/address?country=CA" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • E-commerce Testing: Test checkout flows with realistic shipping addresses
  • Form Validation: Verify address form handling and formatting
  • Database Seeding: Populate development databases with sample addresses
  • Shipping Integration: Test shipping API integrations
  • Address Autocomplete: Test address suggestion UI components

Best Practices

  1. Match your market: Generate addresses for countries you actually serve
  2. Test edge cases: Include addresses with apartment numbers, long street names, etc.
  3. Validate postal codes: Use generated data to test postal code validation
  4. Test internationalization: Generate addresses from multiple countries
  5. Never use for fraud: These addresses are for testing only

Try the Random Address API

Get your free API key and start generating test addresses.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key