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

# Generate QR Code

> Generate a QR code for a shortened URL

## Request Body

<ParamField body="urlId" type="string" required>
  URL ID to generate QR code for
</ParamField>

<ParamField body="size" type="number" default="300">
  QR code size in pixels (100-2000)
</ParamField>

<ParamField body="format" type="string" default="png">
  Image format: `png`, `svg`, or `jpeg`
</ParamField>

<ParamField body="errorCorrectionLevel" type="string" default="M">
  Error correction level: `L`, `M`, `Q`, or `H`
</ParamField>

<ParamField body="foregroundColor" type="string" default="#000000">
  Foreground color (hex format)
</ParamField>

<ParamField body="backgroundColor" type="string" default="#FFFFFF">
  Background color (hex format)
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://snip.sa/api/qr-codes \
    -H "Content-Type: application/json" \
    -H "X-API-Key: your_api_key_here" \
    -d '{
      "urlId": "507f1f77bcf86cd799439011",
      "size": 500,
      "format": "png"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await axios.post('https://snip.sa/api/qr-codes', {
    urlId: '507f1f77bcf86cd799439011',
    size: 500,
    format: 'png'
  }, {
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'your_api_key_here'
    }
  });
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "qrCode": {
        "_id": "qr123",
        "urlId": "507f1f77bcf86cd799439011",
        "imageUrl": "https://snip.sa/qr-codes/qr123.png",
        "size": 500,
        "format": "png",
        "createdAt": "2024-01-15T10:30:00.000Z"
      }
    }
  }
  ```
</ResponseExample>
