Your first API call

Learn how to make your first API call.

Authentication

In this example we will use OAuth2 client credentials flow for authentication.

Getting an Access Token

curl --location 'https://auth.myzone.org/access_token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=YOUR_CLIENT_ID' \
--data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
--data-urlencode 'scope=read:facilities'

Making Authenticated Requests

Once you have an access token, include it in the Authorization header for all API requests:

curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  "https://ext-api.myzone.org/v1/facilities"

Example Response:

{
  "limit": 10,
  "offset": 0,
  "total": 2,
  "items": [
    {
      "facilityId": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Downtown Fitness Center"
    },
    {
      "facilityId": "987fcdeb-51a2-43d1-9f47-123456789abc",
      "name": "Westside Gym"
    }
  ]
}