Create a folder using the Google Drive API

Example of creating a folder using the Google Drive REST API in javascript.

Create folder via REST API in vanilla javascript

let createFolderOptions = {
  method: "POST",
  headers: {
    Authorization: `Bearer ${token}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    mimeType: "application/vnd.google-apps.folder",
    name: "My new google drive folder!",
  }),
};

const response = await fetch("https://www.googleapis.com/drive/v3/files", createFolderOptions);
const json = await response.json();

For other Google Drive API Examples: https://www.mikesallese.me/tags/google-drive-api-examples

Still need help?

Didn't find what you need? I'm happy to help folks out.

Feel free to email me at