Base /accounts APIs

Use the base /accounts endpoints to manage the accounts in your organization.


GET /accounts/{id}

GET /accounts/{id}

Retrieve a specific account by account Id.

Path Parameters

idThe unique identifier for an account within an organization.

Example Request

curl -X GET \
https://api.cloud-elements.com/elements/api-v2/accounts/156162\
-H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \

Example Response

[
  {
    "status": "paid",
    "environment": "production",
    "active": true,
    "createdDate": "2017-12-21",
    "id": 163647,
    "name": "Docs Account 2",
    "description": "Docs Account 2",
    "companyId": 59632,
    "externalId": "168l8ya5k73",
    "defaultAccount": false,
    "type": "CompanyAccount"
  },

POST /accounts

POST /accounts

As an organization administrator, you can add an account to your organization. Accounts typically represent your customer.

Request Body Parameters

Field
Description
Required
Type
active
Indicates if the account is active. In the JSON response true is active and false is inactive.
N
Boolean
name
The name of the account.
Y
string
description
A brief description of the account.
Y
string
externalId
A unique identifier for the account, required to add an account using POST/ accounts.
Y
string

Example Request

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/accounts \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \
  -d '{
  "name": "Account For Docs",
  "description": "This account is used to demonstrate a POST /accounts request",
  "externalId": "notsorandomId"
}
'

Example Response

{
    "id": 4030,
    "name": "Account For Docs",
    "description": "This account is used to demonstrate a POST /accounts request",
    "active": true,
    "companyId": 819,
    "externalId": "notsorandomId",
    "defaultAccount": false,
    "type": "CompanyAccount"
}

PATCH /accounts/{id}

PATCH /accounts/{id}

Change the name, description, or externalId of a specific account with the account id and the PATCH /accounts/{id} endpoint.

You can also deactivate an account or activate an already deactivated account. Deactivating an account essentially performs the same action as deleting an account. After you deactivate an account, you cannot view it in Cloud Elements 2.0.  You can still find the account using the Cloud Elements 2.0 APIs. 

Path Parameters

idThe unique identifier for an account within an organization.

 Request Body Parameters

Field
Description
Required
Type
active
Indicates if the account is active. In the JSON response true is active and false is inactive.
N
Boolean
name
The name of the account.
Y
string
description
A brief description of the account.
Y
string
externalId
A unique identifier for the account, required to add an account using POST/ accounts.
Y
string

 Example Request

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/accounts \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \
  -d '{
  "name": "Account For Docs",
  "description": "This account is used to demonstrate a POST /instances request",
  "externalId": "notsorandomId"
}
'

 Example Response

{
    "id": 4030,
    "name": "Account For Docs",
    "description": "This account is used to demonstrate a POST /instances request",
    "active": true,
    "companyId": 819,
    "externalId": "notsorandomId",
    "defaultAccount": false,
    "type": "CompanyAccount"
}

DELETE /accounts/{id}

DELETE /accounts/{id}

Delete an account from your organization with the account id and the DELETE /accounts/{id} endpoint. Deleting an account essentially performs the same action as deactivating an account. You can recover a deleted account by reactivating it. The account will not appear in Cloud Elements 2.0 and is not retrieved by GET /accounts. You can still find the account using the account id with /accounts endpoints that use the {id} variable.

Warning: Do not delete the default organization-level account. Doing so will prevent you from logging in to Cloud Elements 2.0 or making API requests.

If you delete an account that also has users associated with it, the account deletion deactivates the users. If you reactivate the account and want to keep the same users, you must reactivate them separately.

To check for any users of the account, use GET /accounts/{id}/users. If you receive a status of 404 Not Found with the response body below, the account has no users and you can delete it.

{
    "requestId": "59664ce6e4b0bbce0a2bd24f",
    "message": "No users found"
}

Path Parameters

idThe unique identifier for an account within an organization.

Example Request

curl -X DELETE \
  https://api.cloud-elements.com/elements/api-v2/accounts/4031 \
-H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \

Example Response

A response with a 200 Status Code indicates success. You can confirm that you deleted the account with GET /accounts/{id}. In the response, active is set to false.

GET /accounts

GET /accounts

Retrieve a list of accounts.

Query Parameters

where
The CEQL search expression or the where clause, without the WHERE keyword, in a typical SQL query. For example, to search for accounts created on or after 'Jan 15, 2014’, the search expression will be where=createdDate >= ‘2014-01-15’. When this parameter is omitted, all accounts are returned in a paginated fashion.
offset
The record offset at which to begin the paginated results, defaults to 0
pageSize
The page size for the paginated results, defaults to 200

Response Fields

Example Request

curl -X GET \
https://api.cloud-elements.com/elements/api-v2/accounts?where=defaultAccount%3D%60false%60&offset=0&pageSize=100 \
-H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \

Example Response

[
  {
    "status": "paid",
    "environment": "production",
    "active": true,
    "createdDate": "2017-12-21",
    "id": 163647,
    "name": "Docs Account 2",
    "description": "Docs Account 2",
    "companyId": 59632,
    "externalId": "168l8ya5k73",
    "defaultAccount": false,
    "type": "CompanyAccount"
  },