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

# Download BGV Report

## Overview

Download the final background verification report for a completed BGV case. Call this endpoint **after** receiving the `case.completed` webhook for the relevant `case_id`.

***

## When to Call This Endpoint

```
POST /api/async/v2/bgv-submit/
          │
          │  (async checks running...)
          ▼
  webhook: case.completed
          │
          ▼
GET /api/verification/bgv/download?case_id=<case_id>
```

The report is only available once the case status is `completed`. Calling before completion returns a 404 with `"Candidate has not submitted the BGV yet."`.

***

## Response Format

| `type` query param | Response `data.report` value                          |
| ------------------ | ----------------------------------------------------- |
| `pdf`              | GCP-hosted direct-download URL (public, time-limited) |
| *(omitted)*        | Base64-encoded PDF string                             |

### Using the Base64 report

```javascript theme={null}
const pdfBuffer = Buffer.from(data.report, "base64");
fs.writeFileSync("bgv_report.pdf", pdfBuffer);
```

***

## Notes

* The hosted PDF URL (when `type=pdf`) is publicly accessible but contains a version token (`?v=...`) — store it securely and do not expose it unnecessarily.
* The Base64 string represents the full PDF file and can be decoded client-side.


## OpenAPI

````yaml GET /verification/bgv/download
openapi: 3.0.0
info:
  title: KonnectNXT API Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://bgv.konnectnxt.com/api
    description: Production
  - url: https://testbgv.konnectnxt.com/api
    description: QA
security:
  - bearerAuth: []
paths:
  /verification/bgv/download:
    get:
      tags:
        - BGV Submit V2
      summary: Download BGV Report
      operationId: bgvReportDownload
      parameters:
        - name: case_id
          in: query
          required: true
          description: >-
            The UUID of the BGV case. Obtained from the `cases_created` array in
            the submit response, or from the webhook payload.
          schema:
            type: string
            format: uuid
          example: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
        - name: type
          in: query
          required: false
          description: >-
            Controls the report format. Use `pdf` for a hosted URL; omit for
            Base64-encoded PDF.
          schema:
            type: string
            enum:
              - pdf
          example: pdf
      responses:
        '200':
          description: Report fetched successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BGVReportDownloadResponse'
              examples:
                pdf_url:
                  summary: PDF URL response (type=pdf)
                  value:
                    success: true
                    message: Report Fetched Successfully.
                    data:
                      case_id: a1b2c3
                      candidate_name: Ravi Kumar
                      status: completed
                      created_at: '2024-06-01T08:00:00Z'
                      completed_at: '2024-06-04T10:30:00Z'
                      report: >-
                        https://storage.googleapis.com/konnectnxt-bucket/Reports/pdf/report_a1b2c3.pdf?v=84291
                base64_report:
                  summary: Base64 PDF response (type omitted)
                  value:
                    success: true
                    message: Report Fetched Successfully.
                    data:
                      case_id: a1b2c3
                      candidate_name: Ravi Kumar
                      status: completed
                      created_at: '2024-06-01T08:00:00Z'
                      completed_at: '2024-06-04T10:30:00Z'
                      report: JVBERi0xLjQK...
        '400':
          description: Invalid `case_id` format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BGVSubmitV2ErrorResponse'
              examples:
                InvalidFormat:
                  summary: Invalid case ID format
                  value:
                    success: false
                    message: Please enter the correct case Id format
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BGVSubmitV2ErrorResponse'
              examples:
                Unauthorized:
                  summary: Invalid API key
                  value:
                    success: false
                    message: Bearer token is missing or invalid.
        '404':
          description: Case not found, or candidate has not completed the BGV process yet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BGVSubmitV2ErrorResponse'
              examples:
                not_found:
                  summary: Case not found
                  value:
                    success: false
                    message: Case not found.
                not_submitted:
                  summary: Candidate BGV not yet submitted
                  value:
                    success: false
                    message: Candidate has not submitted the BGV yet.
        '500':
          description: Internal server error during report generation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BGVSubmitV2ErrorResponse'
              examples:
                ServerError:
                  summary: Report fetch failed
                  value:
                    success: false
                    message: >-
                      Oops! Couldn't fetch the report. Please try again later or
                      contact support.
components:
  schemas:
    BGVReportDownloadResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Report Fetched Successfully.
        data:
          type: object
          properties:
            case_id:
              type: string
              description: Shortened case reference ID.
              example: a1b2c3
            candidate_name:
              type: string
              example: Ravi Kumar
            status:
              type: string
              description: Current status of the case.
              example: completed
            created_at:
              type: string
              format: date-time
              example: '2024-06-01T08:00:00Z'
            completed_at:
              type: string
              format: date-time
              nullable: true
              example: '2024-06-04T10:30:00Z'
            report:
              type: string
              description: >-
                GCP-hosted PDF URL (when `type=pdf`) or Base64-encoded PDF
                string (default).
              example: >-
                https://storage.googleapis.com/konnectnxt-bucket/Reports/pdf/report_a1b2c3.pdf?v=84291
    BGVSubmitV2ErrorResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - error
          example: error
        code:
          type: integer
          example: 400
        message:
          type: string
          description: Human-readable description of the error.
          example: Invalid or missing 'candidates' array.
        data:
          type: object
          nullable: true
          example: null
        errors:
          description: Detailed error information, or null if none.
          nullable: true
          oneOf:
            - type: string
            - type: object
        credits_used:
          type: number
          nullable: true
          example: null
        credits_remaining:
          type: number
          nullable: true
          example: null
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key issued by KonnectNXT. Pass as `Authorization: Bearer
        <your_api_key>`.

````