> ## Documentation Index
> Fetch the complete documentation index at: https://developer.sandbox.co.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Document

> Pass the session id and the document type to fetch the document.

<Card title="Run in Postman" icon="https://mintcdn.com/sandboxfinancialtechnologiesprivatelimited/gviqebbpT5NUt_6i/static/svg/Postman.svg?fit=max&auto=format&n=gviqebbpT5NUt_6i&q=85&s=da47f2b7e10d87befec951aed9468de3" horizontal href="https://www.postman.com/in-co-sandbox/sandbox-api/request/bhuf4n1/fetch-document" arrow="true" width="2030" height="2031" data-path="static/svg/Postman.svg" />

<Info>
  A document can only be fetched if the user has provided consent for it.
</Info>

<Card title="Sample Responses" icon="file-code" href="/api-reference/kyc/digilocker/sample-responses">
  See sample XML responses returned by DigiLocker for Aadhaar, PAN and Driving License.
</Card>


## OpenAPI

````yaml api-reference/kyc/openapi.json GET /kyc/digilocker/sessions/{session_id}/documents/{doc_type}
openapi: 3.1.0
info:
  title: in-co-sandbox-kyc
  description: ''
  version: 1.0.0
servers:
  - url: https://test-api.sandbox.co.in
    description: test
  - url: https://api.sandbox.co.in
    description: prod
security: []
tags:
  - name: kyc
  - name: digilocker-sdk
  - name: digilocker
  - name: aadhaar
  - name: bank
  - name: pan
  - name: mca
  - name: entitylocker
  - name: entitylocker-sdk
paths:
  /kyc/digilocker/sessions/{session_id}/documents/{doc_type}:
    get:
      tags:
        - kyc
        - digilocker
      summary: Fetch document
      operationId: getDocument
      parameters:
        - name: session_id
          in: path
          description: >-
            Session identifier generated during DigiLocker [Initiate Session
            API](https://developer.sandbox.co.in/api-reference/kyc/digilocker/endpoints/initiate_session)
            .
          required: true
          example: 4b4bf7aa-f4da-47a8-9b32-895edfc03630
          schema:
            type: string
        - name: doc_type
          in: path
          description: >-
            Document type identifying which DigiLocker document to retrieve.
            Must match one of the consented doc_types values.
          required: true
          example: aadhaar
          schema:
            type: string
            enum:
              - aadhaar
              - pan
              - driving_license
        - name: Authorization
          in: header
          description: >-
            JWT access token. For token-generation steps, refer to the
            [Quickstart
            Guide](https://developer.sandbox.co.in/guides/get-started/quickstart).
          required: true
          example: '{{access_token}}'
          schema:
            type: string
        - name: x-api-key
          in: header
          description: API key used to identify and authenticate the client.
          required: true
          example: '{{api_key}}'
          schema:
            type: string
        - name: x-api-version
          in: header
          description: Specifies the API version for the request.
          required: false
          example: 1.0.0
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  timestamp:
                    type: integer
                  data:
                    type: object
                    properties:
                      files:
                        type: array
                        items:
                          type: object
                          properties:
                            '@entity':
                              type: string
                              const: org.quicko.drive.file
                            url:
                              type: string
                            size:
                              type: integer
                            metadata:
                              type: object
                              properties:
                                ContentType:
                                  type: string
                                issuer_id:
                                  type: string
                                issuer:
                                  type: string
                                LastModified:
                                  type: string
                                description:
                                  type: string
                              required:
                                - ContentType
                                - issuer_id
                                - issuer
                                - LastModified
                                - description
                    required:
                      - files
                  transaction_id:
                    type: string
                required:
                  - code
                  - timestamp
                  - data
                  - transaction_id
              examples:
                200 - OK:
                  summary: 200 - OK
                  value:
                    code: 200
                    timestamp: 1751975529441
                    data:
                      files:
                        - '@entity': org.quicko.drive.file
                          url: >-
                            https://in-co-sandbox-kyc-digilocker-dev.s3.ap-south-1.amazonaws.com/non-persistent/e385432b-575c-4b6f-8928-79136dbc0d4f/4b4bf7aa-f4da-47a8-9b32-895edfc03630/in.gov.uidai-ADHAR-0d5fe4d692c73e23c59a694eaaabc75a.xml?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=%2F20250708%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20250708T115214Z&X-Amz-Expires=3600&X-Amz-Signature=8cc4b0e8eb3794601c7fdb7e85f3a6bb3a8e1842403c8aeae5c05b7af03bdadb&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject
                          size: 16598
                          metadata:
                            ContentType: application/xml
                            issuer_id: in.gov.uidai
                            issuer: Unique Identification Authority of India (UIDAI)
                            LastModified: 09/05/2025
                            description: Aadhaar Card
                    transaction_id: a4d43b74-0f9c-480c-9300-f011100b674b
          headers: {}
        '503':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              examples:
                503 - Source unavailable:
                  summary: 503 - Source unavailable
                  value:
                    code: 503
                    timestamp: 1000000000000
                    transaction_id: 6c05f692-c32f-4de0-92b4-56684bdf16f0
                    message: Source Unavailable
          headers: {}
        '521':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  timestamp:
                    type: integer
                  message:
                    type: string
                  transaction_id:
                    type: string
                required:
                  - code
                  - timestamp
                  - message
                  - transaction_id
              examples:
                521 - Data Not Found:
                  summary: 521 - Data Not Found
                  value:
                    code: 521
                    timestamp: 1782806266274
                    message: 'Data not found for: 55470e27-3d8a-451f-ac1e-9c0f3d1454821'
                    transaction_id: a599615c-c732-4538-9840-4bb5cd3c19d2
          headers: {}
        '523':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  timestamp:
                    type: integer
                  message:
                    type: string
                  transaction_id:
                    type: string
                required:
                  - code
                  - timestamp
                  - message
                  - transaction_id
              examples:
                523 - Invalid Session Status:
                  summary: 523 - Invalid Session Status
                  value:
                    code: 523
                    timestamp: 1782806184804
                    message: 'Invalid session status: created'
                    transaction_id: de90173f-8255-4ac0-b26b-a41b8a872fee
          headers: {}
      deprecated: false
      security: []

````