🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@netlify/open-api

Package Overview
Dependencies
Maintainers
16
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/open-api

Netlify's open-api definition as a module

2.37.0
latest
Source
npm
Version published
Weekly downloads
551K
0.97%
Maintainers
16
Weekly downloads
 
Created

What is @netlify/open-api?

@netlify/open-api is an npm package that provides a client for interacting with the Netlify Open API. It allows developers to programmatically manage Netlify resources such as sites, deploys, forms, and more.

What are @netlify/open-api's main functionalities?

Create a new site

This feature allows you to create a new site on Netlify. You need to provide an access token and the site details.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function createSite() {
  const site = await client.createSite({
    body: {
      name: 'my-new-site'
    }
  });
  console.log(site);
}

createSite();

List all sites

This feature allows you to list all the sites associated with your Netlify account.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function listSites() {
  const sites = await client.listSites();
  console.log(sites);
}

listSites();

Create a new deploy

This feature allows you to create a new deploy for a specific site. You need to provide the site ID and the directory path of the site.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function createDeploy(siteId, dir) {
  const deploy = await client.createSiteDeploy({
    site_id: siteId,
    body: {
      dir: dir
    }
  });
  console.log(deploy);
}

createDeploy('your-site-id', 'path/to/your/site');

Other packages similar to @netlify/open-api

Keywords

netlify

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts