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

# Request device + user code

> Start a device authorization flow. Follows [RFC 8628 §3.2](https://datatracker.ietf.org/doc/html/rfc8628#section-3.2). The returned `user_code` is shown to the user; the CLI then polls `/api/auth/device/token` with `device_code` until the user approves.



## OpenAPI

````yaml /api-reference/dashboard-openapi.json post /api/auth/device/code
openapi: 3.0.3
info:
  title: Photon Dashboard API
  version: 0.1.0
  description: >-
    Authenticated REST API for the Photon Dashboard. Used by the web app and the
    `photon` CLI. Only the public-surface endpoints are listed here today.
servers:
  - url: https://app.photon.codes
security: []
tags:
  - name: Projects
    description: Project CRUD and Spectrum credentials.
  - name: Device login
    description: RFC 8628 device authorization flow used by the CLI.
paths:
  /api/auth/device/code:
    post:
      tags:
        - Device login
      summary: Request device + user code
      description: >-
        Start a device authorization flow. Follows [RFC 8628
        §3.2](https://datatracker.ietf.org/doc/html/rfc8628#section-3.2). The
        returned `user_code` is shown to the user; the CLI then polls
        `/api/auth/device/token` with `device_code` until the user approves.
      operationId: deviceCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - client_id
              properties:
                client_id:
                  type: string
                  description: >-
                    Public client id of the application requesting
                    authorization.
                scope:
                  type: string
                  description: Optional space-separated list of scopes.
      responses:
        '200':
          description: Device authorization started.
          content:
            application/json:
              schema:
                type: object
                properties:
                  device_code:
                    type: string
                  user_code:
                    type: string
                  verification_uri:
                    type: string
                    format: uri
                  verification_uri_complete:
                    type: string
                    format: uri
                  expires_in:
                    type: integer
                    description: Device code lifetime in seconds.
                  interval:
                    type: integer
                    description: Minimum polling interval in seconds.
        '400':
          description: Error response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    enum:
                      - invalid_request
                      - invalid_client
                  error_description:
                    type: string

````