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

> ## Agent Instructions
> Use Stable documentation by default. Honor an explicit Beta request or a URL under /docs/beta/. If the requested version conflicts with the installed CLI package or API origin, clarify the target before writing integration code.
> Pages under /docs/beta/ document Beta; other product pages document Stable. Keep the CLI package, commands, API origin, and credentials within the selected version. State the documentation version in your answer.
> For MCP search, always pass version: Stable or version: Beta. Unfiltered search mixes both versions. For filesystem reads, keep Beta queries under /beta/ and exclude /beta/ from Stable queries; discover paths before reading them.
> The public docs base is https://photon.codes/docs. Convert MCP page paths to public URLs under that base, preserving /beta/ when present. Read https://photon.codes/docs/skill.md for version selection and https://photon.codes/docs/llms.txt for the version indexes.

# Start device authorization

> Start device authorization: deviceAuthorize in the TypeScript, Python and Rust clients.

`POST /v1/auth/device/code`

Starts the device authorization flow for a CLI or another device without a browser. Show the verification URL and user code, then poll the token endpoint at the returned interval. No request fields are required; any supplied body is ignored.

<Tabs>
  <Tab title="TypeScript">
    ```typescript TypeScript theme={null}
    photon.auth.device.authorize(input?: DeviceAuthorizeInput, options?: RequestOptions): Promise<DeviceAuthorizeOutput>
    ```
  </Tab>

  <Tab title="Python">
    ```python Python theme={null}
    photon.auth.device.authorize(input: DeviceAuthorizeInput | None = None) -> models.DeviceAuthorizeResponse
    ```
  </Tab>

  <Tab title="Rust">
    ```rust Rust theme={null}
    client.device_authorize().await -> Result<ResponseValue<types::DeviceAuthorizeResponse>, Error<DeviceAuthorizeError>>
    ```
  </Tab>
</Tabs>

<RequestExample>
  ```typescript TypeScript theme={null}
  import { Photon } from "@photon-ai/api";

  const photon = new Photon();
  const result = await photon.auth.device.authorize();
  ```

  ```python Python theme={null}
  from photon_api import Photon

  photon = Photon()
  result = photon.auth.device.authorize()
  ```

  ```rust Rust theme={null}
  use photon_ai_api::PhotonClientBuilder;

  let client = PhotonClientBuilder::new().build()?;
  let result = client
      .device_authorize()
      .await
      .map_err(|error| format!("{error:?}"))?
      .into_inner();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "device_code": "string",
    "expires_in": 0,
    "interval": 0,
    "user_code": "string",
    "verification_uri": "string",
    "verification_uri_complete": "string"
  }
  ```
</ResponseExample>

## Returns

**`200`** Verification details for the RFC 8628 device flow. The optional JSON or form body is ignored; the authorization client is selected by the server. DeviceAuthorizeResponse

<ResponseField name="device_code" type={"string"} required>
  Opaque device code to exchange at POST /v1/auth/device/token while waiting for the user to authorize.
</ResponseField>

<ResponseField name="expires_in" type={"number"} required>
  Lifetime of the device code and user code, in seconds.
</ResponseField>

<ResponseField name="interval" type={"number"} required>
  Minimum number of seconds to wait between token polling requests.
</ResponseField>

<ResponseField name="user_code" type={"string"} required>
  Code the user enters at verification\_uri to authorize this device.
</ResponseField>

<ResponseField name="verification_uri" type={"string"} required>
  Browser URL where the user enters user\_code and authorizes the device.
</ResponseField>

<ResponseField name="verification_uri_complete" type={"string"} required>
  Browser URL with user\_code included, ready to open or encode as a QR code.
</ResponseField>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.