How-to sign-up & sign-in

Captcha

If you are using the Scalefast captcha system, you have to do a GET API call to captcha endpoint to get the image and use it in sign-up and sign-in forms.

Captcha endpoint has the following query string parameters:

FieldDescription
API VersionFor the moment, this value must be v10
bgColorCaptcha background color in encoded hexadecimal. Example: #FFFFFF
drawLinesIf true, it draws some lines over the text

Example: Get captcha without lines

curl --request GET \
  --url 'https://api.scalefast.com/captcha?API-Version=v10&bgColor=%23FFFFFF&drawLines=false&textColor=%23202020' \
  --header 'accept: application/json'

Response:

{
    "result": {
        "status": "OK",
        "errcode": "0",
        "msg": ""
    },
    "response_data": {
        "image": "https://pepapi.pepitastore.com/captcha_img/image_name.jpeg"
    }
}

You can easily take the response_data.image url and add it in your site.

Sign-Up

Access Token

In order to create a customer through Scalefast API you need to get an access token first.
You can see how to get an access token here or see the oauth API reference here

Once you have the access token, you are allowed to use POST customers endpoint to create a user in our platform.

Create customer account

In order to create a customer account, you have to do a POST API call to customers endpoint. In the following table, you will find the required parameters to do it.

FieldDescription
captchaCaptcha code
emailEmail related to customer account
info.countryCountry of the client
info.titleHonorifics
passwordPassword related to customer account
typeType of customer account (individual)
usernameUsername related to customer account

If you need more info about customer endpoint, click here

Example: Creates a customer using customer API

curl --request POST \
  --url 'https://api.scalefast.com/customers?clientID=CLIENT_ID&access_token=ACCESS_TOKEN' \
  --header 'accept: application/json' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data request_data=%7B%22captcha%22%3A%20%22HZYTJ%22%2C%20%22email%22%3A%20%22test.email%40test.com%22%2C%20%22info%22%3A%20%7B%22country%22%3A%20%22ES%22%2C%20%22title%22%3A%20%22Mr%22%7D%2C%20%22password%22%3A%20%22testpwd%22%2C%20%22type%22%3A%20%22individual%22%2C%20%22username%22%3A%20%22ThisIsATest%22%7D

Response:

{
    "result": {
        "status": "OK",
        "errcode": "0",
        "msg": ""
    },
    "response_data": {
        "userID": "123456789"
    }
}

Sign-In

Log-In

The first step to Sign-In is get the customer Access token. You have to do an API call to oauth/access_token endpoint with the customer info. In the following table, you will find the parameters you need for Sign-in:

FieldDescription
captchaCaptcha code
clientIDApplication ID provided by Scalefast
grant_typeType of authentication mecanism used. Must be set to 'password'
randToken to protect the user from CSRF attacks
userIDIdentifier of the user accesing the API. In this case it will be the customer email
user_credentialPassword of the user accesing the API. In this case it will be the customer password

Example:

curl --request POST \
  --url 'https://api.scalefast.com/oauth/access_token' \
  --header 'accept: application/json' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data request_data=%7B%22captcha%22%3A%20%22HZYTJ%22%2C%20%22clientID%22%3A%20CLIENT_ID%2C%20%22grant_type%22%3A%20%22password%22%2C%20%22rand%22%3A%20%22sdf56g4sdf87sdfs56df4sfs6df58772%22%2C%20%22userID%22%3A%20%22test.email%40test.com%22%2C%20%22user_credential%22%3A%20%22testpwd%22%7D

With this API call, you are already signed-in.

Response:

{
    "result": {
        "status": "OK",
        "errcode": 0,
        "msg": ""
    },
    "response_data": {
        "access_token": "...",
        "expires_in": 14400,
        "scope": "..."
    }
}

Update last connection date

If you want to update the last connection date of this customer, you will need to do a new API call to /user/me endpoint.

Example:

curl --request PUT \
  --url 'https://api.scalefast.com/user/me?access_token=ACCESS_TOKEN' \
  --header 'accept: application/json' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data request_data=%7B%22last_connection_date%22%3A%22UPDATE%22%7D

Response:

{
    "result": {
        "status": "OK",
        "errcode": "0",
        "msg": ""
    },
    "response_data": {
        "last_connection_date": "..."
    }
}

Get logged customer info

To get the logged customer info, you just need to do an API call to user/me endpoint.

Example:

curl --request GET \
  --url 'https://api.scalefast.com/user/me?API-Version=v10&access_token=ACCESS_TOKEN' \
  --header 'accept: application/json'