# Professional Headshot Generator

Generate professional headshots from your photos.

## Description

Upload a photo to generate a professional headshot image suitable for LinkedIn profiles, business cards, or other professional use cases.

## Authentication

**Required**: x402 payment

This endpoint requires payment via the x402 protocol. See the [Setup](./setup.md) for setup instructions.

## Request

**Endpoint**: `POST /api/headshot/generate`

**Content-Type**: `multipart/form-data`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| image | file | Yes | Photo of the person (JPG, PNG, or WebP, max 10MB) |
| headshotStyle | string | No | Style description (default: "LinkedIn profile") |
| outputFormat | string | No | Output format: `png` or `webp` |

## Response

**200 OK**

```json
{
  "imageUrl": "/outputs/uuid-here.png"
}
```

| Field | Type | Description |
|-------|------|-------------|
| imageUrl | string | Path to the generated headshot |

## Error Codes

| Status | Code | Description |
|--------|------|-------------|
| 400 | VALIDATION_ERROR | Invalid request parameters |
| 402 | PAYMENT_REQUIRED | x402 payment not completed |
| 413 | FILE_TOO_LARGE | File exceeds 10MB limit |
| 415 | UNSUPPORTED_FORMAT | Invalid file type (must be JPG, PNG, or WebP) |
| 422 | INVALID_IMAGE_DATA | Unable to process image |
| 500 | INTERNAL_ERROR | AI generation failed |
| 504 | AI_GENERATION_TIMEOUT | AI request timed out |

## Example

```bash
npx x402-proxy -X POST \
  -F "image=@photo.jpg" \
  -F "headshotStyle=LinkedIn profile" \
  -F "outputFormat=webp" \
  https://ps.codejar.net/api/headshot/generate
```

**Response:**
```json
{
  "imageUrl": "/outputs/550e8400-e29b-41d4-a716-446655440003.webp"
}
```
