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

# Get encrypted file details

> Retrieve detailed information about a specific encrypted file by ID, optionally with a signed download URL



## OpenAPI

````yaml get /files/encrypted/{id}
openapi: 3.1.0
info:
  title: Prem API
  description: Full description of private and dev-availble API endpoints
  version: 1.0.0
  termsOfService: https://prem.io/terms
  contact:
    name: API Support
    url: https://help.prem.io
    email: support@premai.io
servers:
  - url: https://gateway.prem.io
    description: Production API server
security: []
paths:
  /files/encrypted/{id}:
    get:
      tags:
        - Files Encrypted
        - dev-api
      summary: Get encrypted file details
      description: >-
        Retrieve detailed information about a specific encrypted file by ID,
        optionally with a signed download URL
      operationId: getFileEncrypted
      parameters:
        - name: id
          in: path
          required: true
          description: Encrypted file ID
          schema:
            type: string
        - name: url
          in: query
          required: false
          description: Include signed download URL in response
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
            default: 'false'
      responses:
        '200':
          $ref: '#/components/responses/viewFileEncryptedResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
      security:
        - BearerAuth: []
          ApiKeyAuth: []
components:
  responses:
    '400':
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                enum:
                  - 400
                  - 401
                  - 403
                  - 404
                description: Status code of the response
              data:
                type:
                  - object
                  - 'null'
                description: Response data containing the requested object
              error:
                type:
                  - string
                  - 'null'
                examples:
                  - Some error message
                description: Error message of the response, human readable
              message:
                type: 'null'
              env:
                type: string
                enum:
                  - development
                  - production
                description: API environment
              log:
                type:
                  - string
                  - object
                  - 'null'
                examples:
                  - request_id: req_1234567890
                  - Some pertinent log message
                description: Useful informaiton, not always present, to debug the response
              validator:
                type:
                  - object
                  - array
                  - 'null'
                examples:
                  - email: Invalid email address
                    password: Password is required
                description: >-
                  Validator response object, each key is the field name and
                  value is the error message
              support_id:
                type:
                  - string
                  - 'null'
                format: uuid
                examples:
                  - support_uuidv7-something-else
                description: >-
                  Support ID linked to the response, used to identify it when
                  talking with our team
            required:
              - status
              - error
              - message
              - env
              - log
              - support_id
            additionalProperties: false
    '401':
      description: Access token is missing or invalid
      content:
        application/json:
          schema:
            allOf:
              - type: object
                properties:
                  status:
                    type: integer
                    enum:
                      - 400
                      - 401
                      - 403
                      - 404
                    description: Status code of the response
                  data:
                    type:
                      - object
                      - 'null'
                    description: Response data containing the requested object
                  error:
                    type:
                      - string
                      - 'null'
                    examples:
                      - Some error message
                    description: Error message of the response, human readable
                  message:
                    type: 'null'
                  env:
                    type: string
                    enum:
                      - development
                      - production
                    description: API environment
                  log:
                    type:
                      - string
                      - object
                      - 'null'
                    examples:
                      - request_id: req_1234567890
                      - Some pertinent log message
                    description: >-
                      Useful informaiton, not always present, to debug the
                      response
                  validator:
                    type:
                      - object
                      - array
                      - 'null'
                    examples:
                      - email: Invalid email address
                        password: Password is required
                    description: >-
                      Validator response object, each key is the field name and
                      value is the error message
                  support_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    examples:
                      - support_uuidv7-something-else
                    description: >-
                      Support ID linked to the response, used to identify it
                      when talking with our team
                required:
                  - status
                  - error
                  - message
                  - env
                  - log
                  - support_id
                additionalProperties: false
              - properties:
                  status:
                    type: integer
                    enum:
                      - 401
    '403':
      description: You do not have the required permissions to access this resource
      content:
        application/json:
          schema:
            allOf:
              - type: object
                properties:
                  status:
                    type: integer
                    enum:
                      - 400
                      - 401
                      - 403
                      - 404
                    description: Status code of the response
                  data:
                    type:
                      - object
                      - 'null'
                    description: Response data containing the requested object
                  error:
                    type:
                      - string
                      - 'null'
                    examples:
                      - Some error message
                    description: Error message of the response, human readable
                  message:
                    type: 'null'
                  env:
                    type: string
                    enum:
                      - development
                      - production
                    description: API environment
                  log:
                    type:
                      - string
                      - object
                      - 'null'
                    examples:
                      - request_id: req_1234567890
                      - Some pertinent log message
                    description: >-
                      Useful informaiton, not always present, to debug the
                      response
                  validator:
                    type:
                      - object
                      - array
                      - 'null'
                    examples:
                      - email: Invalid email address
                        password: Password is required
                    description: >-
                      Validator response object, each key is the field name and
                      value is the error message
                  support_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    examples:
                      - support_uuidv7-something-else
                    description: >-
                      Support ID linked to the response, used to identify it
                      when talking with our team
                required:
                  - status
                  - error
                  - message
                  - env
                  - log
                  - support_id
                additionalProperties: false
              - properties:
                  status:
                    type: integer
                    enum:
                      - 403
    '404':
      description: Resource not found
      content:
        application/json:
          schema:
            allOf:
              - type: object
                properties:
                  status:
                    type: integer
                    enum:
                      - 400
                      - 401
                      - 403
                      - 404
                    description: Status code of the response
                  data:
                    type:
                      - object
                      - 'null'
                    description: Response data containing the requested object
                  error:
                    type:
                      - string
                      - 'null'
                    examples:
                      - Some error message
                    description: Error message of the response, human readable
                  message:
                    type: 'null'
                  env:
                    type: string
                    enum:
                      - development
                      - production
                    description: API environment
                  log:
                    type:
                      - string
                      - object
                      - 'null'
                    examples:
                      - request_id: req_1234567890
                      - Some pertinent log message
                    description: >-
                      Useful informaiton, not always present, to debug the
                      response
                  validator:
                    type:
                      - object
                      - array
                      - 'null'
                    examples:
                      - email: Invalid email address
                        password: Password is required
                    description: >-
                      Validator response object, each key is the field name and
                      value is the error message
                  support_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    examples:
                      - support_uuidv7-something-else
                    description: >-
                      Support ID linked to the response, used to identify it
                      when talking with our team
                required:
                  - status
                  - error
                  - message
                  - env
                  - log
                  - support_id
                additionalProperties: false
              - properties:
                  status:
                    type: integer
                    enum:
                      - 404
    viewFileEncryptedResponse:
      description: Encrypted file retrieved successfully
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Response200'
              - $ref: '#/components/schemas/viewFileEncryptedResponse'
  schemas:
    Response200:
      type: object
      properties:
        status:
          type: integer
          enum:
            - 200
            - 201
            - 202
          description: Status code of the response
        data:
          type:
            - object
            - array
            - 'null'
          description: Response data containing the requested object
        error:
          type:
            - string
            - 'null'
          examples:
            - Invalid email address
          description: Error message of the response, human readable
        message:
          type:
            - string
            - 'null'
          examples:
            - Resource created successfully
          description: Message of the response, human readable
        env:
          type: string
          enum:
            - development
            - production
          description: API environment
        log:
          type:
            - string
            - object
            - 'null'
          examples:
            - request_id: req_1234567890
            - Some pertinent log message
          description: Useful informaiton, not always present, to debug the response
        validator:
          type:
            - object
            - array
            - 'null'
          examples:
            - email: Invalid email address
              password: Password is required
          description: >-
            Validator response object, each key is the field name and value is
            the error message
        support_id:
          type:
            - string
            - 'null'
          format: uuid
          examples:
            - support_uuidv7-something-else
          description: >-
            Support ID linked to the response, used to identify it when talking
            with our team
      required:
        - status
        - data
        - message
        - env
      examples:
        - status: 200
          data:
            id: '123'
          error: null
          log: null
          validator: null
          support_id: null
          message: Resource created successfully
          env: development
    viewFileEncryptedResponse:
      type: object
      description: Response containing encrypted file details
      properties:
        data:
          $ref: '#/components/schemas/fileEncrypted'
      required:
        - data
      examples:
        - data:
            id: file_0198042e-6dde-7b9c-bc91-452a7e0c833b
            user_id: user_0196b0e9-11d8-7f26-b1d2-bd47054e4827
            organization_id: org_0196b0e9-11d8-7f26-b1d2-bd47054e4827
            hash: 04b9e2ec43133ae7287f97764c0beda19f304374e1d6bfe4fcc36ad54502e5dc
            version: '1'
            kid: key_01234567-89ab-cdef-0123-456789abcdef
            wrapped_dek: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
            original_name: document.pdf
            file_name: 0198042e-6dde-76e0-b817-3afb324e29ac.pdf.enc
            file_path: >-
              encrypted/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/user_0196b0e9-11d8-7f26-b1d2-bd47054e4827/0198042e-6dde-76e0-b817-3afb324e29ac.pdf.enc
            mime_type: application/pdf
            file_size: 1060793
            type: document
            created_at: '2025-07-13 16:26:48.415'
            updated_at: null
            url: >-
              https://encrypted.prem.io/encrypted/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/user_0196b0e9-11d8-7f26-b1d2-bd47054e4827/0198042e-6dde-76e0-b817-3afb324e29ac.pdf.enc
    fileEncrypted:
      type: object
      description: Encrypted file object containing file identifier and encrypted metadata
      properties:
        id:
          type: string
          description: Unique identifier for the encrypted file
          examples:
            - file_0196b6e6-54e3-796d-9c6a-2862a5fef597
        user_id:
          type:
            - string
            - 'null'
          description: User identifier that owns the file
          examples:
            - user_0196b0e9-11d8-7f26-b1d2-bd47054e4827
        organization_id:
          type:
            - string
            - 'null'
          description: Organization identifier that owns the file
          examples:
            - org_0196b0e9-11d8-7f26-b1d2-bd47054e4827
        api_key_id:
          type:
            - string
            - 'null'
          description: API Key identifier that owns the file
          examples:
            - api_key_019ae099-2a6f-755d-b356-6847c657fd63
        hash:
          type:
            - string
            - 'null'
          description: File hash for duplicate detection
          examples:
            - 04b9e2ec43133ae7287f97764c0beda19f304374e1d6bfe4fcc36ad54502e5dc
        version:
          type: string
          description: Encryption version
          examples:
            - '1'
        kid:
          type: string
          description: Key identifier used for encryption
          examples:
            - key_01234567-89ab-cdef-0123-456789abcdef
        wrapped_dek:
          type: string
          description: Wrapped data encryption key
          examples:
            - 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
        original_name:
          type: string
          description: Original filename (encrypted - only decryptable in enclave)
          examples:
            - encrypted_filename_data
        mime_type:
          type: string
          description: MIME type (encrypted - only decryptable in enclave)
          examples:
            - encrypted_mime_type_data
        file_name:
          type: string
          description: Generated filename for storage
          examples:
            - 0198042e-6dde-76e0-b817-3afb324e29ac.enc
        file_path:
          type:
            - string
            - 'null'
          description: Full path to the encrypted file in storage
          examples:
            - >-
              encrypted/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/user_0196b0e9-11d8-7f26-b1d2-bd47054e4827/0198042e-6dde-76e0-b817-3afb324e29ac.enc
        file_size:
          type: integer
          description: File size in bytes
          examples:
            - 1060793
        chat_id:
          type:
            - string
            - 'null'
          description: ID of the chat this file belongs to
          examples:
            - chat_0197c0f1-9589-7990-b421-4b806f637b0c
        message_id:
          type:
            - string
            - 'null'
          description: ID of the message this file belongs to
          examples:
            - message_0197c0f1-9589-7990-b421-4b806f637b0c
        type:
          type: string
          description: Type of the file - always 'encrypted' for fully encrypted files
          examples:
            - encrypted
        created_at:
          type: string
          format: mysql-date-time
          description: Timestamp when the file was created
          examples:
            - '2025-07-13 16:26:48.415'
        rag_status:
          type:
            - string
            - 'null'
          enum:
            - running
            - stopped
            - failure
            - success
            - pending
            - null
          description: Status of the RAG processing
          examples:
            - pending
            - completed
            - failed
            - null
        updated_at:
          type:
            - string
            - 'null'
          format: mysql-date-time
          description: Timestamp when the file was last updated
          examples:
            - null
        url:
          type:
            - string
            - 'null'
          format: uri
          description: >-
            Signed URL for accessing the encrypted file resource (only included
            when url=true query parameter is set)
          examples:
            - >-
              https://encrypted.prem.io/encrypted/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/user_0196b0e9-11d8-7f26-b1d2-bd47054e4827/0198042e-6dde-76e0-b817-3afb324e29ac.pdf.enc
        is_duplicate:
          type: boolean
          description: >-
            Indicates if the file is a duplicate (only included in upload
            response)
          examples:
            - false
      additionalProperties: false
      examples:
        - id: file_0198042e-6dde-7b9c-bc91-452a7e0c833b
          user_id: user_0196b0e9-11d8-7f26-b1d2-bd47054e4827
          organization_id: org_0196b0e9-11d8-7f26-b1d2-bd47054e4827
          api_key_id: api_key_019ae099-2a6f-755d-b356-6847c657fd63
          hash: 04b9e2ec43133ae7287f97764c0beda19f304374e1d6bfe4fcc36ad54502e5dc
          version: '1'
          kid: key_01234567-89ab-cdef-0123-456789abcdef
          wrapped_dek: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
          original_name: encrypted_filename_data
          mime_type: encrypted_mime_type_data
          file_name: 0198042e-6dde-76e0-b817-3afb324e29ac.enc
          file_path: >-
            encrypted/org_0196b0e9-11d8-7f26-b1d2-bd47054e4827/user_0196b0e9-11d8-7f26-b1d2-bd47054e4827/0198042e-6dde-76e0-b817-3afb324e29ac.enc
          file_size: 1060793
          type: encrypted
          rag_status: pending
          created_at: '2025-07-13 16:26:48.415'
          updated_at: null
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Send your access token as header Authorization: Bearer {accessToken}'
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your API key that starts with sk_live or sk_test. You can create yours
        at go.prem.io/api-keys.

````