Accounts API

This Accounts API reference guide describes the endpoints to access Bloq Accounts services.

Jump to:

PUT /users/{userId}/token/{token}

This resource verifies a new created user by User Id and verification token.

Parameters

NameInTypeRequiredDescription

userId

path

string

true

none

token

path

string

true

verification token sent via email

Responses

StatusMeaningDescription

200

Successful operation

Code sample

curl -X PUT https://accounts.bloq.cloud/users/user-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/token/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

GET /users/me

This resource fetches the user profile information.

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example responses

200 Response

{
  "displayName": "Example User",
  "entityType": "individual",
  "verifiedAt": "2020-04-24T20:01:55.634Z",
  "updatedAt": "2020-04-24T20:01:55.634Z",
  "billingAddress": {
    "country": "US",
    "zipCode": "12345",
    "address": "123 Abc Street",
    "state": "CA"
  },
  "createdAt": "2020-04-24T19:57:48.878Z",
  "email": "email@example.com",
  "id": "user-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Code sample

curl -X GET https://accounts.bloq.cloud/users/me \
  -H 'Authorization: Bearer <AUTH_TOKEN>'

PUT /users/me/password

This resource updates a user password.

Body parameter

{
  "oldPassword": "Old Password...",
  "newPassword": "New Password..."
}

Parameters

NameTypeInRequiredDescription

body

object

body

true

none

» oldPassword

string

body

true

none

» newPassword

string

body

true

none

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Code sample

curl -X PUT https://accounts.bloq.cloud/users/me/password \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <AUTH_TOKEN>' \
  -d '{
 "oldPassword": "Old Password...",
 "newPassword": "New Password..."
}'

POST /auth

Using HTTP Basic Authentication to provide username (ID or email) and password, this resource retrieves an Account Access Token to be passed to other Accounts API functions, for their authentication. The token expires after 12 hours and a new token may be generated at any time.

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example responses

200 Response

{
  "accessToken": "xxxxxx.xxxxxxxxxx.xxxxxx"
}

Code sample

# Using user email
curl -u email@example.com:password -X POST https://accounts.bloq.cloud/auth
# Using user ID
curl -u user-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:password -X POST https://accounts.bloq.cloud/auth

POST /auth/token

This endpoint provides a Client Access Token and a Client Refresh Token, these tokens are used to interact with cloud services like Nodes.

The Client Access Token expires after one hour and the Client Refresh Token expires after one year. The refresh access token is used to create new client access tokens.

Body parameter to create an Access and Refresh token using clientCredentials as grant type

{
  "grantType": "clientCredentials",
  "clientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Body parameter to create an access token using refreshToken as grant type

{
  "grantType": "refreshToken",
  "refreshToken": "xxxxxx.xxxxxxxxxx.xxxxxx"
}

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example Responses

200 Response

{
  "accessToken": "xxxxxx.xxxxxxxxxx.xxxxxx",
  "refreshToken": "xxxxxx.xxxxxxxxxx.xxxxxx"
}

Code sample

# Using Client Credentials Grant Type
curl -X POST https://accounts.bloq.cloud/auth/token \
  -H 'Content-Type: application/json' \
  -d '{
 "grantType": "clientCredentials",
 "clientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}'
# Using Refresh Token Grant Type
curl -X POST https://accounts.bloq.cloud/auth/token \
  -H 'Content-Type: application/json' \
  -d '{
 "grantType": "refreshToken",
 "refreshToken": "xxxxxx.xxxxxxxxxx.xxxxxx"
}'

POST /users/me/client-keys

This resource creates a new client key pair. The key pair is used to generate a Client Access Token, these access token are used to interact with cloud services like Nodes API. To access this endpoint an Account Access Token must be provided as Bearer token in the authorization header.

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example responses

200 Response

{
  "clientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "clientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "createdAt": "2020-04-24T20:35:22.808Z"
}

Code sample

curl -X POST https://accounts.bloq.cloud/users/me/client-keys \
  -H 'Authorization: Bearer <AUTH_TOKEN>'

GET /users/me/client-keys

This resource fetches Client Keys

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example responses

200 Response

[
  {
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "createdAt": "2019-03-11T13:58:53.151Z"
  },
  {
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "createdAt": "2019-03-08T19:28:00.538Z"
  }
]

Code sample

curl -X GET https://accounts.bloq.cloud/users/me/client-keys \
  -H 'Authorization: Bearer <AUTH_TOKEN>'

DELETE /users/me/client-keys/{id}

This resource removes a Client Key by ID

Parameters

NameInTypeRequiredDescription

id

path

string

true

Key ID

Responses

StatusMeaningDescriptionSchema

204

Successful operation

Inline

Code sample

curl -X DELETE https://accounts.bloq.cloud/users/me/client-keys/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
  -H 'Authorization: Bearer <AUTH_TOKEN>'

GET /users/me/events

This resource fetches the user events

Responses

StatusMeaningDescriptionSchema

200

Successful operation

Inline

Example Responses

200 Response

[
  {
    "service": "cloud-accounts",
    "output": {
      "startTime": "2020-04-24T19:57:48.988Z",
      "endTime": "2020-04-24T19:57:49.065Z",
      "httpStatusCode": 200,
      "bytesOut": 385
    },
    "serviceData": {},
    "user": "user-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "input": {},
    "createdAt": "2020-04-24T19:57:49.093Z",
    "id": "event-bfe91423-8b6b-44d1-a264-483aab8a7f0d"
  },
  {
    "service": "cloud-accounts",
    "output": {
      "startTime": "2020-04-24T20:00:34.581Z",
      "endTime": "2020-04-24T20:00:35.057Z",
      "httpStatusCode": 401,
      "bytesOut": 0
    }
  }
]

Code sample

curl -X GET https://accounts.bloq.cloud/users/me/events \
  -H 'Authorization: Bearer <AUTH_TOKEN>'

Last updated