---
title: Generate QR Login Code
description: "Generate a QR code for mobile device login to the PocketPaw dashboard. Scan the QR code with your phone to authenticate without manually entering credentials or tokens."
api: GET /api/qr
baseUrl: http://localhost:8000
layout: '@/layouts/APIEndpointLayout.astro'
auth: bearer
section: API Reference
ogType: article
keywords: ["qr code login", "mobile auth", "qr authentication"]
tags: ["api", "authentication"]
---
## Overview
Generates a QR code PNG image that encodes the dashboard URL with an embedded access token. Scanning this QR code on a mobile device automatically authenticates the user.
This endpoint **requires authentication**. The caller must already have a valid session (via Bearer token, session cookie, or localhost bypass). The QR code embeds a short-lived (60-second) pairing token so that a leaked QR image cannot grant long-lived access.
## Response
Returns a PNG image (`image/png` content type) as a streaming response.
```bash
curl -X GET "http://localhost:8000/api/qr" \
-H "Authorization: Bearer $TOKEN" -o login-qr.png
```
```javascript
const response = await fetch("http://localhost:8000/api/qr", {
headers: { Authorization: `Bearer ${token}` },
});
const blob = await response.blob();
const url = URL.createObjectURL(blob);
// Use url in an
tag or download link
console.log("QR code blob URL:", url);
```
```python
import requests
response = requests.get(
"http://localhost:8000/api/qr",
headers={"Authorization": f"Bearer {token}"},
)
with open("login-qr.png", "wb") as f:
f.write(response.content)
print("QR code saved to login-qr.png")
```
```
Binary PNG image (content-type: image/png)
```