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

# Fetch a consented document

> Fetch the download links for the files DigiLocker issued for a consented document.

Each link is valid for about an hour, so retrieve the files while they are live. They come as
the issuer signed them, so a signature check on one still verifies.



## OpenAPI

````yaml /suite/api-reference/openapi.json get /digilocker-simple/v1/sessions/{session_id}/documents/{doc_type}
openapi: 3.1.0
info:
  title: Privue API Suite
  description: >-
    Identity and account verification against government and banking sources.


    **Authentication.** Every request takes your API key as a bearer token:
    `Authorization: Bearer <your-key>`. A successful call to a billed endpoint
    deducts one credit; a call that fails is not charged.


    **Versioning.** Each endpoint is versioned on its own, directly in its path.
    A new version of one endpoint never moves another, so no release requires
    migrating every integration at once.


    **Retention.** Nothing you send and nothing we return is stored. Documents
    are returned as the issuer's own download links, and the response is the
    only copy, so retrieve what you need when you receive it. We record that a
    call happened, for billing and audit, never what it was about.
  version: 1.0.0
servers:
  - url: https://api.privue.ai
    description: Production
security: []
paths:
  /digilocker-simple/v1/sessions/{session_id}/documents/{doc_type}:
    get:
      tags:
        - DigiLocker Simple
      summary: Fetch a consented document
      description: >-
        Fetch the download links for the files DigiLocker issued for a consented
        document.


        Each link is valid for about an hour, so retrieve the files while they
        are live. They come as

        the issuer signed them, so a signature check on one still verifies.
      operationId: fetch_digilocker_document
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[A-Za-z0-9_-]{8,64}$
            description: session_id from the initiate-session response
            title: Session Id
          description: session_id from the initiate-session response
        - name: doc_type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/DocType'
            description: Document type to retrieve, from those consented to
          description: Document type to retrieve, from those consented to
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        default:
          description: The request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    DocType:
      type: string
      enum:
        - aadhaar
        - pan
        - driving_license
      title: DocType
      description: A document type that can be requested from DigiLocker.
    DocumentResponse:
      properties:
        code:
          type: integer
          title: Code
          description: HTTP status code of the response
        timestamp:
          type: integer
          title: Timestamp
          description: Unix millisecond timestamp of when the response was produced
        transaction_id:
          type: string
          title: Transaction Id
          description: Identifier for this call. Quote it when raising a query about one
        data:
          $ref: '#/components/schemas/Document'
      type: object
      required:
        - code
        - timestamp
        - transaction_id
        - data
      title: DocumentResponse
      description: Response to fetching a consented document.
    ErrorResponse:
      properties:
        code:
          type: integer
          title: Code
          description: HTTP status code of the response
        timestamp:
          type: integer
          title: Timestamp
          description: Unix millisecond timestamp of when the response was produced
        message:
          type: string
          title: Message
          description: What went wrong, in one sentence
        transaction_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Transaction Id
          description: >-
            Identifier for the call, present when it reached the source. Quote
            it when raising a query
      type: object
      required:
        - code
        - timestamp
        - message
      title: ErrorResponse
      description: Why a request failed.
    Document:
      properties:
        files:
          items:
            $ref: '#/components/schemas/File'
          type: array
          title: Files
      type: object
      title: Document
      description: >-
        The files DigiLocker issued for a consented document type.


        The links are short-lived, so download the files while they are valid.
        They come as the issuer

        signed them, so a signature check on one still verifies.
    File:
      properties:
        url:
          type: string
          title: Url
          description: >-
            Download link for the file, valid for about an hour after it is
            issued
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
          description: Size of the file in bytes
        metadata:
          anyOf:
            - $ref: '#/components/schemas/FileMetadata'
            - type: 'null'
      type: object
      required:
        - url
      title: File
      description: 'One issued file: a download link plus its issuer metadata.'
    FileMetadata:
      properties:
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
          description: Media type of the issued file
        last_modified:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Modified
          description: When the issuer last updated the document
        issuer_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Issuer Id
          description: Identifier of the authority that issued the document
        issuer:
          anyOf:
            - type: string
            - type: 'null'
          title: Issuer
          description: Name of the authority that issued the document
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: What the document is, as the issuer describes it
      type: object
      title: FileMetadata
      description: Issuer metadata for a returned file.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````