Delete a machine instance and any transitions, state, or pending upgrades associated with it.

DELETE /machines/{machineSlug}/i/{instanceSlug}

Delete a machine instance and any transitions, state, or pending upgrades associated with it.

THIS IS OBVIOUSLY A DANGEROUS OPERATION AND WILL INTENTIONALLY CAUSE DATA LOSS

All historical transitions associated with the machine and all current state and context will be deleted.

There is no option to recover data after an instance is deleted.

To prevent accidental deletion, we require two validation parameters:

  • hmacSha256OfMachineInstanceNameWithMachineNameKey - base64urlEncode(hmacSha256(key = "machine name", "machine instance name"))
  • dangerDataWillBeDeletedForever - true

A 400 error with the parameter set to the name of the incorrect parameter will be returned if the validation parameters are incorrect.

This endpoint requires admin access.

Path parameters

  • machineSlug string Required

    The slug/name for the machine definition to delete.

    Minimum length is 1. Format should match the following pattern: ^[a-zA-Z0-9_-]{1,128}$.

  • instanceSlug string Required

    The slug/name for the machine instance.

    Minimum length is 1. Format should match the following pattern: ^[a-zA-Z0-9_-]{1,128}$.

application/json

Body

Validation parameters to prove that you really do want to delete the instance.

  • Just to ensure that you understand the ramifications of this action.

    Value is true.

  • This parameter serves to verify that you have read the documentation prior to deleting a machine and have taken the time to consider whether you really want to do so.

    Provide base64urlEncode(hmacSha256(key = "machine name", "machine instance name"))

Responses

  • 204

    The machine instance was deleted successfully.

  • 400

    The request was malformed.

    Hide response attributes Show response attributes object
    • error string

      A description of the error.

    • code string

      A code specifying the type of error.

      • specify-org indicates that the user has access to multiple orgs and the operation requires specifying an organization. Pass the x-statebacked-org-id header to specify an org ID.
      • invalid-parameter indicates that one of the provided parameters was incorrect

      Values are specify-org or invalid-parameter.

    • The name of the invalid parameter

  • 403

    The request was unauthorized.

    Hide response attributes Show response attributes object
    • error string

      A description of the error.

    • code string

      A code specifying the type of error.

      Values are missing-scope, rejected-by-machine-authorizer, missing-user, or missing-org.

DELETE /machines/{machineSlug}/i/{instanceSlug}
curl \
 -X DELETE https://api.statebacked.dev/machines/my-machine/i/user-1234 \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"dangerDataWillBeDeletedForever":true,"hmacSha256OfMachineInstanceNameWithMachineNameKey":"string"}'
Request example
{
  "dangerDataWillBeDeletedForever": true,
  "hmacSha256OfMachineInstanceNameWithMachineNameKey": "string"
}
Request examples
{
  "dangerDataWillBeDeletedForever": true,
  "hmacSha256OfMachineInstanceNameWithMachineNameKey": "string"
}
Response examples (400)
{
  "error": "string",
  "code": "specify-org",
  "parameter": "string"
}
Response examples (400)
{
  "error": "string",
  "code": "specify-org",
  "parameter": "string"
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}