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

# Upload Private File

> API endpoint for uploading private files. Uploaded files are kept private so that only users with access to the specified environment can retrieve them. The endpoint validates the survey ID, file name, and file type from the request body, and returns a signed URL for S3 uploads along with a local upload URL.



## OpenAPI

````yaml /api-v2-reference/openapi.yml post /client/{environmentId}/storage
openapi: 3.1.0
info:
  title: Formbricks API
  description: Manage Formbricks resources programmatically.
  version: 2.0.0
servers:
  - url: https://app.formbricks.com/api/v2
    description: Formbricks Cloud
security:
  - apiKeyAuth: []
tags:
  - name: Health
    description: Operations for checking critical application dependencies health status.
  - name: Roles
    description: Operations for managing roles.
  - name: Me
    description: Operations for managing your API key.
  - name: Management API - Responses
    description: Operations for managing responses.
  - name: Management API - Contacts
    description: Operations for managing contacts.
  - name: Management API - Contact Attributes
    description: Operations for managing contact attributes.
  - name: Management API - Contact Attribute Keys
    description: Operations for managing contact attribute keys.
  - name: Management API - Surveys
    description: Operations for managing surveys.
  - name: Management API - Surveys - Contact Links
    description: Operations for generating personalized survey links for contacts.
  - name: Management API - Webhooks
    description: Operations for managing webhooks.
  - name: Organizations API - Teams
    description: Operations for managing teams.
  - name: Organizations API - Project Teams
    description: Operations for managing project teams.
  - name: Organizations API - Users
    description: Operations for managing users.
paths:
  /client/{environmentId}/storage:
    post:
      tags:
        - Client API - File Upload
      summary: Upload Private File
      description: >-
        API endpoint for uploading private files. Uploaded files are kept
        private so that only users with access to the specified environment can
        retrieve them. The endpoint validates the survey ID, file name, and file
        type from the request body, and returns a signed URL for S3 uploads
        along with a local upload URL.
      parameters:
        - in: path
          name: environmentId
          required: true
          schema:
            type: string
          description: The ID of the environment.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                surveyId:
                  type: string
                  description: The ID of the survey associated with the file.
                fileName:
                  type: string
                  description: The name of the file to be uploaded.
                fileType:
                  type: string
                  description: The MIME type of the file.
              required:
                - surveyId
                - fileName
                - fileType
              example:
                surveyId: cm7pr0x2y004o192zmit8cjvb
                fileName: example.jpg
                fileType: image/jpeg
      responses:
        '200':
          description: >-
            OK - Returns the signed URL, presigned fields, updated file name,
            and file URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      signedUrl:
                        type: string
                        description: >-
                          Presigned POST URL for uploading the file to
                          S3-compatible storage.
                      presignedFields:
                        type: object
                        additionalProperties:
                          type: string
                        description: >-
                          Presigned POST form fields required by S3-compatible
                          storage.
                      updatedFileName:
                        type: string
                        description: The updated file name after processing.
                      fileUrl:
                        type: string
                        description: URL where the uploaded file can be accessed.
                example:
                  data:
                    signedUrl: https://s3.example.com/bucket
                    presignedFields:
                      key: uploads/env-id/private/file--fid--uuid.jpg
                      policy: <base64-policy>
                      x-amz-algorithm: AWS4-HMAC-SHA256
                    updatedFileName: file--fid--b153ba3e-6602-4bb3-bed9-211b5b1ae463.jpg
                    fileUrl: >-
                      https://app.formbricks.com/storage/cm1ubebtj000614kqe4hs3c67/private/file--fid--b153ba3e-6602-4bb3-bed9-211b5b1ae463.jpg
        '400':
          description: Bad Request - One or more required fields are missing.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Detailed error message.
                example:
                  error: fileName is required
        '404':
          description: Not Found - The specified survey or organization does not exist.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Detailed error message.
                example:
                  error: Survey survey123 not found
      security: []
      servers:
        - url: https://app.formbricks.com/api/v2
          description: Formbricks API Server
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Use your Formbricks x-api-key to authenticate.

````