The client account API is used when your clients sign up or log in to your platform instance through your web application. This API enables you to create, edit and delete client accounts and create sessions for the client when they log in.
This is the multi-page printable view of this section. Click here to print.
Client account API
1 - Getting started
Prerequisites
Before you get started with the client account API, you must have the following information ready:
- your
platform_idto build the base URL - the login details for your service user
Build the base URL
Use your platform_id to build up the base URL for all available REST API endpoints. See Base URL for more information.
For example, if your platform_id is my_company_platform_id, then the base URL for the REST API endpoints in your staging environment is https://api.staging.my_company_platform_id.platform.io.
Fetch API token
Before calling the client account API endpoints, fetch an API token with your service user using the Authentication API endpoint.
For example, if your service user for your staging environment has the following login details:
username: service_userpassword: xxxyyy
, then the call looks as follows:
curl POST https://api.staging.my_company_platform_id.platform.io/v1/login/password \
--data '{
"username": "service_user",
"password": "xxxyyy"
}'
, with a success response as follows:
{
"api_token": "your_api_token"
}
Create a client account
Use the newly created API token as a bearer token in the header for each call to the client account API endpoints. For example, when you create a new client account. See Create client account for more information.
Example call:
curl POST https://api.staging.my_company_platform_id.platform.io/v1/client/signup \
--header 'Authorization: Bearer your_api_token' \
--data '{
"user_id": "80491f93-1eb1-42c2-b5e1-d2e94dac5ab9",
"email": "new_client@client.com",
"name": {
"first_name": "new",
"last_name": "client"
},
"password": "new_client"
}'
Response:
{
"client_token": "client_token"
}
2 - API reference
Try out the client account API on your staging environment.