### Clone Sample Android Project Source: https://imagekit.io/docs/integration/android Clone the ImageKit Android quickstart sample project from GitHub to get started. ```bash git clone https://github.com/imagekit-samples/quickstart.git ``` -------------------------------- ### Clone ImageKit iOS Quickstart Repository Source: https://imagekit.io/docs/integration/ios Clone the sample iOS application repository from GitHub to get started with ImageKit integration. ```bash git clone https://github.com/imagekit-samples/quickstart.git ``` -------------------------------- ### Create Folder using Ruby Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/create-folder This Ruby example shows how to create a folder using the 'imagekitio' gem. Ensure you have the gem installed and provide your private API key. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.folders.create( folder_name: 'new_folder', parent_folder_path: 'source/folder/path' ) puts result ``` -------------------------------- ### Install Video Player SDK Source: https://imagekit.io/docs/integration/astro Install the ImageKit Video Player SDK using npm. ```bash npm install @imagekit/video-player ``` -------------------------------- ### Get Bulk Job Status using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/bulk-job-status This Go example shows how to fetch a bulk job's status. It requires initializing the ImageKit client with your private key and handling potential errors. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Folders.Job.Get(context.TODO(), "job_id") if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get URL Endpoint using Go Source: https://imagekit.io/docs/api-reference/account-management-api/url-endpoints/get-url-endpoint This Go example shows how to retrieve a URL endpoint. It initializes the ImageKit client with a private key and uses `client.Accounts.URLEndpoints.Get` to fetch the endpoint details. ```go package main import ( "context" "fmt" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) func main() { client := imagekit.NewClient( option.WithPrivateKey("your_private_api_key"), ) result, err := client.Accounts.URLEndpoints.Get(context.TODO(), "url_endpoint_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", result) // Access URL endpoint details fmt.Printf("Endpoint ID: %s\n", result.ID) fmt.Printf("Description: %s\n", result.Description) fmt.Printf("URL Prefix: %s\n", result.URLPrefix) } ``` -------------------------------- ### Get File Version Details using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-version-details Retrieve file version details in Go. This example initializes the ImageKit client with a private key and makes the API call, handling potential errors. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Versions.Get(context.TODO(), "version_id", imagekit.FileVersionGetParams{ FileID: "file_id", }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Version Details using Ruby Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-version-details This Ruby example shows how to fetch file version details using the ImageKit SDK. Initialize the client with your private key and call the appropriate method. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.files.versions.get( 'version_id', file_id: 'file_id' ) puts result ``` -------------------------------- ### List File Versions using Ruby Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/list-file-versions This Ruby example shows how to get file versions using the 'imagekitio' gem. Initialize the client with your private key and call the list method with the file ID. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.files.versions.list('file_id') puts result ``` -------------------------------- ### Create Folder using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/create-folder This Go example demonstrates creating a folder using the ImageKit Go SDK. It requires your private key for authentication. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Folders.New(context.TODO(), imagekit.FolderNewParams{ FolderName: "new_folder", ParentFolderPath: "source/folder/path", }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Basic Welcome Controller Setup Source: https://imagekit.io/docs/integration/ruby/ruby-on-rails-with-carrierwave Define a simple index action in your WelcomeController. This is a standard Rails controller setup. ```ruby class WelcomeController < ApplicationController def index end end ``` -------------------------------- ### Get File Metadata using Ruby Source: https://imagekit.io/docs/api-reference/file-metadata/get-uploaded-file-metadata Fetch file metadata in Ruby by initializing the Imagekitio client with your private key and calling the get method. This example assumes the 'imagekitio' gem is installed. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.files.metadata.get('file_id') puts result ``` -------------------------------- ### List File Versions using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/list-file-versions This Go example demonstrates fetching file versions using the ImageKit Go SDK. It requires initializing the client with your private key and handling potential errors. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Versions.List(context.TODO(), "file_id") if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Metadata using Node.js Source: https://imagekit.io/docs/api-reference/file-metadata/get-metadata-from-url This Node.js example shows how to initialize the ImageKit client and retrieve file metadata from a URL. Ensure you have the '@imagekit/nodejs' package installed. ```javascript import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: "your_private_api_key" }); try { const result = await client.files.metadata.getFromURL({ url: "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg" }); console.log(result); } catch (error) { console.log(error); } ``` -------------------------------- ### List Files in a Folder (Go) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Go example demonstrates how to list files in a folder using the ImageKit Go SDK. It requires initializing the client with your private key and setting the path parameter. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ Path: imagekit.String("products"), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Metadata using Ruby Source: https://imagekit.io/docs/api-reference/file-metadata/get-metadata-from-url This Ruby example demonstrates how to fetch file metadata from a URL using the ImageKit Ruby gem. Ensure the 'imagekitio' gem is installed. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.files.metadata.get_from_url( url: "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg" ) puts result ``` -------------------------------- ### Install npm packages for backend server Source: https://imagekit.io/docs/integration/ios Installs the necessary Node.js packages for the sample backend authentication server. Run this command in the 'Server' directory of the tutorial project. ```bash cd Server/ npm install ``` -------------------------------- ### Check Purge Cache Status with Node.js Source: https://imagekit.io/docs/api-reference/caching/purge-status This Node.js example shows how to get the status of a cache invalidation request. Ensure you have the '@imagekit/nodejs' package installed and replace 'request_id' with the relevant ID. ```javascript import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: "your_private_api_key" }); try { const result = await client.cache.invalidation.get("request_id"); console.log(result); } catch (error) { console.log(error); } ``` -------------------------------- ### Get Account Usage with Ruby Source: https://imagekit.io/docs/api-reference/account-management-api/get-usage Fetch account usage data using the ImageKit Ruby gem. Initialize the client with your private API key. This example retrieves usage for the last 30 days by calculating the start and end dates. ```ruby require "imagekitio" client = Imagekitio::Client.new( private_key: "your_private_api_key" ) # Get usage for the last 30 days end_date = Time.now start_date = end_date - (30 * 24 * 60 * 60) # 30 days ago result = client.accounts.usage.get( start_date: start_date, end_date: end_date ) puts result puts "Bandwidth: #{result.bandwidth_bytes} bytes" puts "Storage: #{result.media_library_storage_bytes} bytes" ``` -------------------------------- ### Create Folder using .Net Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/create-folder This .NET example shows how to create a folder using the ImageKit client. It requires your private key for authentication. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var response = await client.Folders.Create(new() { FolderName = "new_folder", ParentFolderPath = "/", }); Console.WriteLine(response); ``` -------------------------------- ### Trim Video from 5 Seconds Source: https://imagekit.io/docs/trim-videos Use the `so` parameter to specify the start offset in seconds. This example trims the video to start from the 5th second. ```url https://ik.imagekit.io/demo/img/60cd.mp4?tr=so-5 ``` -------------------------------- ### Install Active Storage Source: https://imagekit.io/docs/integration/ruby/ruby-on-rails Install Active Storage and migrate the database to create necessary tables. Skip if already configured. ```bash rails active_storage:install rails db:migrate ``` -------------------------------- ### Move File using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/move-file This Go example demonstrates moving a file with the ImageKit SDK. It initializes the client with a private key and uses context for the move operation. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Move(context.TODO(), imagekit.FileMoveParams{ SourceFilePath: "/path/to/file.jpg", DestinationPath: "/folder/to/move/into/", }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get URL Endpoint using .Net Source: https://imagekit.io/docs/api-reference/account-management-api/url-endpoints/get-url-endpoint This .Net example shows how to retrieve a URL endpoint using the ImageKit client. Initialize the client with your private key and use the `Get` method. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var endpoint = await client.Accounts.UrlEndpoints.Get("url_endpoint_id"); Console.WriteLine(endpoint); ``` -------------------------------- ### Get URL Endpoint using Python Source: https://imagekit.io/docs/api-reference/account-management-api/url-endpoints/get-url-endpoint This Python example shows how to retrieve a URL endpoint. It uses environment variables for the private key and calls the `get` method on the `url_endpoints` client. ```python import os from imagekitio import ImageKit client = ImageKit( private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY") ) result = client.accounts.url_endpoints.get("url_endpoint_id") print(result) ``` -------------------------------- ### Search all files with tags using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Go example shows how to search for assets with tags using the `imagekit-go` SDK. It initializes the client with your private key and uses a context for the request. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ SearchQuery: imagekit.String(`tags EXISTS`), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Metadata using .NET Source: https://imagekit.io/docs/api-reference/file-metadata/get-uploaded-file-metadata Fetch file metadata in .NET by initializing the ImageKitClient with your private key and calling the Get method on the Files.Metadata object. This example uses asynchronous programming. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var metadata = await client.Files.Metadata.Get("file_id"); Console.WriteLine(metadata); ``` -------------------------------- ### Get Bulk Job Status using Java Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/bulk-job-status This Java example shows how to get the status of a bulk job. It uses the ImageKit client, configured with your private key, to make the API call. ```java import io.imagekit.client.ImageKitClient; import io.imagekit.client.okhttp.ImageKitOkHttpClient; import io.imagekit.models.folders.job.JobGetResponse; ImageKitClient client = ImageKitOkHttpClient.builder() .privateKey("your_private_key") .build(); JobGetResponse response = client.folders().job().get("job_id"); System.out.println(response); ``` -------------------------------- ### Search PNG Files using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Go example shows how to list PNG files using the ImageKit SDK. It requires your private key for authentication and uses context for the API call. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ SearchQuery: imagekit.String(`format="png"`), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Metadata using Node.js Source: https://imagekit.io/docs/api-reference/file-metadata/get-uploaded-file-metadata Fetch file metadata in Node.js by initializing the ImageKit client with your private key and calling the get method on the files metadata object. Ensure the '@imagekit/nodejs' package is installed. ```javascript import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: "your_private_api_key" }); try { const result = await client.files.metadata.get("file_id"); console.log(result); } catch (error) { console.log(error); } ``` -------------------------------- ### List files by name using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Go example shows how to list assets by filename using the ImageKit Go SDK. It requires your private key and uses context for the request. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ SearchQuery: imagekit.String(`name="file-name.jpg"`), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Version Details using .NET Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-version-details This .NET example demonstrates fetching file version details. It initializes the ImageKit client with a private key and uses an asynchronous call to get the version information. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var version = await client.Files.Versions.Get( "version_id", new() { FileID = "file_id" } ); Console.WriteLine(version); ``` -------------------------------- ### List Assets with Full-Text Search (Go) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Go example shows how to list assets using the ImageKit Go SDK, applying a full-text search query 'name HAS "red"'. The client is initialized with your private key, and the search query is passed in the AssetListParams. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ SearchQuery: imagekit.String(`name HAS "red"`), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Details using .Net SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit .Net SDK. ```APIDOC ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var file = await client.Files.Get("file_id"); Console.WriteLine(file); ``` ``` -------------------------------- ### Install Backend Packages Source: https://imagekit.io/docs/llms-full.txt Install necessary npm packages for creating a Node.js backend server for ImageKit authentication. ```bash npm install express uuid cors ``` -------------------------------- ### Get File Details using Go SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit Go SDK. ```APIDOC ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Get(context.TODO(), "file_id") if err != nil { panic(err.Error()) } ``` ``` -------------------------------- ### List Assets with Search Query (Go) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets Use the `SearchQuery` parameter to filter assets. This example demonstrates listing files uploaded in the last 7 days with a file size greater than 2MB. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ SearchQuery: imagekit.String(`createdAt >= "7d" AND size > "2mb"`), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Details using Ruby SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit Ruby SDK. ```APIDOC ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: 'your_private_api_key' ) result = client.files.get('file_id') puts result ``` ``` -------------------------------- ### Fetch 10 Files Uploaded in Media Library (Go) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets Fetches the first 10 files uploaded in the media library using the Go SDK. Use `option.WithPrivateKey` to configure the client. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{ Skip: imagekit.Int(0), Limit: imagekit.Int(10), }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Get File Details using Java SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit Java SDK. ```APIDOC ```java import io.imagekit.client.ImageKitClient; import io.imagekit.client.okhttp.ImageKitOkHttpClient; import io.imagekit.models.files.File; ImageKitClient client = ImageKitOkHttpClient.builder() .privateKey("your_private_key") .build(); File file = client.files().get("file_id"); System.out.println(file); ``` ``` -------------------------------- ### Basic JavaScript Video Player Setup Source: https://imagekit.io/docs/video-player/overview Set up a basic video player in JavaScript. Ensure the video element exists in your HTML and import the necessary modules. ```html ``` ```javascript import { videoPlayer } from '@imagekit/video-player'; import '@imagekit/video-player/styles.css'; const player = videoPlayer('my-video', { imagekitId: 'YOUR_IMAGEKIT_ID' }); player.src({ src: 'https://ik.imagekit.io//video.mp4' }); ``` -------------------------------- ### Get File Details using PHP SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit PHP SDK. ```APIDOC ```php use ImageKit\ImageKit; $public_key = "your_public_api_key"; $your_private_key = "your_private_api_key"; $url_end_point = "https://ik.imagekit.io/your_imagekit_id"; $imageKit = new ImageKit( $public_key, $your_private_key, $url_end_point ); $getFileDetails = $imageKit->getDetails("file_id"); echo("File details : " . json_encode($getFileDetails)); ``` ``` -------------------------------- ### Get File Details using Python SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit Python SDK. ```APIDOC ```python import os from imagekitio import ImageKit client = ImageKit( private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY") ) response = client.files.get("file_id") print(response) print(response.file_id) ``` ``` -------------------------------- ### List Files in a Folder (Java) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This Java example demonstrates listing files in a folder using the ImageKit Java SDK. It requires initializing the client with your private key and specifying the path. ```java import io.imagekit.client.ImageKitClient; import io.imagekit.client.okhttp.ImageKitOkHttpClient; import io.imagekit.models.assets.AssetListParams; import io.imagekit.models.assets.AssetListResponse; import java.util.List; ImageKitClient client = ImageKitOkHttpClient.builder() .privateKey("your_private_key") .build(); List assets = client.assets().list( AssetListParams.builder() .path("products") .build() ); ``` -------------------------------- ### Get File Details using Node.js SDK Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/get-file-details Example of how to retrieve file details using the ImageKit Node.js SDK. ```APIDOC ```javascript import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: "your_private_key" }); try { const result = await client.files.get("file_id"); console.log(result); } catch (error) { console.log(error); } ``` ``` -------------------------------- ### List Assets with Full-Text Search (.Net) Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/list-and-search-assets This .Net example demonstrates how to list assets using the ImageKit client, applying a full-text search query. The 'SearchQuery' is set to 'name HAS "red"', and the client is configured with your private key. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var assets = await client.Assets.List(new() { SearchQuery = @"name HAS ""red""", }); foreach (var asset in assets) { Console.WriteLine(asset); } ``` -------------------------------- ### Get Thumbnail from Specific Time Point Source: https://imagekit.io/docs/create-video-thumbnails Use the 'so' parameter to specify the start offset in seconds from which to extract the thumbnail from the video. ```markup https://ik.imagekit.io/demo/img/60cd.mp4/ik-thumbnail.jpg?tr=so-5 ``` -------------------------------- ### Create New React Native Project Source: https://imagekit.io/docs/integration/react-native Use the react-native-cli to initialize a new React Native project. Ensure you have the necessary development environment set up. ```bash npx react-native@latest init imagekitReactNative ``` -------------------------------- ### Get Account Usage Source: https://imagekit.io/docs/api-reference/account-management-api/get-usage This endpoint retrieves the usage data for your ImageKit account. You can specify a start and end date to filter the results. ```APIDOC ## GET /v1/accounts/usage ### Description Retrieves the usage data for your ImageKit account within a specified date range. ### Method GET ### Endpoint /v1/accounts/usage ### Query Parameters - **startDate** (string) - Required - The start date for the usage data (YYYY-MM-DD). - **endDate** (string) - Required - The end date for the usage data (YYYY-MM-DD). ### Response #### Success Response (200) - **bandwidth_bytes** (integer) - The total bandwidth consumed in bytes. - **media_library_storage_bytes** (integer) - The total storage used by the media library in bytes. ### Request Example ```bash curl -X GET "https://api.imagekit.io/v1/accounts/usage?startDate=2023-04-01&endDate=2023-04-30" \ -H 'Content-Type: application/json' \ -u your_private_key: ``` ### Response Example ```json { "bandwidth_bytes": 1073741824, "media_library_storage_bytes": 536870912 } ``` ``` -------------------------------- ### Generate Authentication Parameters (.Net) Source: https://imagekit.io/docs/integration/react This .Net example demonstrates how to set up a server endpoint to generate authentication parameters required for secure file uploads using the ImageKit SDK. ```csharp using Imagekit; var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); ImageKitClient client = new() { PrivateKey = Environment.GetEnvironmentVariable("IMAGEKIT_PRIVATE_KEY") }; app.Use(async (context, next) => { context.Response.Headers["Access-Control-Allow-Origin"] = "*"; context.Response.Headers["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type, Accept"; await next(); }); app.MapGet("/auth", () => { // Your application logic to authenticate the user var authParams = client.Helper.GetAuthenticationParameters(); return new { token = authParams.Token, expire = authParams.Expire, signature = authParams.Signature, publicKey = Environment.GetEnvironmentVariable("IMAGEKIT_PUBLIC_KEY"), }; }); Console.WriteLine("Live at Port 3000"); app.Run("http://localhost:3000"); ``` -------------------------------- ### Control Timing of Solid Color Block Overlay (Seconds) Source: https://imagekit.io/docs/add-overlays-on-videos Specify the start and end times for the solid color block overlay in seconds using `lso` (start offset) and `leo` (end offset). This example shows the overlay from 3 to 8 seconds. ```markup https://ik.imagekit.io/demo/sample-video.mp4?tr=l-image,lso-3,leo-8,i-ik_canvas,bg-red,lfo-left,w-500,l-end ``` -------------------------------- ### Move Folder using .Net Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-folders/move-folder This .Net example demonstrates moving a folder using the ImageKit client. It shows how to set the private key and specify the source and destination paths. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var response = await client.Folders.Move(new() { SourceFolderPath = "/path/to/source/", DestinationPath = "/path/to/destination/", }); Console.WriteLine(response); // Print the jobId Console.WriteLine(response.JobId); ``` -------------------------------- ### Get File Metadata using .NET Source: https://imagekit.io/docs/api-reference/file-metadata/get-metadata-from-url This C# example demonstrates retrieving file metadata from a URL using the ImageKit .NET SDK. It initializes the client with a private key. ```csharp using Imagekit; ImageKitClient client = new() { PrivateKey = "your_private_key" }; var metadata = await client.Files.Metadata.GetFromUrl( new() { UrlValue = "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg" } ); Console.WriteLine(metadata); ``` -------------------------------- ### Configure Shoppable Videos Source: https://imagekit.io/docs/video-player/overview Set up shoppable video functionality by providing the `shoppable` options object. Refer to the shoppable options documentation for detailed configuration. ```javascript object ``` -------------------------------- ### Initialize ImageKit Client and Upload File (Plain Ruby) Source: https://imagekit.io/docs/integration/ruby Initialize the ImageKit client with your private key and upload a file using the Ruby SDK. Ensure your private key is set as an environment variable. ```ruby require 'imagekitio' client = Imagekitio::Client.new( private_key: ENV['IMAGEKIT_PRIVATE_KEY'] ) # Upload a file response = client.files.upload( file: Pathname('/path/to/image.jpg'), file_name: 'image.jpg' ) ``` -------------------------------- ### VS Code Copilot: Manual MCP Server Setup Source: https://imagekit.io/docs/llms-full.txt Manually add the ImageKit devtools and API MCP servers to VS Code. This is an alternative to the guided plugin flow. ```bash code --add-mcp "{\"name\":\"imagekit_devtools\",\"type\":\"http\",\"url\":\"https://devtools-mcp.imagekit.io/mcp\"}" code --add-mcp "{\"name\":\"imagekit_api\",\"type\":\"http\",\"url\":\"https://api-mcp.imagekit.io/mcp\"}" ``` -------------------------------- ### Restore File Version using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/restore-file-version This Go example uses the ImageKit Go SDK to restore a file version. Initialize the client with your private key using `option.WithPrivateKey`. The `Restore` method requires a context, the `version_id`, and `FileVersionRestoreParams` containing the `FileID`. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Versions.Restore(context.TODO(), "version_id", imagekit.FileVersionRestoreParams{ FileID: "file_id", }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Trim Layer Video using Expression Source: https://imagekit.io/docs/trim-videos Apply trimming transformations within a video layer using expressions. This example trims the layer video to start at 80% of its original duration. ```url https://ik.imagekit.io/demo/img/sample-video.mp4?tr=l-video,i-img@@60cd.mp4,w-600,so-idu_mul_0.8,l-end ``` -------------------------------- ### App Navigation Setup Source: https://imagekit.io/docs/integration/react-native Configures the stack navigator for the application, setting 'Main' as the home screen. ```javascript import React from 'react'; import {createStackNavigator} from '@react-navigation/stack'; import Main from './screens/Main'; const Stack = createStackNavigator(); function AppComponent() { return ( ); } export default AppComponent; ``` -------------------------------- ### Get File Metadata using Java Source: https://imagekit.io/docs/api-reference/file-metadata/get-metadata-from-url This Java example utilizes the ImageKit Java SDK to obtain file metadata from a given URL. It requires setting up the client with your private key. ```java import io.imagekit.client.ImageKitClient; import io.imagekit.client.okhttp.ImageKitOkHttpClient; import io.imagekit.models.files.Metadata; import io.imagekit.models.files.metadata.MetadataGetFromUrlParams; ImageKitClient client = ImageKitOkHttpClient.builder() .privateKey("your_private_key") .build(); MetadataGetFromUrlParams params = MetadataGetFromUrlParams.builder() .url("https://ik.imagekit.io/demo/tr:w-100/default-image.jpg") .build(); Metadata metadata = client.files().metadata().getFromUrl(params); System.out.println(metadata); ``` -------------------------------- ### Get Saved Extension using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/saved-extensions/get-extension This Go example demonstrates fetching a saved extension. It involves initializing the ImageKit client with a private key and using the SavedExtensions.Get method with a context. ```go package main import ( "context" "fmt" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) func main() { client := imagekit.NewClient( option.WithPrivateKey("your_private_api_key"), ) savedExtension, err := client.SavedExtensions.Get(context.TODO(), "ext_abc123") if err != nil { panic(err.Error()) } fmt.Println(savedExtension) } ``` -------------------------------- ### Add Tags in Bulk using Go Source: https://imagekit.io/docs/api-reference/digital-asset-management-dam/managing-assets/add-tags-bulk This Go example demonstrates adding tags to multiple files using the ImageKit Go SDK. It initializes the client with your private key and uses `imagekit.FileBulkAddTagsParams` to define the operation. ```go import ( "context" "github.com/imagekit-developer/imagekit-go/v2" "github.com/imagekit-developer/imagekit-go/v2/option" ) client := imagekit.NewClient( option.WithPrivateKey("your_private_key"), ) response, err := client.Files.Bulk.AddTags(context.TODO(), imagekit.FileBulkAddTagsParams{ FileIDs: []string{"file_id_1", "file_id_2"}, Tags: []string{"tag1", "tag2"}, }) if err != nil { panic(err.Error()) } ``` -------------------------------- ### Initialize ImageKit SDK in iOS Source: https://imagekit.io/docs/integration/ios Initializes the ImageKit SDK with your public key, URL endpoint, and transformation position. Replace placeholders with your actual credentials. ```bash ImageKit.init( publicKey: "your_public_api_key", urlEndpoint: "your_url_endpoint", transformationPosition: TransformationPosition.PATH ) ```