LogoLogo
BloqStakeBloqCloudGitHub
  • What is Bloq?
    • Introduction
    • Bloq Account Setup
    • Create Client Keys
    • Accounts Overview
  • Bloq Services
    • BloqNodes
      • CLI
      • Nodes Usage
    • BloqStake
      • Authenticate to Bloq API
        • Authentication
        • API Routes
      • Ethereum
        • Stake ETH
        • Withdraw ETH
        • API Routes
      • Avalanche
        • Stake AVAX
        • API Routes
  • Advanced Documentation
    • Developers Guide
      • Client Tokens
      • BloqNodes Setup
      • Authentication
    • Technical Reference
      • CLI
      • Accounts API
      • Nodes API
      • Blockchain Node API
      • Javascript SDK
    • Knowledge Base
      • How do I connect my Ethereum Node using the Web3 interface?
Powered by GitBook
On this page
  • PUT /users/{userId}/token/{token}
  • Parameters
  • Responses
  • Code sample
  • GET /users/me
  • Responses
  • Example responses
  • Code sample
  • PUT /users/me/password
  • Parameters
  • Responses
  • Code sample
  • POST /auth
  • Responses
  • Example responses
  • Code sample
  • POST /auth/token
  • Responses
  • Example Responses
  • Code sample
  • POST /users/me/client-keys
  • Responses
  • Example responses
  • Code sample
  • GET /users/me/client-keys
  • Responses
  • Example responses
  • Code sample
  • DELETE /users/me/client-keys/{id}
  • Parameters
  • Responses
  • Code sample
  • GET /users/me/events
  • Responses
  • Example Responses
  • Code sample

Was this helpful?

  1. Advanced Documentation
  2. Technical Reference

Accounts API

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

PreviousCLINextNodes API

Last updated 1 year ago

Was this helpful?

Jump to:

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

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

Parameters

Name
In
Type
Required
Description

userId

path

string

true

none

token

path

string

true

verification token sent via email

Responses

Status
Meaning
Description

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

Status
Meaning
Description
Schema

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

Name
Type
In
Required
Description

body

object

body

true

none

» oldPassword

string

body

true

none

» newPassword

string

body

true

none

Responses

Status
Meaning
Description
Schema

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

Status
Meaning
Description
Schema

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

Status
Meaning
Description
Schema

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

Status
Meaning
Description
Schema

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

Status
Meaning
Description
Schema

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

Name
In
Type
Required
Description

id

path

string

true

Key ID

Responses

Status
Meaning
Description
Schema

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

Status
Meaning
Description
Schema

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>'

DELETE /users/me/client-keys/{id}
GET /users/me
GET /users/me/client-keys
GET /users/me/events
POST /auth
POST /auth/token
POST /users/me/client-keys
PUT /users/{userId}/token/{token}
PUT /users/me/password
OK
OK
OK
OK
OK
OK
OK
No Content
OK