Create a new machine definition.

POST /machines

Note: No instances of a machine definition can be created until you create a machine definition version for it.

Body

Request to create a machine definition.

  • slug string Required

    An identifier for the machine definition. Must be unique within your organization.

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

  • indexes array[string]

    Name of an index on machines

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

Responses

  • The machine definition was created successfully.

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

POST /machines
curl \
 -X POST https://api.statebacked.dev/machines \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"slug":"my-machine","indexes":["string"]}'
Request example
{
  "slug": "my-machine",
  "indexes": [
    "string"
  ]
}
Request examples
{
  "slug": "my-machine",
  "indexes": [
    "string"
  ]
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}
Response examples (403)
{
  "error": "string",
  "code": "missing-scope"
}
Response examples (400)
{
  "error": "string",
  "code": "specify-org",
  "parameter": "string"
}
Response examples (400)
{
  "error": "string",
  "code": "specify-org",
  "parameter": "string"
}