Supercharge media upload and management

Integrated media library that can be used programmatically or from the browser to store and manage all your files in a central repository

Code snippets

Powerful APIs to do it all

File upload, organization, and search made simple with client-side and server-side SDKs for different languages and frameworks

cURL
React
Angular
Vue.js
Android (kotlin)
Android (java)
Javascript
Python
Node.js
Ruby and ROR
Java
PHP
.NET
curl -X POST "https://upload.imagekit.io/api/v1/files/upload"\
-u your_private_api_key:\
-F 'file=@/Users/username/Desktop/my_file_name.jpg;type=image/jpg'\
-F 'fileName=my_file_name.jpg'
// In order to use the SDK, you need to provide it with a few configuration parameters. 
// The configuration parameters can be applied directly to the IKImage component or using 
// an IKContext component.
  
<IKContext
	publicKey="your_public_key"
	urlEndpoint="your_url_endpoint"
	transformationPosition="path"
	authenticationEndpoint="http://www.yourserver.com/auth"
>

// Image upload
<IKUpload fileName="my-upload" />
</IKContext>
// In order to use the SDK, you need to provide it with a few configuration parameters. 
// The configuration parameters must be passed to the ImagekitioAngularModule module 
// in your app.module.ts file.
  
@NgModule({
	declarations: [
		AppComponent
	],
	imports: [
		BrowserModule,
		AppRoutingModule,
		ImagekitioAngularModule.forRoot({
			publicKey: "your_public_key", // or environment.publicKey
			urlEndpoint: "your_url_endpoint", // or environment.urlEndpoint
			authenticationEndpoint: "http://www.yourserver.com/auth" // or environment.authenticationEndpoint
		})
	],
	providers: [],
	bootstrap: [AppComponent]
})

// Simple upload
<ik-upload fileName="my-upload" /></ik-upload>

// Upload using callbacks and other parameters of upload API
<ik-upload fileName="test_new" [useUniqueFileName]="false" [isPrivateFile]="true"
	(onSuccess)="handleUploadSuccess($event)" (onError)="handleUploadError($event)"></ik-upload>
// In order to use the SDK, you need to provide it with a few configuration parameters. 
// The configuration parameters can be applied directly to the IKImage component or using an IKContext component.

<IKContext
	publicKey="your_public_key"
	urlEndpoint="your_url_endpoint"
	transformationPosition="path"
	authenticationEndpoint="http://www.yourserver.com/auth"
>

// Image upload
<IKUpload fileName="my-upload" />
</IKContext>
import com.imagekit.android.ImageKit;
  
ImageKit.init(
	context = applicationContext,
	publicKey = "your_public_key",
	urlEndpoint = "your_url_endpoint",
	transformationPosition = TransformationPosition.PATH,
	authenticationEndpoint = "http://www.yourserver.com/auth"
)

// File upload
ImageKit.getInstance().uploader().uploadImage(
	file = bitmap!!
	, fileName = filename
	, useUniqueFilename = false
	, tags = arrayOf("nice", "copy", "books")
	, folder = "/dummy/folder/"
	, imageKitCallback = this
)
import com.imagekit.android.ImageKit;
  
ImageKit.Companion.init(
	getApplicationContext(),
	"your_public_key",
	"your_url_endpoint",
	TransformationPosition.PATH,
	"http://www.yourserver.com/auth"
);

// File upload
ImageKit.Companion.getInstance().uploader().uploadImage(
	bitmap,
	filename,
	false, // useUniqueFilename
	new String[]{"nice", "copy", "books"}, // tags, 
	"/dummy/folder/", 
	imageKitCallback
)
// SDK initialization
  
var imagekit = new ImageKit({
	publicKey : "your_public_key",
	urlEndpoint : "your_url_endpoint",
	authenticationEndpoint : "http://www.yourserver.com/auth",
});

// Upload function internally uses the ImageKit.io javascript SDK
function upload(data) {
	var file = document.getElementById("file1");
	imagekit.upload({
		file : file.files[0],
		fileName : "abc1.jpg",
		tags : ["tag1"]
	}, function(err, result) {
		console.log(arguments);
		console.log(imagekit.url({
			src: result.url,
			transformation : [{ height: 300, width: 400}]
		}));
	})
}
# SDK initialization

from imagekitio import ImageKit
imagekit = ImageKit(
	private_key='your_private_key',
	public_key='your_public_key',
	url_endpoint='your_url_endpoint'
)

imagekit.upload_file(
    file= "<url|base_64|binary>", # required
    file_name= "my_file_name.jpg", # required
    options= {
        "folder" : "/example-folder/",
        "tags": ["sample-tag"],
        "is_private_file": False,
        "use_unique_file_name": True,
        "response_fields": ["is_private_file", "tags"],
    }
)

// SDK initialization
  
var ImageKit = require("imagekit");

var imagekit = new ImageKit({
	publicKey : "your_public_key",
	privateKey : "your_private_key",
	urlEndpoint : "your_url_endpoint"
});

// Using Callback Function

