API reference
- Version
- since 1.x, describes 2.52.14
- Feature flag
- none
- For
- Workspace user, Workspace administrator
The REST API lets programs read the catalogue, list, reboot and terminate instances, and manage projects in a workspace with an access token. Ordering instances is done in the web app; the public API has no purchase route. The command-line interface uses the same API for the capabilities it covers.
Host and authentication
- Host. On the on-demand service the API host is
https://api.cerebro.cloud. On a licensed on-prem deployment it is the API host of your deployment; your administrator has it. - Token. Every request carries a workspace access token:
Authorization: Bearer <token>. Tokens are created in the web app under Workspace settings, Access tokens; the token value is shown once, at creation. See Access tokens. - Workspace. Routes are scoped by
workspace_id, shown on the same page as the token.
Token permissions
A token always carries view-projects and view-instances. The other permissions are chosen when the token is created. Each route below names the permission it needs.
| Permission | Routes using it |
|---|---|
| any active token | 7 |
view-instances | 6 |
manage-instances | 1 |
destroy-instances | 1 |
view-projects | 3 |
manage-projects | 3 |
Route groups
- Assets: 4 routes
- Workspace Assets: 1 route
- Workspace Instances: 8 routes
- Workspace Projects: 8 routes
Errors
Error responses share one JSON shape:
| Field | Type | Required | Notes |
|---|---|---|---|
message | string | ||
code | string | ||
cause | string nullable | one of 46 cause codes (see the API overview) | |
payload | object nullable | ||
payload.{some_key} | string |
Status codes used: 200, 204, 400, 401, 403, 404, 422, 429, 500.
All 67 cause codes defined by the API
| Cause | Meaning |
|---|---|
no_email_field | Request was received without email field that was expected, validation will probably throw error before we get here |
no_password_field | same as the above |
no_email_attribute | same as the above |
no_password_attribute | same as the above |
registration_invalid_email | email provided for registration is invalid |
registration_invalid_password | Password provided for registration is invalid |
registration_invalid_otp_token | OTP Token provided for registration is invalid |
registration_email_already_in_use | Email taht user tries to register with is already in use |
token_action_executed | any kind of verification process (email, reset password, freeze account) will get its actionable token, you'll get this error when token was already executed |
token_action_expired | for the above mentioned token, this will be error when user tries using it after it has expired |
active_user_cannot_be_deleted_permanently | Error that will be displayed in rare cases when super-admin tries to delete forever active user |
input is out of range | Input is out of range |
no possible date and time matching input | No possible date and time matching input |
input is not enough for unique date and time | Input is not enough for unique date and time |
input_contains_invalid_characters | input_contains_invalid_characters |
premature_end_of_input | premature_end_of_input |
trailing_input | trailing_input |
bad_or_unsupported_format_string | bad_or_unsupported_format_string |
invalid_number_of_answers:{} | Error that will be returned when on any question based request you send invalid number of answers |
invalid_otp_token | Invalid OTP Token |
cannot_reassign_only_owner | Error that is returned when the request would leave a company without any administrator users |
cannot_expire_only_owner | Error that is returned when the request would leave a company without any administrator users |
content_disposition | Error that is returned when the Content-Disposition header is not set |
filename | Error that is returned when the File name is not sent in upload request |
file_type_not_allowed | Invalid File type |
maximum_file_size_exceeded | Maximum File size exceeded |
cannot_delete_default | When user tries to delete company_pipeline if it is the default one, he will get this error and will need to assign different one as default |
uploader:content_disposition:unknown | Something is wrong with the upload data or its type |
uploader:filename:unknown | Something is wrong with the upload data or its type |
one_time_password_expired | One time password that is sent to users with disabled 2fa after first step of login has expired |
bare_metal_product_item_already_assigned_to_bare_metal_product | When user tries to add bare metal product item that already exists on bare metal product |
cannot_delete_workspace_owner_account | When admin tries to delete a user that is an owner of a workspace |
user_already_deactivated | When admin tries to deactivate a user that is already deactivated |
workspace_already_deactivated | When trying to deactivate a workspace that was already deactivated |
all_workspace_instances_must_be_terminated_before_deactivation | When trying to deactivate a workspace with active workspace instances |
bare_metal_product_active_cannot_update | When trying to update a product that is currently active |
bare_metal_product_already_deleted | When trying to delete a product that has already been deleted |
active_bare_metal_product_cannot_be_deleted | When trying to delete a currently active product |
deleted_bare_metal_product_cannot_be_activated | When trying to activate a deleted product |
bare_metal_product_already_inactive | When trying to deactivate a product that is already inactive |
cannot_restore_deleted_user | When trying to restore a user that was deleted forever |
cannot_restore_active_user | When trying to restore a user that is currently active |
cannot_reset_password_of_deleted_user | When trying to reset password of deleted user |
cannot_freeze_deleted_user | When trying to freeze deleted user |
user_already_deleted | When trying to delete a user that was already deleted |
cannot_impersonate_deleted_user | When trying to impersonate a deleted user |
account_decativated | account has been soft deleted/user is banned |
email_not_verified | email of the account has not been verified |
invalid_credentials | user or password not ok |
no_session | no session found and it was expected to be there |
authentication_failed_no_session_found_ch | no session found in cache |
oauth_google_invalid_authorization_code | code given from the oauth provider is invalid |
oauth_github_invalid_authorization_code | code given from the oauth provider is invalid |
oauth_gitlab_invalid_authorization_code | code given from the oauth is invalid |
oauth_microsoft_invalid_authorization_code | code given from the oauth provider is invalid |
authentication_failed_no_intermediate_session | no intermediate session found and it was expected to be there (first step of login skipped) |
invalid_one_time_password | one time password is invalid (token sent to user after login if 2fa is enabled) |
no_access_for_jwt | error that will be thrown on routes where no JWT access is allowed and JWT was used |
no_tfa_code_param_provided | routes that require authenticating with tfa will return this error if no code is provided |
no_session_on_tfa_check | this error is thrown near the above mentioned error, but is almost impossible to get it |
no_tfa_secret_set_for_user | this error comes from the middleware that checks two factor for some routes and is a result when user trying the route does not have the tfa set |
invalid_otp_code_provided | this error comes from the middleware that checks two factor for some routes and is thrown when the code does not match the secret |
permission_denied_missing_role | this error means that the user does not have role with permissions |
permission_denied_missing_permission:{} | this error will show you that user does not have valid permission to access the route and will give you the name of missing permission |
permission_denied_cannot_do_on_self | this is error that user will get if he tries doing some protected action on himself, his session or his role |
bare_metal_operating_system_is_active | this error means that user is trying to delete a bare metal operating system that is active |
bare_metal_product_already_active | this error means that user is trying to add bare metal product item to bare metal product that is already active |
Public API that enables you to manage your workspace and its resources.