Delete a machine and any versions and migrations associated with it.

DELETE /machines/{machineSlug}

Delete a machine and any versions and migrations associated with it.

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

If any instances exist for the machine, a 409 error will be returned with an invalid-state code. You can delete the instances and then retry the machine deletion.

All versions associated with the machine and all migrations between those versions will be deleted.

There is no option to recover data after a machine is deleted.

To prevent accidental deletion, we require two validation parameters:

  • hmacSha256OfMachineNameWithMachineNameKey - base64urlEncode(hmacSha256(key = "machine name", "machine 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}$.

Body

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

  • 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 name"))

Responses

  • The machine instance was deleted successfully.

  • 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

  • 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.

  • The resource already exists.

    Hide response attributes Show response attributes object
    • code string

      Machine-readable identifier for the type of error

      Value is invalid-state.

    • error string

      Human-readable identifier for the error

DELETE /machines/{machineSlug}
curl \
 -X DELETE https://api.statebacked.dev/machines/my-machine \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"dangerDataWillBeDeletedForever":true,"hmacSha256OfMachineNameWithMachineNameKey":"string"}'
Request example
{
  "dangerDataWillBeDeletedForever": true,
  "hmacSha256OfMachineNameWithMachineNameKey": "string"
}
Request examples
{
  "dangerDataWillBeDeletedForever": true,
  "hmacSha256OfMachineNameWithMachineNameKey": "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"
}
Response examples (409)
{
  "code": "invalid-state",
  "error": "string"
}
Response examples (409)
{
  "code": "invalid-state",
  "error": "string"
}