Skip to content

Connecting to the API

MetalSoft uses an OpenAPI REST-based API.

To get started quickly, use the Postman collections:

  • Redoc documentation https://<environment_hostname>/api/v2/redoc
  • Swagger documentation https://<environment_hostname>/api/v2/swagger

The API endpoint is found at:

https://<environment_hostname>/api/v2

Retrieving your API key and connecting to the endpoint

Section titled “Retrieving your API key and connecting to the endpoint”

Log in, then click API credentials in the upper right corner.

API credentials button

Then click on the API key input to display your API key.

If the API key is compromised, regenerate it by clicking the “Generate a new key” button.

The authentication uses the API key in the Bearer header of all HTTP request methods.

  • Authorization: Bearer <API_Key> header. Note that the API key can be regenerated at any time using the UI and should be rotated periodically.
Terminal window
curl "https://<your-server>/api/v2/servers" \
-H "Authorization: Bearer <API_KEY>"
Terminal window
curl "https://<your-server>/api/v2/infrastructures" \
-H "Authorization: Bearer <API_KEY>"
Terminal window
curl "https://<your-server>/api/v2/servers/{serverId}" \
-H "Authorization: Bearer <API_KEY>"
Terminal window
curl -X POST "https://<your-server>/api/v2/infrastructures" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"siteId": 1,
"label": "my-infrastructure"
}'
Terminal window
curl -X POST "https://<your-server>/api/v2/infrastructures/{infrastructureId}/actions/deploy" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"allowDataLoss": false,
"shutdownOptions": {
"attemptSoftShutdown": true,
"softShutdownTimeoutSeconds": 180
}
}'
Terminal window
curl "https://<your-server>/api/v2/network-fabrics" \
-H "Authorization: Bearer <API_KEY>"
Terminal window
curl "https://<your-server>/api/v2/user" \
-H "Authorization: Bearer <API_KEY>"

List endpoints support pagination via page and limit query parameters:

Terminal window
curl "https://<your-server>/api/v2/servers?page=1&limit=50" \
-H "Authorization: Bearer <API_KEY>"

Consult the MetalSoft Postman REST Workspace for in-depth details on how to use the API.