---
title: "Start a device authorization"
method: POST
path: "/api/users/device/authorize"
tags: ["device"]
---

# Start a device authorization

`POST /api/users/device/authorize`

## Request

- Base URL: `https://api.hostim.dev`
- URL: `https://api.hostim.dev/api/users/device/authorize`
- Auth: none required

Starts a device-code login (RFC 8628). The client shows the user code and verification URI to the user, then polls /api/users/device/token until the user approves.

## Request body

- object
  - `clientName` string: Human-readable name of the client requesting access.

## Response `200`

Authorization started

- DeviceAuthorization
  - `deviceCode` string, required: Secret held by the client; poll /api/users/device/token with it.
  - `userCode` string, required: Short code the user types on the approval page.
  - `verificationUri` string, required: Page where the user approves the request.
  - `verificationUriComplete` string: Same page with the user code pre-filled.
  - `expiresIn` integer, required: Seconds until the authorization expires.
  - `interval` integer, required: Minimum seconds between polls.

## Other responses

- `500`: Internal server error

---

[API](https://skmtc.dev/hostim/apis/hostim-api.md) · [All operations](https://skmtc.dev/hostim/apis/hostim-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostim/apis/hostim-api/revisions/37c35e1026a9?raw)
