- stageRedirects - Stages new redirects for a project.
- getRedirects - Gets project-level redirects.
- deleteRedirects - Delete project-level redirects.
- editRedirect - Edit a project-level redirect.
- restoreRedirects - Restore staged project-level redirects to their production version.
- getVersions - Get the version history for a project's redirects.
- updateVersion - Promote a staging version to production or restore a previous production version.
Stages new redirects for a project and returns the new version.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.stageRedirects({
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsStageRedirects } from "@vercel/sdk/funcs/bulkRedirectsStageRedirects.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 bulkRedirectsStageRedirects(vercel, {
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsStageRedirects failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.StageRedirectsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.StageRedirectsResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Get the version history for a project's bulk redirects
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.getRedirects({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsGetRedirects } from "@vercel/sdk/funcs/bulkRedirectsGetRedirects.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 bulkRedirectsGetRedirects(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsGetRedirects failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.GetRedirectsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.GetRedirectsResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Deletes the provided redirects from the latest version of the projects' bulk redirects. Stages a new change with the new redirects and returns the alias for the new version in the response.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.deleteRedirects({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsDeleteRedirects } from "@vercel/sdk/funcs/bulkRedirectsDeleteRedirects.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 bulkRedirectsDeleteRedirects(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsDeleteRedirects failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.DeleteRedirectsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.DeleteRedirectsResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Edits a single redirect identified by its source path. Stages a new change with the modified redirect and returns the alias for the new version in the response.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.editRedirect({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsEditRedirect } from "@vercel/sdk/funcs/bulkRedirectsEditRedirect.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 bulkRedirectsEditRedirect(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsEditRedirect failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.EditRedirectRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.EditRedirectResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Restores the provided redirects in the staging version to the value in the production version. If no production version exists, removes the redirects from staging.
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.restoreRedirects({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsRestoreRedirects } from "@vercel/sdk/funcs/bulkRedirectsRestoreRedirects.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 bulkRedirectsRestoreRedirects(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsRestoreRedirects failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.RestoreRedirectsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.RestoreRedirectsResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Get the version history for a project's bulk redirects
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.getVersions({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsGetVersions } from "@vercel/sdk/funcs/bulkRedirectsGetVersions.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 bulkRedirectsGetVersions(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsGetVersions failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.GetVersionsRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.GetVersionsResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |
Update a version by promoting staging to production or restoring a previous production version
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.bulkRedirects.updateVersion({
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();The standalone function version of this method:
import { VercelCore } from "@vercel/sdk/core.js";
import { bulkRedirectsUpdateVersion } from "@vercel/sdk/funcs/bulkRedirectsUpdateVersion.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 bulkRedirectsUpdateVersion(vercel, {
projectId: "<id>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("bulkRedirectsUpdateVersion failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.UpdateVersionRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | 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 | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.UpdateVersionResponseBody>
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |