---
title: "Device Authorization Request"
method: POST
path: "/oauth/device/code"
tags: ["OAuth"]
---

# Device Authorization Request

`POST /oauth/device/code`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/oauth/device/code`
- Auth: none declared
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/oauth/device/code/post.ts> (a function with typed inputs; its response is checked against the schema)

RFC 8628 Section 3.1 - Device Authorization Request.

The client requests a device code from the authorization server.
The user will then visit the verification_uri and enter the user_code
to authorize the device.

Returns device_code, user_code, verification_uri, and polling interval.

## Headers

- `user-agent` string, nullable

## Request body `application/x-www-form-urlencoded`

- BodyDeviceAuthorizationOauthDeviceCodePost
  - `client_id` string, required
  - `scope` string, nullable
  - `code_challenge` string, nullable
  - `code_challenge_method` string, nullable
  - `resource` string, nullable

## Response `200`

Successful Response

- DeviceAuthorizationResponse: RFC 8628 Section 3.2 - Device Authorization Response.
  - `device_code` string, required
  - `user_code` string, required
  - `verification_uri` string, required
  - `verification_uri_complete` string, required
  - `expires_in` integer, required
  - `interval` integer, required

## Other responses

- `400`: Bad Request
- `422`: Validation Error

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
