Files

Upload a file

Errors

Returns an error if file upload, database operations, or file system operations fail.

post/api/files/actions/upload

Response

File with same content already exists, returning existing file

messagestring required

Upload confirmation message

Example response

{
  "file": {
    "createdAt": "2023-01-01T00:00:00Z",
    "fileHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "fileSize": 1048576,
    "filename": "document.pdf",
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "metadata": {
      "description": "Important document"
    },
    "mimeType": "application/pdf",
    "originalFilename": "My Important Document.pdf",
    "status": "uploaded",
    "updatedAt": "2023-01-01T00:00:00Z",
    "userId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
  },
  "message": "File uploaded successfully"
}

Changes

Changed in 5 of the 28 revisions of this API.6211

    • added the success response with the status 200

      response-success-status-added

    • the endpoint scheme security bearerAuth AND cookieAuth was added to the API

      api-security-added

    • the endpoint scheme security cookieAuth was removed from the API

      api-security-removed

  • 861532a21ad9527See the full diff
    • removed the required property file/file_hash from the response with the 201 status

      response-required-property-removed

    • removed the required property file/file_size from the response with the 201 status

      response-required-property-removed

    • removed the required property file/mime_type from the response with the 201 status

      response-required-property-removed

    • removed the required property file/original_filename from the response with the 201 status

      response-required-property-removed

    • removed the required property file/user_id from the response with the 201 status

      response-required-property-removed

    • removed the optional property file/created_at from the response with the 201 status

      response-optional-property-removed

    • removed the optional property file/updated_at from the response with the 201 status

      response-optional-property-removed

    • added the optional property file/createdAt to the response with the 201 status

      response-optional-property-added

    • added the optional property file/updatedAt to the response with the 201 status

      response-optional-property-added

    • added the required property file/fileHash to the response with the 201 status

      response-required-property-added

    • added the required property file/fileSize to the response with the 201 status

      response-required-property-added

    • added the required property file/mimeType to the response with the 201 status

      response-required-property-added

    • added the required property file/originalFilename to the response with the 201 status

      response-required-property-added

    • added the required property file/userId to the response with the 201 status

      response-required-property-added

    • endpoint added

      endpoint-added

    • api path removed without deprecation

      api-path-removed-without-deprecation

    This revision also has 29 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog