Skip to content
campaiDeveloper
campai.com

Misc · Drive

POST/{organizationId}/misc/drive/folders

Create folder

Creates a folder at the top level or inside another folder. Supply the organization ID, name, color, and a nullable parent ID. The response contains the new folder’s _id.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • Organization access with drive.insert is required.
  • Callers with assigned-only drive access must create the folder inside a folder shared with them; they cannot create one at the top level.

Request

Path parameters

  • organizationIdidrequired

Body

Content-Type: application/json

  • namestringrequired

    1–128 characters

  • colorstringrequired
    22 values
    slate gray zinc neutral stone red orange amber yellow lime green emerald teal cyan sky blue indigo violet purple fuchsia pink rose
  • parentIdidrequirednullable
Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/misc/drive/folders' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • _idid
Response200
{
  "_id": "000000000000000000000001"
}

What else happens

  • Creates a record in driveFolders.
  • When a parent is supplied, updates contentUpdatedAt on the parent and its ancestors.

Errors

Other errors

StatusErrorWhen
403You can only work inside folders shared with youFor assigned-only drive access, a missing or unshared parent, including a top-level request, returns HTTP 403 FORBIDDEN with key misc.drive.sharedFoldersOnly.
404The folder was not foundIf the supplied parent folder is not found in the organization and the request passes the write-access check, the endpoint returns HTTP 404 NOT_FOUND with key routes.misc.drive.noFolder.

Errors nearly every request can meet are listed under Errors.