Skip to main content
Docs

create()

Creates a new machine.

function create(params: CreateMachineParams): Promise<Machine>
  • Name
    name
    Type
    string
    Description

    The name of the machine.

  • Name
    scopedMachines?
    Type
    string[]
    Description

    Array of machine IDs that this machine will have access to.

  • Name
    defaultTokenTtl?
    Type
    number
    Description

    The default time-to-live (TTL) in seconds for tokens created by this machine.

Note

Importing clerkClient varies based on your framework. Refer to the Backend SDK overview for usage details, including guidance on how to access the userId and other properties.

const response = await clerkClient.machines.create({
  name: 'Email Server',
})
const response = await clerkClient.machines.create({
  name: 'API Gateway',
  scopedMachines: ['mch_123', 'mch_456'],
  defaultTokenTtl: 3600,
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/machines. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on