imagekit.upload({
    file : <url|base_64|binary>, //required
    fileName : "my_file_name.jpg",   //required
}, function(error, result) {
    if(error) console.log(error);
    else console.log(result);
});

// Using Promises 

imagekit.upload({
    file : <url|base_64|binary>, //required
    fileName : "my_file_name.jpg",   //required
}).then(response => {
    console.log(response);
}).catch(error => {
    console.log(error);
});

# Add this code to config/initializers/imagekitio.rb

ImageKitIo.configure do |config|
  if Rails.env.development?
    config.public_key = 'your_public_key'
    config.private_key = 'your_private_key'
    config.url_endpoint = 'your_url_endpoint' # https://ik.imagekit.io/your_imagekit_id
  end
  config.service = :carrierwave # replace with ':active_storage' if using ActiveStorage for uploads
  # config.constants.MISSING_PRIVATE_KEY = 'custom error message'
end
#make sure to replace the your_public_key, your_private_key and your_url_endpoint with actual values


# following sections only apply if you're  using the ActiveStorage functionality

# run the following commands on terminal in your project directory
rails active_storage:install
rails db:migrate

# add the following to config/storage.yml
imagekitio:
    service: ImageKitIo

# add the following to config/environments/development.rb
config.active_storage.service = :imagekitio


imagekitio.upload_file(
    file = "<url|base_64|binary>", # required
    file_name= "my_file_name.jpg",  # required
    options= {response_fields: 'isPrivateFile, tags', tags: %w[abc def], use_unique_file_name: true,}
)

/*
	Create a config.properties file inside src/main/resources of your project. 
	And put essential values of keys (UrlEndpoint, PrivateKey, PublicKey), no need to use quote
	in values. Then you need to initialize ImageKit with that configuration.

	UrlEndpoint=your_url_endpoint
	PrivateKey=your_private_key
	PublicKey=your_public_key
*/
  
import io.imagekit.sdk.ImageKit;
import io.imagekit.sdk.config.Configuration;
import io.imagekit.sdk.utils.Utils;

class App {
	public static void main(String[] args) {
		ImageKit imageKit=ImageKit.getInstance();
		Configuration config=Utils.getSystemConfig(App.class);
		imageKit.setConfig(config);
	}
}

String filePath = "your-local-file-path";
String base64 = Utils.fileToBase64(new File(filePath));
FileCreateRequest fileCreateRequest = new FileCreateRequest(base64, "file_name.jpg");
String customCoordinates = "10,10,20,20";
fileCreateRequest.setCustomCoordinates(customCoordinates);  // optional
List<String> tags = new ArrayList<>();
tags.add("Sample-tag");
tags.add("T-shirt");
fileCreateRequest.setTags(tags); // optional
fileCreateRequest.setFileName("override_file_name.jpg");  // optional
fileCreateRequest.setFolder("sample-folder/nested-folder");  // optional
fileCreateRequest.setPrivateFile(false);  // optional
fileCreateRequest.setUseUniqueFileName(true);  // optional
List<String> responseFields=new ArrayList<>();
responseFields.add("tags");
responseFields.add("customCoordinates");
fileCreateRequest.setResponseFields(responseFields); // optional
Result result = ImageKit.getInstance().upload(fileCreateRequest);
System.out.println("======FINAL RESULT=======");
System.out.println(result);
System.out.println("Raw Response:");
System.out.println(result.getRaw());
System.out.println("Map Response:");
System.out.println(result.getMap());

// SDK initialization
  
use ImageKit\ImageKit;

$imageKit = new ImageKit(
	"your_public_key",
	"your_private_key",
	"your_url_endpoint"
);

$imageKit->uploadFiles(array(
    "file" => "your_file", // required
    "fileName" => "your_file_name.jpg", // required
    "useUniqueFileName" => false, // optional
    "tags" => array("tag1","tag2"), // optional
    "folder" => "images/folder/", // optional
    "isPrivateFile" => false, // optional
    "customCoordinates" => "10,10,100,100", // optional
    "responseFields" => "tags,customCoordinates" // optional
));

// SDK initialization
  
using Imagekit;
  
Imagekit.Imagekit imagekit = new Imagekit.Imagekit("your_public_key", "your_private_key", "your_url_endpoint", "path");
ImagekitResponse resp = await imagekit
    .FileName("my_file_name.jpg")
    .UploadAsync(<fullPath|url|base_64|binary>);

Complete media management from the browser

Get a simple drag-and-drop interface to upload and an intuitive UI to manage all your digital assets inside ImageKit's media library.

Collaborate with your team

Use virtual collections to collate files for sharing effortlessly. Share collections and files with granular control that balances collaboration and security.

Collaborate with your team

Ready-to-use upload widget

Integrate ImageKit's upload widget on your website to enable uploads directly from the user's device, Google Drive, Dropbox, and Facebook.

AI to ease media organization and editing workflows

Integrated industry-leading cloud vision and background removal services that use AI to make searching assets and editing them simpler.

URLs ready for use on the web

Get a URL for every file that you upload. Use it directly on your website, app, and other platforms without worrying about media optimization and load time.