EdgeCache
January 9, 2026 ยท View on GitHub
Overview
Available Operations
- invalidateByTags - Invalidate by tag
- dangerouslyDeleteByTags - Dangerously delete by tag
- invalidateBySrcImages - Invalidate by source image
- dangerouslyDeleteBySrcImages - Dangerously delete by source image
invalidateByTags
Marks a cache tag as stale, causing cache entries associated with that tag to be revalidated in the background on the next request.
Example Usage
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await vercel.edgeCache.invalidateByTags({
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
}
run();
Standalone function
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { edgeCacheInvalidateByTags } from "@vercel/sdk/funcs/edgeCacheInvalidateByTags.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await edgeCacheInvalidateByTags(vercel, {
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("edgeCacheInvalidateByTags failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.InvalidateByTagsRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<void>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
dangerouslyDeleteByTags
Marks a cache tag as deleted, causing cache entries associated with that tag to be revalidated in the foreground on the next request. Use this method with caution because one tag can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateByTag instead.
Example Usage
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await vercel.edgeCache.dangerouslyDeleteByTags({
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
}
run();
Standalone function
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { edgeCacheDangerouslyDeleteByTags } from "@vercel/sdk/funcs/edgeCacheDangerouslyDeleteByTags.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await edgeCacheDangerouslyDeleteByTags(vercel, {
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("edgeCacheDangerouslyDeleteByTags failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.DangerouslyDeleteByTagsRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<void>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
invalidateBySrcImages
Marks a source image as stale, causing its corresponding transformed images to be revalidated in the background on the next request.
Example Usage
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await vercel.edgeCache.invalidateBySrcImages({
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
}
run();
Standalone function
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { edgeCacheInvalidateBySrcImages } from "@vercel/sdk/funcs/edgeCacheInvalidateBySrcImages.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await edgeCacheInvalidateBySrcImages(vercel, {
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("edgeCacheInvalidateBySrcImages failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.InvalidateBySrcImagesRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<void>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
dangerouslyDeleteBySrcImages
Marks a source image as deleted, causing cache entries associated with that source image to be revalidated in the foreground on the next request. Use this method with caution because one source image can be associated with many paths and deleting the cache can cause many concurrent requests to the origin leading to cache stampede problem. This method is for advanced use cases and is not recommended; prefer using invalidateBySrcImage instead.
Example Usage
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await vercel.edgeCache.dangerouslyDeleteBySrcImages({
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
}
run();
Standalone function
The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { edgeCacheDangerouslyDeleteBySrcImages } from "@vercel/sdk/funcs/edgeCacheDangerouslyDeleteBySrcImages.js";
// Use `VercelCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const vercel = new VercelCore({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await edgeCacheDangerouslyDeleteBySrcImages(vercel, {
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("edgeCacheDangerouslyDeleteBySrcImages failed:", res.error);
}
}
run();
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | models.DangerouslyDeleteBySrcImagesRequest | :heavy_check_mark: | The request object to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<void>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |