Fetch US States
Retrieve all US states with their abbreviations.
POST
/tools/states
Description
This endpoint retrieves all US states. Each state includes its name and two-letter abbreviation. Useful for displaying state selectors in forms or validating addresses.
Authentication
This endpoint requires Bearer token authentication via the Authorization header.
Code Examples
curl -X POST "https://api-v3.sweeppea.com/tools/states" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Response
200 OK
{
"Response": true,
"Data": {
"TotalStates": 53,
"States": [
{"Name": "Alabama", "Abbreviation": "AL"},
{"Name": "Alaska", "Abbreviation": "AK"}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
TotalStates | Number | Total number of states available |
Name | String | Full state name |
Abbreviation | String | Two-letter state abbreviation |
Notes
- Sorting: States are sorted alphabetically by name.
- Total Count: Includes all 50 US states plus DC, Puerto Rico, and US territories.
- Abbreviations: All abbreviations follow the standard USPS two-letter format.
- Use Cases: Perfect for address forms, shipping calculators, and location selectors.