Class FileUploadParams.Body

    • Constructor Detail

    • Method Detail

      • file

         final InputStream file()

        The API accepts any of the following:

        • Binary data – send the raw bytes as multipart/form-data.

        • HTTP / HTTPS URL – a publicly reachable URL that ImageKit’s servers can fetch.

        • Base64 string – the file encoded as a Base64 data URI or plain Base64.

        When supplying a URL, the server must receive the response headers within 8 seconds; otherwise the request fails with 400 Bad Request.

      • fileName

         final String fileName()

        The name with which the file has to be uploaded.

      • token

         final Optional<String> token()

        This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses it to authenticate and check that the upload request parameters have not been tampered with after the token has been generated. Learn how to create the token on the page below. This field is only required for authentication when uploading a file from the client side.

        Note: Sending a JWT that has been used in the past will result in a validation error. Even if your previous request resulted in an error, you should always send a new token.

        ⚠️Warning: JWT must be generated on the server-side because it is generated using your account's private API key. This field is required for authentication when uploading a file from the client-side.

      • checks

         final Optional<String> checks()

        Server-side checks to run on the asset. Read more about /docs/api-reference/upload-file/upload-file-v2#upload-api-checks.

      • customCoordinates

         final Optional<String> customCoordinates()

        Define an important area in the image. This is only relevant for image type files.

        • To be passed as a string with the x and y coordinates of the top-left corner, and width and height of the area of interest in the format x,y,width,height. For example - 10,10,100,100

        • Can be used with fo-customtransformation.

        • If this field is not specified and the file is overwritten, then customCoordinates will be removed.

      • extensions

         final Optional<List<ExtensionItem>> extensions()

        Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type.

      • folder

         final Optional<String> folder()

        The folder path in which the image has to be uploaded. If the folder(s) didn't exist before, a new folder(s) is created. Using multiple / creates a nested folder.

      • isPrivateFile

         final Optional<Boolean> isPrivateFile()

        Whether to mark the file as private or not.

        If true, the file is marked as private and is accessible only using named transformation or signed URL.

      • isPublished

         final Optional<Boolean> isPublished()

        Whether to upload file as published or not.

        If false, the file is marked as unpublished, which restricts access to the file only via the media library. Files in draft or unpublished state can only be publicly accessed after being published.

        The option to upload in draft state is only available in custom enterprise pricing plans.

      • overwriteAiTags

         final Optional<Boolean> overwriteAiTags()

        If set to true and a file already exists at the exact location, its AITags will be removed. Set overwriteAITags to false to preserve AITags.

      • overwriteCustomMetadata

         final Optional<Boolean> overwriteCustomMetadata()

        If the request does not have customMetadata, and a file already exists at the exact location, existing customMetadata will be removed.

      • overwriteFile

         final Optional<Boolean> overwriteFile()

        If false and useUniqueFileName is also false, and a file already exists at the exact location, upload API will return an error immediately.

      • overwriteTags

         final Optional<Boolean> overwriteTags()

        If the request does not have tags, and a file already exists at the exact location, existing tags will be removed.

      • tags

         final Optional<List<String>> tags()

        Set the tags while uploading the file. Provide an array of tag strings (e.g. ["tag1", "tag2", "tag3"]). The combined length of all tag characters must not exceed 500, and the % character is not allowed. If this field is not specified and the file is overwritten, the existing tags will be removed.

      • transformation

         final Optional<FileUploadParams.UploadTransformation> transformation()

        Configure pre-processing (pre) and post-processing (post) transformations.

        • pre — applied before the file is uploaded to the Media Library. Useful for reducing file size or applying basic optimizations upfront (e.g., resize, compress).

        • post — applied immediately after upload. Ideal for generating transformed versions (like video encodes or thumbnails) in advance, so they're ready for delivery without delay.

        You can mix and match any combination of post-processing types.

      • useUniqueFileName

         final Optional<Boolean> useUniqueFileName()

        Whether to use a unique filename for this file or not.

        If true, ImageKit.io will add a unique suffix to the filename parameter to get a unique filename.

        If false, then the image is uploaded with the provided filename parameter, and any existing file with the same name is replaced.

      • webhookUrl

         final Optional<String> webhookUrl()

        The final status of extensions after they have completed execution will be delivered to this endpoint as a POST request. /docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure about the webhook payload structure.

      • validate

         final FileUploadParams.Body validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.