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

# Render HTML Candidate Cards

> Generates self-contained HTML/CSS candidate profile cards for up to 10 profile IDs. Synchronous — returns immediately with rendered card snippets. Supports 'dark' (default) and 'light' themes.

Generates self-contained, responsive HTML/CSS profile cards for up to 10 candidate profile IDs. This endpoint is **synchronous** — it returns immediately with rendered card snippets.

## Overview

The rendered HTML cards are ready to embed directly into your ATS, internal recruitment dashboards, or email templates. Each card includes:

* Candidate name (gradient-styled heading)
* Current role and company
* AI match score badge
* InstaView rationale summary
* Primary skills list
* LinkedIn profile link button

No external CSS or JavaScript dependencies are required — all styling is applied inline.

## Themes

| Theme     | Description                                     |
| --------- | ----------------------------------------------- |
| `"dark"`  | Dark slate background (`#0f172a`) — **default** |
| `"light"` | Clean white background (`#ffffff`)              |

## Examples

### Request

```json theme={null}
{
  "profileIds": ["prof_a9238f82-a723", "prof_e8321c12-b912"],
  "theme": "dark"
}
```

### Response (200 OK)

```json theme={null}
{
  "success": true,
  "renderedCount": 2,
  "data": [
    {
      "profileId": "prof_a9238f82-a723",
      "success": true,
      "name": "Jane Doe",
      "htmlContent": "<div style=\"font-family: 'Inter', system-ui, ...\">\u2026</div>"
    },
    {
      "profileId": "prof_e8321c12-b912",
      "success": true,
      "name": "Alex Smith",
      "htmlContent": "<div style=\"font-family: 'Inter', system-ui, ...\">\u2026</div>"
    }
  ]
}
```

### Partial Failure (200 OK)

If a profile ID is not found for the authenticating company, it is returned with `success: false` — the rest of the batch is still rendered:

```json theme={null}
{
  "success": true,
  "renderedCount": 1,
  "data": [
    {
      "profileId": "prof_a9238f82-a723",
      "success": true,
      "name": "Jane Doe",
      "htmlContent": "<div>\u2026</div>"
    },
    {
      "profileId": "prof_unknown-xyz",
      "success": false,
      "errorCode": "PROFILE_NOT_FOUND"
    }
  ]
}
```

## Embedding the Card

The `htmlContent` string can be inserted directly into your HTML via `innerHTML` or server-side template rendering:

```javascript theme={null}
const res = await fetch('https://api.instaview.sk/sourcing/render-html', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.INSTAVIEW_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ profileIds: ['prof_a9238f82-a723'], theme: 'light' }),
});

const { data } = await res.json();

document.getElementById('candidate-container').innerHTML = data
  .filter(d => d.success)
  .map(d => d.htmlContent)
  .join('');
```

<Warning>
  Always sanitize third-party content before inserting it into the DOM if your CSP or security policy restricts inline styles. The HTML is self-contained and uses only inline CSS — no scripts are included.
</Warning>


## OpenAPI

````yaml POST /sourcing/render-html
openapi: 3.0.0
info:
  title: InstaView API
  description: |-
    InstaView API Documentation

    ## Authentication

    All endpoints require API key authentication using Bearer token:
    ```
    Authorization: Bearer sk_your_api_key_here
    ```

    ## API Key Management

    The API Key module provides comprehensive key management for:
    - **Direct Client Keys**: Company-scoped keys for your applications
    - **ATS Partner Keys**: Resource-scoped keys for ATS integrations

    ### Key Features
    - HMAC-SHA256 hashing for API key storage
    - Configurable rate limiting
    - Comprehensive audit logging
    - Company-level isolation
    - Resource scoping for ATS partners
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.instaview.sk
    description: Production API Gateway
security: []
tags: []
paths:
  /sourcing/render-html:
    post:
      tags:
        - Public Sourcing
      summary: Render HTML candidate cards
      description: >-
        Generates self-contained HTML/CSS candidate profile cards for up to 10
        profile IDs. Synchronous — returns immediately with rendered card
        snippets. Supports 'dark' (default) and 'light' themes.
      operationId: PublicSourcingController_renderHtml_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicRenderHtmlDto'
      responses:
        '200':
          description: Rendered HTML candidate cards
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicRenderHtmlResponseDto'
        '400':
          description: Bad Request - Invalid payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests - Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    PublicRenderHtmlDto:
      type: object
      properties:
        profileIds:
          type: array
          description: >-
            Array of profile IDs for which to render HTML cards. Maximum 10 per
            request.
          items:
            type: string
          minItems: 1
          maxItems: 10
          example:
            - profile_abc123
            - profile_def456
        theme:
          type: string
          description: 'Visual theme for the rendered HTML cards (default: ''dark'').'
          example: dark
          enum:
            - dark
            - light
          default: dark
      required:
        - profileIds
    PublicRenderHtmlResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the request succeeded.
          example: true
        renderedCount:
          type: integer
          description: Number of profiles for which HTML was successfully rendered.
          example: 2
        data:
          type: array
          description: Rendered HTML card results per requested profile.
          items:
            $ref: '#/components/schemas/PublicRenderHtmlResultDto'
      required:
        - success
        - renderedCount
        - data
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          type: string
          example: Validation failed
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    PublicRenderHtmlResultDto:
      type: object
      properties:
        profileId:
          type: string
          description: The profile ID for which the card was rendered.
          example: a1b2c3d4e5f6
        success:
          type: boolean
          description: Whether rendering succeeded for this profile.
          example: true
        name:
          type: string
          description: Candidate full name.
          example: Jane Smith
        htmlContent:
          type: string
          description: >-
            Fully self-contained HTML snippet for the profile card. Present when
            success = true.
          example: <div style="...">…</div>
        errorCode:
          type: string
          description: Machine-readable error code when success = false.
          example: PROFILE_NOT_FOUND
      required:
        - profileId
        - success
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key for authentication using Bearer scheme

````