← Back to Guides

Pause your project

Use a webhook to pause your project based on spend management.

You can pause your project through the REST API. When you set up spend management, you can trigger a webhook which calls the REST API with the following code:

api/pause-project.ts
export async function POST(request: Request) {
  let projectId = 'your project id';
  let teamID = 'your team id';
  let route = '${projectId}/pause?teamID=${teamID}';
 
  await fetch(`https://api.vercel.com/v1/projects/${route}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${process.env.VERCEL_TOKEN}`,
    },
  });
 
  return new Response('Project paused', { status: 200 });
}
Last updated on May 18, 2024