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

# Decrypt data



## OpenAPI

````yaml /openapi/openapi.yaml post /v2/decrypt
openapi: 3.0.3
info:
  title: Qanapi
  version: 3.0.0
  description: Secure API with enforced API Key headers. Supports V2 and V3 endpoints.
servers:
  - url: https://{subdomain}.qanapi.cloud/api
    description: The Qanapi API server
    variables:
      subdomain:
        default: ''
        description: Customer-specific subdomain.
security:
  - ApiKeyAuth: []
paths:
  /v2/decrypt:
    post:
      tags:
        - Encryption
      summary: Decrypt data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V2DecryptRequest'
            examples:
              decryptExample:
                summary: Decrypt password field
                value:
                  data:
                    password: enc$::abc123::...
                  sensitiveFields:
                    - password
      responses:
        '200':
          description: Decrypted result
          content:
            application/json:
              schema:
                $ref: a7a9b5f0-b3c3-47e4-833e-def1dfa3f274
              example:
                data:
                  password: secret
        '400':
          description: Unable to process encrypted data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                cannotDecrypt:
                  summary: You are not authorized to decrypt this content
                  value:
                    message: You are not authorized to decrypt this content
                forbidden:
                  $ref: '#/components/examples/forbidden'
        '404':
          description: Encryption metadata not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Decryption failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    V2DecryptRequest:
      type: object
      required:
        - data
      properties:
        data:
          description: |
            The encrypted payload to decrypt.
            - Can be a string or an object/array with encrypted fields.
            - Decryption is selective if `sensitiveFields` is provided.
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
            - type: array
              items:
                x-stainless-any: true
        sensitiveFields:
          type: array
          items:
            type: string
          description: >
            Laravel-style dot-notated paths to fields to decrypt.


            - Same syntax and behavior as in V2EncryptRequest.

            - If omitted, all string values matching encryption prefix are
            attempted.


            Examples:
              - `user.ssn`
              - `employees.*.payroll.token`
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          example: An error occurred.
  responses:
    UnauthorizedError:
      description: Unauthorized - Invalid API Key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              $ref: '#/components/examples/unauthorized'
  examples:
    forbidden:
      value:
        message: This action is unauthorized.
    unauthorized:
      value:
        message: Unauthenticated.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-qanapi-authorization
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````