Skip to main content
GET
/
state
Get states
curl --request GET \
  --url https://api.onswitch.xyz/state \
  --header 'x-service-key: <api-key>'
{
  "success": true,
  "message": "States fetched successfully",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "data": [
    {
      "code": "LAGOS",
      "name": "Lagos"
    },
    {
      "code": "ABUJA",
      "name": "Abuja"
    }
  ]
}

Authorizations

x-service-key
string
header
required

Service key for API authentication

Query Parameters

country
string
required

ISO 3166-1 alpha-2 country code

Response

Successfully retrieved states

success
boolean
required
message
string
required
timestamp
string<date-time>
required
data
object[]
required