Create EGYM sites

POST /api/configuration/egym/sites

Success: 204 No Content

Overview

Enables one or more sites for the EGYM integration, storing each site's EGYM API key and scheduling its initial sync of members to EGYM. Send every site you want to add in one request: the call is all-or-nothing. The whole request is validated before anything is saved, and if any site cannot be enabled, none of the sites in the request are enabled and the 400 message names the site that failed.

Each site's initial sync is scheduled for midnight, in your tenant's local time zone, at the start of its initialSyncDate, which must be tomorrow or later. At that point every member who holds an active membership at the site, in one of the enabled membership type groups, is sent to EGYM. It is not a "changes since" date, and historical attendance is not sent. Enable the membership type groups first: with none enabled, the initial sync sends nobody.

Nothing is sent for a site before its initial sync. Once the initial sync completes, member changes at the site are sent in real time; List EGYM sites shows when that has happened. A member has one EGYM account across your tenant, so a member who qualifies at two EGYM sites is created at whichever site syncs them first.

A site cannot be edited once added, and adding a site that is already enabled is rejected. The equivalent Operator screen is described in How to Set Up the EGYM Integration.

Endpoint

POST {base_url}/api/configuration/egym/sites

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Request body

The body is a JSON array with one object per site. It must contain at least one site, and each site may appear only once.

FieldTypeRequiredDescription
[].siteIdstringYesThe Gladstone site to enable, as the id returned by Get all sites. Maximum 15 characters; leading and trailing spaces are removed. It must be a site that exists in your tenant and is not already enabled for EGYM, and must not be repeated in the request. Matching against existing sites ignores case.
[].apiKeystringYesThe EGYM API key for this site, issued by EGYM. Each site has its own key. Leading and trailing spaces are removed. The key is stored and only ever returned masked to its last four characters, so keep your own record of it.
[].initialSyncDatestring (date)YesThe date of the initial sync, for example 2026-10-20. Read as a date in your tenant's local time zone; any time part is ignored. Must be strictly after today in that time zone, so today's date or an earlier one is rejected. An omitted value is rejected the same way.
[].baseUrlstringNoThe EGYM API address to use for this site. When omitted, null or blank, your tenant's EGYM API URL setting is used instead; if that is also empty, the request is rejected.

Sample request

cURL
curl -X POST '{base_url}/api/configuration/egym/sites' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "siteId": "SWIM01",
    "apiKey": "{egymApiKey}",
    "initialSyncDate": "2026-10-20"
  }
]'

Sample response

204 No Content
HTTP/1.1 204 No Content

Errors

Validation failures return a plain JSON string containing the message shown below, not a problem document. The exception is a malformed body, which returns a validation problem document (application/problem+json) with an errors map keyed by field name. In every 400 case, no site in the request is enabled.

StatusMeaningWhen
400Bad requestThe body is missing, is not valid JSON, or a value is of the wrong type, such as an initialSyncDate that is not a date. Returned as a validation problem document.
400Bad requestThe array is empty — At least one site is required.
400Bad requestA siteId is missing or blank — A site id is required for every site.
400Bad requestA siteId is longer than 15 characters — Site id '{siteId}' exceeds the maximum length of 15 characters.
400Bad requestA siteId is not a site in your tenant — Site '{siteId}' does not exist.
400Bad requestAn apiKey is missing or blank — An EGYM API key is required for site {siteId}.
400Bad requestThe same site appears twice in the request — Site {siteId} appears more than once in the request.
400Bad requestThe site is already enabled for EGYM — Site {siteId} is already enabled for EGYM. Remove it first with Delete EGYM site if you need to re-add it.
400Bad requestinitialSyncDate is today, in the past or omitted — The initial sync date for site {siteId} must be tomorrow or later.
400Bad requestNo baseUrl was sent and your tenant's EGYM API URL setting is empty — An EGYM base URL is required for site {siteId} and no Integration_EGymApiUrl fallback is configured.
400Bad requestThe initial sync could not be scheduled for a site — EGYM could not be enabled for site {siteId}: {reason}. Sites in the same request that had already been set up are removed again.
401UnauthorisedThe Authorization header is missing or the token is invalid or expired.
403ForbiddenThe token is a member or anonymous token, or does not carry the products or features this endpoint requires.
500Internal server errorAn unexpected server-side failure. The body is empty. Check List EGYM sites before retrying, because a retry of a site that was enabled returns 400 "already enabled".

This page as markdown · All pages · llms.txt