Skip to content

User Account Creation API

This API documentation provides the necessary information to create a new user account using a four-step process: signing up with a phone number and client ID, creating a verification status, updating the verification session and then completing the registration with additional user details.

Getting Started

Before you start, make sure you have the following requirements:

  1. A Client ID: Request a client id (API key) from our support team or sign up for a developer account on our website.
  2. A REST client: Use a REST client like Postman or Insomnia, or write your own code using a library like requests in Python.

Headers

  • Content-Type: application/json
  • Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with the API key you received.

Step 1: Sign Up

To create an account, send a POST request to the /api/v1/auth/signup endpoint with the required payload.

Endpoint

POST https://api.stretch.com/api/v1/auth

Payload

The request payload should include the following fields:

Parameter Description Type Required Example
grant_type Type of action to perform. Must be create String Yes create
client_id Client's unique identifier String Yes 2f9445b3-5266-45cd-8a85-d5c3fff69781
phone User's phone number in international format String Yes +971509746509
type Type of user (e.g., client, coach, etc.) String No client
timezone User's timezone in IANA format String No Asia/Dubai

Payload example:

{
  "grant_type": "create",
  "client_id": "2f9445b3-5266-45cd-8a85-d5c3fff69781",
  "timezone": "Asia/Dubai",
  "phone": "+971050000000",
  "type": "client"
}

Response

If the account is created successfully, you will receive a JSON response containing the user's information:

{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "bearer",
  "access_expire": 0,
  "refresh_expire": 0,
  "scopes": "string",
  "type": "guest"
}

Step 2: Create Verification Session Request

To start a verification session, send a POST request to the /api/v1/auth/verify/phone endpoint with the required payload.

Endpoint

POST https://api.stretch.com/api/v1/auth/verify/phone

Payload

The request payload should include the following fields:

Parameter Description Type Required Example
session The session identifier String Yes string
channel The communication channel for verification String Yes sms

Response

If the verification session is created successfully, you will receive a JSON response containing the user's information:

{
  "status": "success"
}

Step 3: Update Verification Session Status

To update a verification session, send a PUT request to the /api/v1/auth/verify/phone endpoint with the required payload.

Endpoint

PUT https://api.stretch.com/api/v1/auth/verify/phone

Payload

The request payload should include the following fields:

Parameter Description Type Required Example
sid Verification session identifier String Yes string
code Verification code received by user String Yes 0000

Response

If the verification process is successfully completed, you will receive a JSON response containing the user's information:

{
  "status": "success"
}

Step 4: Completing user registration

To complete a user registration, send a PUT request to the /api/v1/auth/complete endpoint with the required payload.

Endpoint

PUT https://api.stretch.com/api/v1/auth/complete

Payload

The request payload should include the following fields:

Parameter Description Type Required Example
gender User's gender String No male
password User's password String Yes string
email User's email address String No string
username User's desired username String No string
firstName User's first name String Yes string
lastName User's last name String Yes string

Response

If you receive a successful response, you will receive a JSON response containing the user's credentials:

{
  "access_token": "string",
  "refresh_token": "string",
  "token_type": "bearer",
  "access_expire": 0,
  "refresh_expire": 0,
  "scopes": "string"
}