User Registration API

This document is a standard that we recommend our partners to follow. The only unique custom information to be provided would be:

  • <test_api_url>: to start the test of the partner API against a sandbox environment
  • <production_auth_api_url>: to use whenever the integration is ready
  • <production_registration_api_url>
  • <partner_api_key>: to request an access token

Environment Configuration

EnvironmentTestingProduction
Hosthttps://<test_api_url>https://<production_api_url>

Registration Process

The registration flow occurs in two phrases:

  • Get an access token using an API Key to authorize the request
  • Register a user with the generated access token

Get an Access Token

Request

Example
1GET https:​//<production_auth_api_url>
2HEADER
3X-Api-Key: <partner_api_key>
4Content-Type: application/json

Response

Example
1200
2HEADER
3 Content-Type: application/json
4BODY
5{
6 "access_token": "eyJhbGciO...",
7 "token_type": "Bearer",
8 "expires_at": 1571536335
9}

Errors

Example
1403 Forbidden. Missing API key or wrong API key
2500 Internal Server Error

Register a User

Using the access_token from the previous step, it is possible to make a request to to the User Registration service.

Request

Body paramRequiredTypeExampleDescription
gympass_user_idrequiredstringgpw-29caecdf-2d5e-40b8-82b4-d0a044fa4679Gympass Wellness User ID that will be used as reference to linked the user in both Partner and Wellness side. Also, this id will be used to send the usage data.
emailoptionalstringjohn@doe.comEmail in Gympass
first_nameoptionalstringJohnFirst name in Gympass
last_nameoptionalstringDoeLast name in Gympass
originoptionalstring `webandroidios`webOrigin of the request, in case the partner redirect differs depending on the the platform
user_statusoptionalstring1: basic, 2: premium...User status based on Gympass plan
Example
1POST https://<production_registration_api_url>
2HEADER
3 Authorization​: Bearer <access_token>
4 Content-Type: application/json
5BODY
6{
7 "gympass_user_id": "gpw-29caecdf-2d5e-40b8-82b4-d0a044fa4679",
8 "email": "john@doe.com",
9 "first_name": "John",
10 "last_name": "Doe",
11 "user_status": "1"
12}

Response

Example
1200
2HEADER
3 Content-Type: application/json
4BODY
5{
6 "redirect_link": "https://<partner_url>/path/to/signup/form"
7}

Note: This redirect_link should allow to pre-fill the user data (email, first name, last name) once the user is redirected to the registration form.

If the user already exists, return 200 with the login page as redirect_link.

Errors

Example
1400 Bad Request. Missing 'gympass_user_id'
2401 Unauthorized Request. Missing or wrong access token
3500 Internal Server Error