{
  "openapi": "3.0.3",
  "info": {
    "title": "CVJinny Public API",
    "version": "1.0.0",
    "summary": "Hyper-local AI CV / résumé and cover-letter generation API.",
    "description": "Public API surface for AI agents, partner integrations, and discovery tools. The full product (auth, billing, library, agency dashboard) is web-only — this spec documents the routes that are either fully public OR exposed to authenticated SDK clients.",
    "contact": {
      "name": "CVJinny Support",
      "email": "support@cvjinny.com",
      "url": "https://cvjinny.com/contact"
    },
    "license": {
      "name": "CVJinny Attribution-Required Licence",
      "url": "https://cvjinny.com/license"
    },
    "x-licence-summary": "Citation with attribution permitted. No wholesale republication. No model training without attribution. Templates / country-rule JSON / 11-purpose taxonomy / evidence-cited writing system are proprietary."
  },
  "servers": [
    {
      "url": "https://cvjinny.com",
      "description": "Production"
    }
  ],
  "x-agent-skills": "https://cvjinny.com/.well-known/agent-skills",
  "x-llms-txt": "https://cvjinny.com/llms.txt",
  "x-ai-manifest": "https://cvjinny.com/ai-manifest.json",
  "components": {
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "sb-access-token",
        "description": "Supabase session cookie set after `/cvjinny/login` succeeds. SDK clients should run an OAuth or phone-OTP flow against `/api/auth/*` first."
      }
    },
    "schemas": {
      "ResumeExampleSummary": {
        "type": "object",
        "required": [
          "slug",
          "industry",
          "role",
          "title",
          "meta_description"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "example": "software-engineering/backend-engineer"
          },
          "industry": {
            "type": "string",
            "example": "software-engineering"
          },
          "industry_label": {
            "type": "string",
            "example": "Software Engineering"
          },
          "role": {
            "type": "string",
            "example": "backend-engineer"
          },
          "role_label": {
            "type": "string",
            "example": "Backend Engineer"
          },
          "title": {
            "type": "string"
          },
          "meta_description": {
            "type": "string"
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "published"
            ]
          }
        }
      },
      "VanityProfilePublic": {
        "type": "object",
        "required": [
          "handle",
          "profile_visibility"
        ],
        "properties": {
          "handle": {
            "type": "string",
            "example": "your-name"
          },
          "profile_visibility": {
            "type": "string",
            "enum": [
              "public",
              "unlisted"
            ]
          },
          "profile_headline": {
            "type": "string",
            "nullable": true
          },
          "profile_bio": {
            "type": "string",
            "nullable": true
          },
          "profile_links": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "label",
                "url"
              ],
              "properties": {
                "label": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "profile_avatar_url": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "featured_display_name": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ATSCheckRequest": {
        "type": "object",
        "required": [
          "cv_text"
        ],
        "properties": {
          "cv_text": {
            "type": "string",
            "minLength": 100,
            "maxLength": 30000,
            "description": "Plain-text or pasted CV body to score."
          },
          "job_description": {
            "type": "string",
            "maxLength": 8000,
            "description": "Optional JD text to compare against."
          },
          "country_iso": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "industry": {
            "type": "string",
            "maxLength": 120
          }
        }
      },
      "GenerationRequest": {
        "type": "object",
        "required": [
          "raw_inputs",
          "output_config"
        ],
        "properties": {
          "raw_inputs": {
            "type": "object",
            "required": [
              "personal_text",
              "education_text",
              "experience_text"
            ],
            "properties": {
              "personal_text": {
                "type": "string",
                "minLength": 10
              },
              "education_text": {
                "type": "string",
                "minLength": 10
              },
              "experience_text": {
                "type": "string",
                "minLength": 10
              },
              "other_text": {
                "type": "string"
              },
              "projects_certs_text": {
                "type": "string"
              }
            }
          },
          "output_config": {
            "type": "object",
            "required": [
              "language",
              "country",
              "layout_id",
              "mode"
            ],
            "properties": {
              "language": {
                "type": "string",
                "minLength": 2,
                "maxLength": 10
              },
              "country": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              },
              "industry": {
                "type": "string",
                "nullable": true
              },
              "position": {
                "type": "string",
                "nullable": true
              },
              "layout_id": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "simple",
                  "creative"
                ]
              },
              "purpose": {
                "type": "string",
                "nullable": true
              },
              "section_order": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "nullable": true,
                "description": "Item #11 — drag-drop section order."
              },
              "rich_text_enabled": {
                "type": "boolean",
                "description": "Item #12 — honour markdown markers."
              }
            }
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  },
  "paths": {
    "/llms.txt": {
      "get": {
        "summary": "Machine-readable product summary (llmstxt.org)",
        "tags": [
          "Discovery"
        ],
        "responses": {
          "200": {
            "description": "Plain-text product summary.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/ai-manifest.json": {
      "get": {
        "summary": "Structured product manifest (countries, languages, plans).",
        "tags": [
          "Discovery"
        ],
        "responses": {
          "200": {
            "description": "JSON product manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/agent-skills": {
      "get": {
        "summary": "Anthropic / OpenAI-style agent-skills manifest.",
        "tags": [
          "Agent"
        ],
        "responses": {
          "200": {
            "description": "JSON list of skills the agent can invoke.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/resume-examples": {
      "get": {
        "summary": "Index of every industry × role example resume.",
        "tags": [
          "Public"
        ],
        "responses": {
          "200": {
            "description": "HTML index page (renders /resume-examples).",
            "content": {
              "text/html": {}
            }
          }
        }
      }
    },
    "/resume-examples/{industry}/{role}": {
      "get": {
        "summary": "Detail page for one example resume.",
        "tags": [
          "Public"
        ],
        "parameters": [
          {
            "name": "industry",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "role",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML detail page."
          },
          "404": {
            "description": "Slug not found."
          }
        }
      }
    },
    "/u/{handle}": {
      "get": {
        "summary": "Public vanity profile (Item #14).",
        "tags": [
          "Public"
        ],
        "parameters": [
          {
            "name": "handle",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9](?:[a-z0-9-]{1,28}[a-z0-9])?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML profile page."
          },
          "404": {
            "description": "Handle not found or profile is private."
          }
        }
      }
    },
    "/v/{code}": {
      "get": {
        "summary": "Recruiter share-link viewer (ephemeral, owner-revocable).",
        "tags": [
          "Public"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,16}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Protected CV viewer."
          },
          "404": {
            "description": "Code not found / expired / revoked."
          }
        }
      }
    },
    "/api/cvjinny/generate": {
      "post": {
        "summary": "Generate a CV + cover letter (authenticated, billed).",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Streaming JSON. Final envelope contains generation_id, library_id, honesty_score, warnings, cv_bytes, cover_bytes — OR error/code on failure."
          },
          "401": {
            "description": "Not authenticated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "402": {
            "description": "Plan expired or insufficient credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate-limited."
          }
        }
      }
    },
    "/api/cvjinny/ats-checker": {
      "post": {
        "summary": "Free public ATS resume check.",
        "tags": [
          "Public"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ATSCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "5-parser ATS analysis with score + recommendations."
          },
          "429": {
            "description": "Rate-limited (per-IP)."
          }
        }
      }
    },
    "/api/cvjinny/application-kit/new": {
      "post": {
        "summary": "Application Kit bundle (cover + 2 emails + LinkedIn).",
        "tags": [
          "Generation"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "requestBody": {
          "required": true
        },
        "responses": {
          "200": {
            "description": "JSON envelope with cover_letter / intro_email / follow_up_email / linkedin_outreach."
          },
          "402": {
            "description": "Insufficient credits."
          },
          "429": {
            "description": "Rate-limited."
          }
        }
      }
    },
    "/api/cvjinny/library/{id}/preview": {
      "get": {
        "summary": "Owner-only PDF preview (inline) or download (attachment).",
        "tags": [
          "Library"
        ],
        "security": [
          {
            "sessionCookie": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PDF body."
          },
          "401": {
            "description": "Not authenticated."
          },
          "404": {
            "description": "Library row not found / not owned."
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Discovery",
      "description": "AI-agent + crawler endpoints."
    },
    {
      "name": "Public",
      "description": "Anonymous-accessible product pages."
    },
    {
      "name": "Generation",
      "description": "AI generation pipelines (billed)."
    },
    {
      "name": "Library",
      "description": "Per-user generated CVs + cover letters."
    },
    {
      "name": "Agent",
      "description": "Agent-skills / function-calling manifests."
    }
  ],
  "externalDocs": {
    "description": "Terms, Privacy, and licence",
    "url": "https://cvjinny.com/terms"
  }
}