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

# Get engagement summary

> Aggregate engagement counts plus the most recent events for a render.



## OpenAPI

````yaml /openapi.yaml get /v1/renders/{id}/engagement
openapi: 3.1.0
info:
  title: Craftkit API
  version: 1.0.0
  description: >
    The Craftkit public REST API. Design templates with typed variables, render

    PDFs asynchronously, share and track them, and send them out for digital

    signature.


    ## Authentication


    Most endpoints authenticate with a **project API key** as a bearer token:


    ```

    Authorization: Bearer ck_live_xxxxxxxxxxxxxxxx

    ```


    Keys come in `ck_live_` (production) and `ck_test_` (test) flavours. Embed

    iframe surfaces use a short-lived **embed session JWT** instead, and the

    admin provisioning endpoint uses the deployment-wide `CRAFTKIT_ADMIN_KEY`.

    Inbound webhooks (`/v1/hooks/*`) are not bearer-authed — they are verified
    by

    an HMAC signature header.


    ## Idempotency


    `POST /v1/templates/{slug}/render` and `POST /v1/signatures` accept an

    `Idempotency-Key` request header. Retrying with the same key returns the

    original resource instead of creating (and, for signatures, billing) a

    duplicate.


    ## Errors


    Application errors use a shared envelope:


    ```json

    { "error": { "code": "invalid_request", "message": "...", "issues": { } } }

    ```


    A small number of admin/embed endpoints return a flatter shape

    (`{ "error": "invalid_credentials" }`); those are documented inline.
servers:
  - url: https://api.craftkit.dev
    description: Production
security:
  - bearerApiKey: []
tags:
  - name: Templates
    description: Create, list, fetch, republish, delete templates and enqueue renders.
  - name: Renders
    description: Poll render status, download PDFs, manage shares, email, and engagement.
  - name: Signatures
    description: >-
      Send rendered PDFs out for digital signatures via the signature service
      and track status.
  - name: Webhooks
    description: Inbound webhook receivers (HMAC-authenticated, not bearer-authed).
  - name: Embed
    description: Embed session minting, catalogs, builder templates, form submission.
  - name: Admin
    description: Org provisioning (deployment admin key only).
  - name: System
    description: Health and status.
paths:
  /v1/renders/{id}/engagement:
    parameters:
      - $ref: '#/components/parameters/RenderId'
    get:
      tags:
        - Renders
      summary: Get engagement summary
      description: Aggregate engagement counts plus the most recent events for a render.
      operationId: getRenderEngagement
      responses:
        '200':
          description: Engagement summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngagementSummary'
              example:
                counts:
                  viewed: 12
                  downloaded: 3
                  printed: 0
                  email_opened: 5
                  email_sent: 1
                  share_created: 1
                  share_revoked: 0
                linkOpens: 8
                total: 22
                recent:
                  - id: ev_1
                    eventType: viewed
                    actorKind: recipient
                    shareId: 9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
                    sourceIp: 203.0.113.4
                    userAgent: Mozilla/5.0
                    metadata: null
                    createdAt: '2026-06-21T10:10:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/RenderNotFound'
      security:
        - bearerApiKey: []
components:
  parameters:
    RenderId:
      name: id
      in: path
      required: true
      description: The render id.
      schema:
        type: string
        format: uuid
  schemas:
    EngagementSummary:
      type: object
      required:
        - counts
        - linkOpens
        - total
        - recent
      properties:
        counts:
          type: object
          description: Per-event-type counts (all keys present, zero-filled).
          additionalProperties:
            type: integer
        linkOpens:
          type: integer
          description: Count of viewed events originating from a shared link.
        total:
          type: integer
        recent:
          type: array
          items:
            type: object
            required:
              - id
              - eventType
              - actorKind
              - createdAt
            properties:
              id:
                type: string
              eventType:
                $ref: '#/components/schemas/EngagementEventType'
              actorKind:
                type: string
                enum:
                  - recipient
                  - partner
                  - system
              shareId:
                type:
                  - string
                  - 'null'
              sourceIp:
                type:
                  - string
                  - 'null'
              userAgent:
                type:
                  - string
                  - 'null'
              metadata: {}
              createdAt:
                type: string
                format: date-time
    EngagementEventType:
      type: string
      enum:
        - viewed
        - downloaded
        - printed
        - email_opened
        - email_sent
        - share_created
        - share_revoked
    Error:
      type: object
      description: Shared application error envelope.
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            issues:
              description: Optional Zod flatten() / issues detail.
      example:
        error:
          code: invalid_request
          message: Request body did not match expected shape.
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Missing Bearer token.
    RenderNotFound:
      description: Render not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Render not found.
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: >
        Project API key (`ck_live_…` or `ck_test_…`) presented as a bearer
        token.

        For embed partner endpoints this is the partner secret key, which is the

        same credential type.

````