{
  "openapi": "3.1.0",
  "info": {
    "title": "AddressMock Address API",
    "version": "1.0.0",
    "summary": "Free, keyless JSON API returning format-correct sample postal addresses.",
    "description": "Returns sample postal addresses for the United States, Hong Kong, Turkiye and Cabo Verde. No API key, no account, no per-caller quota, and CORS is open, so this endpoint can be called directly from a browser or by an autonomous agent with nothing to provision first.\n\nCity, state, ZIP code and phone area code are always drawn from the same region, so the samples pass region-consistency validation that rejects independently randomised field combinations.\n\nIMPORTANT: responses are format-correct SAMPLE data, not verified deliverable addresses. Street numbers are not guaranteed to exist or to receive mail. The data must not be used for real mail, fraud, impersonation, or bypassing a platform's region or identity checks.",
    "contact": {
      "name": "AddressMock support",
      "email": "support@addressmock.com",
      "url": "https://addressmock.com/contact"
    },
    "termsOfService": "https://addressmock.com/terms"
  },
  "servers": [
    {
      "url": "https://addressmock.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Human-readable API docs",
    "url": "https://addressmock.com/api"
  },
  "paths": {
    "/api/addresses": {
      "get": {
        "operationId": "generateAddresses",
        "summary": "Generate sample addresses",
        "description": "Returns between 1 and 100 sample addresses. Authentication is not supported and not required. Only GET and OPTIONS are accepted; any other method returns 405.",
        "security": [],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Which address set to sample from. us_tax_free restricts sampling to the five US states with no state sales tax (AK, DE, MT, NH, OR). jp returns Japanese addresses whose machi (town area), 7-digit postal code and chome number all come from official data. gb returns UK addresses whose outward code was verified against api.postcodes.io; uk is accepted as an alias for gb. ph returns Philippine addresses from the 146 chartered cities, including a real barangay from the official PSGC.",
            "schema": {
              "type": "string",
              "enum": [
                "us",
                "us_tax_free",
                "hk",
                "cv",
                "tr",
                "jp",
                "gb",
                "uk",
                "ph"
              ],
              "default": "us"
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "description": "How many records to return. Must be an integer from 1 to 100; anything outside that range returns 400.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 1
            }
          },
          {
            "name": "gender",
            "in": "query",
            "required": false,
            "description": "Controls the generated given name.",
            "schema": {
              "type": "string",
              "enum": [
                "random",
                "male",
                "female"
              ],
              "default": "random"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Two-letter US state code. Only applies to type=us and type=us_tax_free; ignored otherwise. An unknown code returns 400, and with type=us_tax_free a state that is not tax-free returns 400. Case-insensitive.",
            "schema": {
              "type": "string",
              "enum": [
                "AL",
                "AK",
                "AZ",
                "AR",
                "CA",
                "CO",
                "CT",
                "DE",
                "DC",
                "FL",
                "GA",
                "HI",
                "ID",
                "IL",
                "IN",
                "IA",
                "KS",
                "KY",
                "LA",
                "ME",
                "MD",
                "MA",
                "MI",
                "MN",
                "MS",
                "MO",
                "MT",
                "NE",
                "NV",
                "NH",
                "NJ",
                "NM",
                "NY",
                "NC",
                "ND",
                "OH",
                "OK",
                "OR",
                "PA",
                "RI",
                "SC",
                "SD",
                "TN",
                "TX",
                "UT",
                "VT",
                "VA",
                "WA",
                "WV",
                "WI",
                "WY"
              ]
            }
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "description": "US city name. Only applies to type=us and type=us_tax_free; ignored otherwise. Unknown names fall back to a random city in the selected state.",
            "schema": {
              "type": "string"
            },
            "example": "Los Angeles"
          }
        ],
        "responses": {
          "200": {
            "description": "Generated records.",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "Always *",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "Always no-store",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid count, gender, type, or state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "badCount": {
                    "value": {
                      "error": "count must be an integer between 1 and 100"
                    }
                  },
                  "badType": {
                    "value": {
                      "error": "type must be one of: us, us_tax_free, hk, cv, tr"
                    }
                  },
                  "notTaxFree": {
                    "value": {
                      "error": "CA is not a tax-free state"
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method other than GET or OPTIONS.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "badMethod": {
                    "value": {
                      "error": "Only GET is supported"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "options": {
        "operationId": "preflightAddresses",
        "summary": "CORS preflight",
        "security": [],
        "responses": {
          "204": {
            "description": "No content. Allowed methods are GET and OPTIONS."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AddressRecord": {
        "type": "object",
        "required": [
          "firstName",
          "lastName",
          "fullName",
          "gender",
          "email",
          "phone",
          "street",
          "unit",
          "city",
          "state",
          "stateName",
          "zipCode",
          "country",
          "fullAddress"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "example": "Emily"
          },
          "lastName": {
            "type": "string",
            "example": "Carter"
          },
          "fullName": {
            "type": "string",
            "example": "Emily Carter"
          },
          "gender": {
            "type": "string",
            "enum": [
              "male",
              "female"
            ]
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Synthetic address on a sample domain. Not a real mailbox."
          },
          "phone": {
            "type": "string",
            "description": "US: (XXX) XXX-XXXX with a real area code for the state. HK: +852 plus 8 digits. TR: +90 plus 10 digits starting with 5. CV: +238 plus 7 digits. JP: mobile number, 11 digits starting 070/080/090; the landline is returned separately in phoneAlt. GB: +44 followed by a 07-range mobile with the leading 0 dropped. PH: +63 followed by a 09-range mobile with the leading 0 dropped, using a real Globe / Smart / DITO prefix.",
            "example": "(213) 555-0142"
          },
          "phoneAlt": {
            "type": "string",
            "description": "Secondary phone. Only jp records use it: a landline whose area code matches the city (Tokyo 03, Osaka 06, Sapporo 011), because Japanese forms often ask for both a mobile and a landline. The key is always present and is an empty string for every other type.",
            "example": "03-4521-8890"
          },
          "street": {
            "type": "string",
            "description": "JP: the formal Japanese notation, with the chome in kanji numerals and ban / go written out, e.g. \u795e\u5bae\u524d\u4e09\u4e01\u76ee5\u756a12\u53f7. Machi without a chome use \u756a\u5730 instead. GB: house number before the street name with no comma, per Royal Mail. PH: house number before the street name.",
            "example": "1420 Wilshire Blvd"
          },
          "streetShort": {
            "type": "string",
            "description": "Abbreviated street line. Only jp records use it: the hyphenated form Japanese people actually type on forms, e.g. \u795e\u5bae\u524d3-5-12. The key is always present and is an empty string for every other type.",
            "example": "\u795e\u5bae\u524d3-5-12"
          },
          "barangay": {
            "type": "string",
            "description": "Barangay, the smallest administrative unit in the Philippines. Only ph records use it, and there it is a required address line \u2014 local delivery relies on the barangay rather than the street name. Taken from the official PSGC list for that city. The key is always present and is an empty string for every other type.",
            "example": "Poblacion"
          },
          "unit": {
            "type": "string",
            "description": "Secondary unit (Apt / Suite / Unit for us, Daire for tr). The key is always present: it is an empty string for hk and cv records, so callers never have to branch on type.",
            "example": "Apt 4B"
          },
          "city": {
            "type": "string",
            "description": "US city; Hong Kong district; Turkish ilce (district); Cabo Verde city; Japanese shi/ku/machi (municipality); UK post town (LONDON for all Greater London outcodes, otherwise an ONS built-up area or council district name); Philippine chartered city.",
            "example": "Los Angeles"
          },
          "state": {
            "type": "string",
            "description": "Two-letter USPS code for us / us_tax_free. For other types this carries the region code (Hong Kong HKI/KLN/NT, Turkish province plate code, Cabo Verde island code) or, for jp, the romanised prefecture name that an international State / Province field expects. For gb it is the constituent country (England, Scotland, Wales, Northern Ireland); for ph it is the PSGC region abbreviation.",
            "example": "CA"
          },
          "stateName": {
            "type": "string",
            "example": "California"
          },
          "zipCode": {
            "type": "string",
            "description": "US: 5 digits drawn from that city's real ZIP list, leading zeros preserved. TR: 5 digits whose first two equal the province plate code. CV: 4 digits. JP: 7 digits written NNN-NNNN, tied to the specific machi rather than randomly generated. GB: outward and inward halves separated by a space; the outward half is a verified real outcode, the inward half is a format-correct random value because real inward codes are licensed Royal Mail PAF data. PH: 4 digits belonging to that city. HK: empty, because Hong Kong has no postal code.",
            "example": "90012"
          },
          "country": {
            "type": "string",
            "example": "United States",
            "description": "Literal value returned by the API: \"United States\" for us and us_tax_free, \"Hong Kong\" for hk, \"Turkey\" for tr, \"Cape Verde\" for cv, \"Japan\" for jp, \"United Kingdom\" for gb and uk, \"Philippines\" for ph. Note that Turkiye is the official country name adopted at the UN in 2022; the API returns the older \"Turkey\" spelling for backwards compatibility with existing callers.",
            "enum": [
              "United States",
              "Hong Kong",
              "Turkey",
              "Cape Verde",
              "Japan",
              "United Kingdom",
              "Philippines"
            ]
          },
          "fullAddress": {
            "type": "string",
            "description": "The record rendered as a single multi-line address in the local convention for its country.",
            "example": "Emily Carter\n1420 Wilshire Blvd Apt 4B\nLos Angeles, CA 90012\nUnited States"
          }
        }
      },
      "AddressResponse": {
        "type": "object",
        "required": [
          "count",
          "type",
          "results",
          "notice",
          "docs"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "description": "Number of records in results."
          },
          "type": {
            "type": "string",
            "description": "Echo of the resolved type parameter."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AddressRecord"
            }
          },
          "notice": {
            "type": "string",
            "description": "Usage disclaimer returned with every response."
          },
          "docs": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  },
  "x-pricing": {
    "tier": "free",
    "price": 0,
    "currency": "USD",
    "apiKeyRequired": false,
    "accountRequired": false,
    "recordsPerRequestMax": 100,
    "rateLimit": "No application-level rate limit or per-caller quota. Requests pass through Cloudflare's standard edge protections.",
    "details": "https://addressmock.com/pricing.md"
  }
}
