Skip to main content

Accounts

Accounts are sub-divisions within an organization (e.g., departments, projects, environments). Users and service accounts belong to specific accounts.

The Account Object

{
"id": "acc-prod001",
"name": "Production Environment",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {},
"created_at": "2025-09-30T10:00:00Z",
"updated_at": "2025-09-30T10:00:00Z"
}

Attributes

AttributeTypeDescription
idstringUnique identifier for the account
namestringHuman-friendly account name
organization_idstringParent organization ID
is_defaultbooleanWhether this is the default account for new users
is_activebooleanWhether the account is active
metadataobjectOptional metadata (key-value pairs)
created_atstringISO 8601 timestamp of creation
updated_atstringISO 8601 timestamp of last update

List Accounts

Retrieves a paginated list of accounts in the organization.

GET /accounts

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
quantityinteger20Results per page (max: 100)
order_bystring-created_atSort field (prefix with - for descending)

Example Request

curl "https://api.console.solucao42.com.br/accounts?page=1&quantity=20" \
-H "Authorization: HMAC sa_abc123_acc456_xyz:signature" \
-H "x-date: 2025-09-30T12:00:00Z" \
-H "x-nonce: unique-request-id" \
-H "x-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

Example Response

{
"total": 3,
"page": 1,
"results": [
{
"id": "acc-prod001",
"name": "Production",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {},
"created_at": "2025-09-30T10:00:00Z",
"updated_at": "2025-09-30T10:00:00Z"
},
{
"id": "acc-staging001",
"name": "Staging",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {},
"created_at": "2025-09-29T10:00:00Z",
"updated_at": "2025-09-29T10:00:00Z"
},
{
"id": "acc-dev001",
"name": "Development",
"organization_id": "org-abc123xyz",
"is_default": true,
"is_active": true,
"metadata": {},
"created_at": "2025-09-28T10:00:00Z",
"updated_at": "2025-09-28T10:00:00Z"
}
]
}

Get Account

Retrieves a specific account by ID.

GET /accounts/{id}

Path Parameters

ParameterTypeDescription
idstringAccount ID

Example Request

curl https://api.console.solucao42.com.br/accounts/acc-prod001 \
-H "Authorization: HMAC sa_abc123_acc456_xyz:signature" \
-H "x-date: 2025-09-30T12:00:00Z" \
-H "x-nonce: unique-request-id" \
-H "x-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

Example Response

{
"id": "acc-prod001",
"name": "Production",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {
"environment": "production",
"region": "us-east-1"
},
"created_at": "2025-09-30T10:00:00Z",
"updated_at": "2025-09-30T10:00:00Z"
}

Create Account

Creates a new account within the organization.

POST /accounts

Request Body

{
"name": "Production",
"is_default": false,
"metadata": {
"environment": "production",
"region": "us-east-1"
}
}

Parameters

ParameterTypeRequiredDescription
namestringYesAccount name
is_defaultbooleanNoMake this the default account (default: false)
metadataobjectNoOptional metadata

Example Request

curl -X POST https://api.console.solucao42.com.br/accounts \
-H "Authorization: HMAC sa_abc123_acc456_xyz:signature" \
-H "Content-Type: application/json" \
-H "x-date: 2025-09-30T12:00:00Z" \
-H "x-nonce: unique-request-id" \
-H "x-content-sha256: <body-hash>" \
-d '{
"name": "Production",
"is_default": false
}'

Example Response

{
"id": "acc-prod002",
"name": "Production",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {},
"created_at": "2025-09-30T12:00:00Z",
"updated_at": "2025-09-30T12:00:00Z"
}

Update Account

Updates an existing account.

PATCH /accounts/{id}

Path Parameters

ParameterTypeDescription
idstringAccount ID

Request Body

{
"name": "Production Environment",
"metadata": {
"environment": "production",
"region": "us-east-1",
"cost_center": "12345"
}
}

Example Request

curl -X PATCH https://api.console.solucao42.com.br/accounts/acc-prod001 \
-H "Authorization: HMAC sa_abc123_acc456_xyz:signature" \
-H "Content-Type: application/json" \
-H "x-date: 2025-09-30T12:00:00Z" \
-H "x-nonce: unique-request-id" \
-H "x-content-sha256: <body-hash>" \
-d '{
"name": "Production Environment"
}'

Example Response

{
"id": "acc-prod001",
"name": "Production Environment",
"organization_id": "org-abc123xyz",
"is_default": false,
"is_active": true,
"metadata": {},
"created_at": "2025-09-30T10:00:00Z",
"updated_at": "2025-09-30T12:30:00Z"
}

Delete Account

Deletes an account. Users and service accounts attached to the account must be migrated first.

DELETE /accounts/{id}

Path Parameters

ParameterTypeDescription
idstringAccount ID

Example Request

curl -X DELETE https://api.console.solucao42.com.br/accounts/acc-old001 \
-H "Authorization: HMAC sa_abc123_acc456_xyz:signature" \
-H "x-date: 2025-09-30T12:00:00Z" \
-H "x-nonce: unique-request-id" \
-H "x-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

Response

204 No Content

Response Codes

CodeDescription
200Success
201Created
204No Content (delete successful)
400Invalid request body
401Authentication failed
403Insufficient permissions
404Account not found
422Validation error

Permissions

Required Permissions

ActionPermission
List accountsaccounts:ListAccounts
Get accountaccounts:GetAccount
Create accountaccounts:CreateAccount
Update accountaccounts:UpdateAccount
Delete accountaccounts:DeleteAccount
  • Users - Manage account members
  • Service Accounts - Programmatic access scoped to accounts
  • Groups - Permission groups scoped to accounts

Notes

  • At least one account must exist in an organization
  • The default account cannot be deleted
  • Deleting an account requires migrating all users and service accounts first
  • Account IDs are included in service account API key prefixes