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

# Store a file for a user

> Stores an encrypted file for a user. The file content is supplied as a base64-encoded `filedata` field. Each file is encrypted with a per-file key (wrapped by the user's record key) and stored in the configured object-storage backend (local disk, Amazon S3, Google Cloud Storage, or Azure Blob Storage).

If the same content is uploaded again for the same user, the response sets `duplicate` to `true` and no new object is written.




## OpenAPI

````yaml /pro/api/openapi.yml post /v2/FileCreate
openapi: 3.0.3
info:
  title: Databunker Pro API
  description: >
    Databunker Pro is a privacy-compliant user data vault and tokenization
    engine that provides secure storage and management of user data with
    built-in privacy controls, consent management, and audit capabilities.


    ## Key Features

    - **User Tokenization**: Create, update, and manage user profiles with
    privacy controls

    - **Consent Management**: Handle legal basis and user agreements for
    GDPR/DPDP compliance

    - **Token Management**: Secure tokenization of sensitive data like credit
    cards

    - **Audit Trail**: Complete audit logging of all data access and
    modifications

    - **Multi-tenant**: Support for multiple tenants with isolated data

    - **Role-based Access**: Fine-grained access control with policies and roles

    - **Bulk Operations**: Efficient bulk data operations with unlock mechanisms


    ## Authentication

    All API calls require authentication via the `X-Bunker-Token` header. For
    multi-tenant setups, use the `X-Bunker-Tenant` header to specify the tenant
    context.


    ### Multi-Tenant Usage

    Multi-tenancy is supported when DataBunker Pro is configured to work with
    PostgreSQL database. **Note:** DataBunker Pro supports both PostgreSQL and
    MySQL (Percona) as backend databases, but multi-tenancy requires PostgreSQL
    and is not available with MySQL.


    When using DataBunker Pro in a multi-tenant environment:


    - **Single Tenant**: Omit the `X-Bunker-Tenant` header (default behavior)

    - **Multi-Tenant**: Include `X-Bunker-Tenant: your-tenant-name` header


    **Example:**

    ```bash

    # Single tenant

    curl -X POST http://localhost:3000/v2/UserCreate \
      -H "X-Bunker-Token: your-token" \
      -d '{"profile":{"login":"user1"}}'

    # Multi-tenant

    curl -X POST http://localhost:3000/v2/UserCreate \
      -H "X-Bunker-Token: your-token" \
      -H "X-Bunker-Tenant: acme-corp" \
      -d '{"profile":{"login":"user1"}}'
    ```


    ## Base URL

    The API is available at `/v2/` endpoint with all requests using POST method.
  version: 2.0.0
  contact:
    name: Databunker Support
    url: https://databunker.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:3000
    description: Local development server
security:
  - XBunkerToken: []
tags:
  - name: User Tokenization
    description: Operations for creating, reading, updating, and deleting users
  - name: App Data Management
    description: Operations for managing application-specific user data
  - name: File Storage
    description: Operations for storing, retrieving, and deleting encrypted user files
  - name: Legal Basis Management
    description: Operations for managing legal basis for data processing
  - name: Agreement Management
    description: Operations for managing user agreements and consent
  - name: Processing Activity Management
    description: Operations for managing data processing activities
  - name: Format Preserving Tokenization
    description: Operations for tokenizing sensitive data
  - name: Group Management
    description: Operations for managing user groups
  - name: Role Management
    description: Operations for managing user roles
  - name: Policy Management
    description: Operations for managing access control policies
  - name: Authentication
    description: Operations for creating access tokens
  - name: Bulk Operations
    description: Operations for bulk data processing
  - name: Audit Management
    description: Operations for accessing audit logs
  - name: Tenant Management
    description: Operations for managing multi-tenant setups
  - name: Shared Records
    description: Operations for creating and accessing shared user records
  - name: Session Management
    description: Operations for managing user sessions
  - name: System Operations
    description: Operations for system administration and monitoring
paths:
  /v2/FileCreate:
    post:
      tags:
        - File Storage
      summary: Store a file for a user
      description: >
        Stores an encrypted file for a user. The file content is supplied as a
        base64-encoded `filedata` field. Each file is encrypted with a per-file
        key (wrapped by the user's record key) and stored in the configured
        object-storage backend (local disk, Amazon S3, Google Cloud Storage, or
        Azure Blob Storage).


        If the same content is uploaded again for the same user, the response
        sets `duplicate` to `true` and no new object is written.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - mode
                - identity
                - filename
                - filedata
              properties:
                mode:
                  type: string
                  enum:
                    - login
                    - token
                    - email
                    - phone
                    - custom
                  description: Mode of user identification
                identity:
                  type: string
                  description: User identifier corresponding to the mode
                filename:
                  type: string
                  description: Name of the file (1-255 characters)
                filedata:
                  type: string
                  format: byte
                  description: Base64-encoded file content
                mimetype:
                  type: string
                  description: >-
                    MIME type of the file. If omitted, it is auto-detected from
                    the content.
                slidingtime:
                  type: string
                  description: Sliding retention period for the file (e.g., '30d', '1y')
                finaltime:
                  type: string
                  description: >-
                    Absolute expiration time for the file (e.g., '90d',
                    '2026-01-01')
                request_metadata:
                  type: object
                  description: Additional metadata for the request
      responses:
        '200':
          description: File stored successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  token:
                    type: string
                    description: User's unique token
                  fileuuid:
                    type: string
                    description: Unique identifier of the stored file
                  duplicate:
                    type: boolean
                    description: True if the file content already existed for this user
components:
  securitySchemes:
    XBunkerToken:
      type: apiKey
      in: header
      name: X-Bunker-Token
      description: API token for authentication

````