> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/imagekit.md).

# ImageKit

Connect to ImageKit to upload files to your media library, browse and search folders and files, update file metadata, and purge cached CDN URLs.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication  |
| --------- | --------------- |
| ImageKit  | Private API Key |

#### ImageKit

Connect to ImageKit to upload, browse, and manage files in your media library and purge cached CDN URLs.

**Set up in ImageKit**

1. Prepare the ImageKit account or service that the workflow will access. Grant access to the required resources and operations.
2. **Private API Key:** Your ImageKit private API key, starting with "private\_". Find it in the ImageKit dashboard under Developer options > API keys. A Restricted key needs Media management Read and write access for uploads, updates, deletes, and cache purges.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **ImageKit**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field   | Required | What to enter                                                                                                                                                                                                                                                                                                             |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Private API Key | Yes      | Your ImageKit private API key, starting with "private\_". Find it in the ImageKit dashboard under Developer options > API keys. A Restricted key needs Media management Read and write access for uploads, updates, deletes, and cache purges. [Provider instructions](https://imagekit.io/dashboard/developer/api-keys). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **ImageKit** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Upload File

Upload an image, video, or other file to your ImageKit media library from a public URL.

**Inputs**

| Field                   | Type            | Required | Description                                                                                                                                                                                                |
| ----------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| File URL                | string          | Yes      | Public link to the file you want to upload. ImageKit downloads it from this address.                                                                                                                       |
| File Name               | string          | Yes      | Name to save the file under, including its extension.                                                                                                                                                      |
| Folder                  | select (string) | No       | Folder to upload into. Missing folders are created automatically. Options load from the selected connection. Default: /.                                                                                   |
| Tags                    | string          | No       | Comma-separated tags to help you find the file later.                                                                                                                                                      |
| Overwrite Existing File | boolean         | No       | Replace a file with the same name in the same folder instead of saving a copy with a unique suffix. AI tags and custom metadata are kept; tags are replaced by the new tags, or removed if none are given. |
| Private File            | boolean         | No       | Only allow access through signed URLs or named transformations.                                                                                                                                            |
| Description             | textarea        | No       | Short text describing what the file contains.                                                                                                                                                              |

**Outputs**

| Field         | Type    | Description                 |
| ------------- | ------- | --------------------------- |
| File ID       | string  | ID of the uploaded file.    |
| Name          | string  | Saved file name.            |
| File Path     | string  | Path in the media library.  |
| URL           | string  | CDN link to the file.       |
| Thumbnail URL | string  | Thumbnail link, for images. |
| File Type     | string  | image or non-image.         |
| Size (bytes)  | integer | File size.                  |

#### List Files

Browse or search files and folders in your ImageKit media library.

**Inputs**

| Field        | Type            | Required | Description                                                                                                                                                      |
| ------------ | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Folder       | select (string) | No       | Only show items directly inside this folder. Options load from the selected connection.                                                                          |
| Search Query | string          | No       | Filter with ImageKit search syntax, such as recent uploads or files with a tag.                                                                                  |
| Item Type    | select (string) | No       | Whether to list files, folders, or both. Available values: Files, Folders, Files and folders. Default: file.                                                     |
| File Type    | select (string) | No       | Limit to images or non-image files. Available values: All, Images only, Non-images only. Default: all.                                                           |
| Sort By      | select (string) | No       | Order of the results. Available values: Newest first, Oldest first, Name A-Z, Name Z-A, Recently updated, Largest first, Smallest first. Default: DESC\_CREATED. |
| Max Results  | integer         | No       | Maximum number of items to return. Minimum: 1. Maximum: 100. Default: 25.                                                                                        |
| Start From   | integer         | No       | Skip this many items, to continue from a previous page. Minimum: 0.                                                                                              |

**Outputs**

| Field       | Type          | Description                         |
| ----------- | ------------- | ----------------------------------- |
| Items       | object\_array | Files and folders found.            |
| Count       | integer       | Number of items returned.           |
| Next Offset | integer       | Where to continue for more results. |

#### Get File Details

Get the details of one file, such as its link, size, dimensions, and tags.

**Inputs**

| Field | Type            | Required | Description                                                     |
| ----- | --------------- | -------- | --------------------------------------------------------------- |
| File  | select (string) | Yes      | The file to look up. Options load from the selected connection. |

**Outputs**

| Field | Type   | Description   |
| ----- | ------ | ------------- |
| File  | object | File details. |

#### Update File Details

Change a file's tags, description, or focus area.

**Inputs**

| Field             | Type            | Required | Description                                                                                                                              |
| ----------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| File              | select (string) | Yes      | The file to update. Options load from the selected connection.                                                                           |
| Tags              | string          | No       | Comma-separated tags. These replace the file's current tags. Leave empty to keep the current tags, or use Remove All Tags to clear them. |
| Remove All Tags   | boolean         | No       | Remove every tag from the file instead of changing them.                                                                                 |
| Description       | textarea        | No       | Text describing what the file contains. Leave empty to keep the current description, or use Clear Description to remove it.              |
| Clear Description | boolean         | No       | Remove the file's description instead of changing it.                                                                                    |
| Focus Area        | string          | No       | Important area of an image, used for smart cropping. Leave empty to keep it unchanged, or use Clear Focus Area to remove it.             |
| Clear Focus Area  | boolean         | No       | Remove the focus area from the file instead of changing it.                                                                              |

**Outputs**

| Field | Type   | Description       |
| ----- | ------ | ----------------- |
| File  | object | The updated file. |

#### Delete File

Permanently delete a file from your ImageKit media library.

**Inputs**

| Field | Type            | Required | Description                                                                           |
| ----- | --------------- | -------- | ------------------------------------------------------------------------------------- |
| File  | select (string) | Yes      | The file to delete. This cannot be undone. Options load from the selected connection. |

**Outputs**

| Field   | Type    | Description                   |
| ------- | ------- | ----------------------------- |
| File ID | string  | ID of the deleted file.       |
| Deleted | boolean | Whether the file was deleted. |

#### Create Folder

Create a new folder in your ImageKit media library.

**Inputs**

| Field         | Type            | Required | Description                                                                                               |
| ------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| Folder Name   | string          | Yes      | Name of the new folder.                                                                                   |
| Parent Folder | select (string) | No       | Folder to create it in. Defaults to the top level. Options load from the selected connection. Default: /. |

**Outputs**

| Field       | Type   | Description             |
| ----------- | ------ | ----------------------- |
| Folder Path | string | Path of the new folder. |

#### Purge Cached URL

Clear a file's cached copy from ImageKit's CDN so visitors get the latest version.

**Inputs**

| Field | Type   | Required | Description                                |
| ----- | ------ | -------- | ------------------------------------------ |
| URL   | string | Yes      | Full ImageKit link of the file to refresh. |

**Outputs**

| Field      | Type   | Description                       |
| ---------- | ------ | --------------------------------- |
| Request ID | string | ID to check the purge's progress. |

#### Get Purge Status

Check whether a cache purge has finished.

**Inputs**

| Field      | Type   | Required | Description                              |
| ---------- | ------ | -------- | ---------------------------------------- |
| Request ID | string | Yes      | The ID returned when you purged the URL. |

**Outputs**

| Field      | Type   | Description           |
| ---------- | ------ | --------------------- |
| Request ID | string | Purge request ID.     |
| Status     | string | Pending or Completed. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/imagekit.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
