> ## 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.

# Initiate a consent session

> Initiate a consent session and return the DigiLocker URL to redirect the user to.



## OpenAPI

````yaml /suite/api-reference/openapi.json post /digilocker-simple/v1/sessions
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:
    post:
      tags:
        - DigiLocker Simple
      summary: Initiate a consent session
      description: >-
        Initiate a consent session and return the DigiLocker URL to redirect the
        user to.
      operationId: initiate_digilocker_session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
        default:
          description: The request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreateSessionRequest:
      properties:
        flow:
          $ref: '#/components/schemas/Flow'
          description: >-
            Whether the user signs in to an existing DigiLocker account or
            creates one
        redirect_url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Redirect Url
          description: >-
            HTTPS URL the user is redirected to after granting or denying
            consent. Must be publicly reachable
        doc_types:
          items:
            $ref: '#/components/schemas/DocType'
          type: array
          minItems: 1
          title: Doc Types
          description: Document types consent is being requested for
        options:
          anyOf:
            - $ref: '#/components/schemas/SessionOptions'
            - type: 'null'
        consent_expiry:
          anyOf:
            - type: integer
            - type: 'null'
          title: Consent Expiry
          description: >-
            Unix millisecond timestamp after which the consent request expires,
            at least an hour ahead
      type: object
      required:
        - flow
        - redirect_url
        - doc_types
      title: CreateSessionRequest
      description: Request to initiate a consent session.
    SessionResponse:
      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/Session'
      type: object
      required:
        - code
        - timestamp
        - transaction_id
        - data
      title: SessionResponse
      description: Response to initiating a session.
    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.
    Flow:
      type: string
      enum:
        - signin
        - signup
      title: Flow
      description: Authentication flow to initiate on DigiLocker.
    DocType:
      type: string
      enum:
        - aadhaar
        - pan
        - driving_license
      title: DocType
      description: A document type that can be requested from DigiLocker.
    SessionOptions:
      properties:
        verification_method:
          anyOf:
            - items:
                $ref: '#/components/schemas/VerificationMethod'
              type: array
              minItems: 1
            - type: 'null'
          title: Verification Method
          description: Verification methods allowed during DigiLocker sign-up
        pinless:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pinless
          description: >-
            Allow sign-in by OTP without a DigiLocker PIN. Applies to the signin
            flow only
        usernameless:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Usernameless
          description: >-
            Allow skipping username creation during sign-up. Applies to the
            signup flow only
        verified_mobile:
          anyOf:
            - type: string
              pattern: ^[6-9][0-9]{9}$
            - type: 'null'
          title: Verified Mobile
          description: >-
            Mobile number your system has already verified, to skip DigiLocker's
            own mobile OTP at sign-up
      additionalProperties: false
      type: object
      title: SessionOptions
      description: >-
        Configuration controlling the DigiLocker authentication and sign-up
        experience.
    Session:
      properties:
        authorization_url:
          type: string
          title: Authorization Url
          description: Single-use URL to redirect the user to so they can grant consent
        session_id:
          type: string
          title: Session Id
          description: >-
            Identifier for this session. Use it to read status, profile and
            documents
      type: object
      required:
        - authorization_url
        - session_id
      title: Session
      description: An initiated consent session and the URL to send the user to.
    VerificationMethod:
      type: string
      enum:
        - aadhaar
        - pan
        - driving_license
        - email
        - username
        - mobile
        - other
      title: VerificationMethod
      description: Verification methods allowed during DigiLocker sign-up.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````