> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Create Device Code

> Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.

`square.createDeviceCode` creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.

## Example

```ts automations/square-create-device-code.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Create Square Device Code", () => {
  onDashboardRun({ title: "Create Square Device Code" })

  square.createDeviceCode({
    idempotencyKey: "01bb00a6-0c86-4770-94ed-f5fca973cd56",
    deviceCode: {
      name: "Counter 1",
      productType: "TERMINAL_API",
      locationId: "B5E4484SHHNYH",
    },
  })
})
```

## Inputs

Every input accepts a compatible signal. It requires `DEVICE_CREDENTIAL_MANAGEMENT`.

| Field            | Type                | Required | Default | Description                                                                                                                                                                                                                                                                       |
| ---------------- | ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `idempotencyKey` | `string`            | Yes      | —       | A unique string that identifies this CreateDeviceCode request. Keys can be any valid string but must be unique for every CreateDeviceCode request. See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) for more information. |
| `deviceCode`     | `Square.DeviceCode` | Yes      | —       | The device code to create.                                                                                                                                                                                                                                                        |

Use the official [CreateDeviceCode reference](https://developer.squareup.com/reference/square/devices-api/create-device-code) for provider field semantics and limits.

## Output

Returns the official `Square.CreateDeviceCodeResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
