Skip to main content
POST
/
prod
/
v1
/
directories
Create a new directory
curl --request POST \
  --url https://api.orion.file.ai/prod/v1/directories \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "name": "Directory 1",
  "description": "Description",
  "parentId": "649e2d2d2d2d2d2d2d2d2d2d",
  "isActive": true
}
'
{
  "success": true,
  "directory": {
    "name": "Smart folder 3",
    "description": "Smart folder 3",
    "status": "active",
    "createdAt": "2025-10-07T05:39:42.819Z",
    "updatedAt": "2025-10-07T05:39:42.819Z",
    "depth": 0,
    "metadata": {
      "userId": "68e387848a36d1dd65fa064e",
      "organizationId": "68e387848a36d1dd65fa0653",
      "workspaceId": "68e387848a36d1dd65fa064f",
      "createdBy": null,
      "lastModifiedBy": null,
      "tags": null,
      "version": null,
      "isSystemManaged": null
    },
    "workflowStates": null,
    "deletedBy": null,
    "parentId": null,
    "id": "68e4a79e0e79a0744ac7293d"
  }
}
Create a new directory (folder) to organize your files within the workspace. Directories can be nested by providing a parentId to create subdirectories.
The system enforces a maximum directory depth limit (configurable via system settings, default is 1 level).

Use Cases

File Organization

Create folders to organize uploaded files by category, project, or type

Nested Structure

Build hierarchical folder structures with parent-child relationships

Workflow Automation

Programmatically create folders as part of automated workflows

Team Collaboration

Set up shared folder structures for team-based file management

Request Parameters

Request Body

The request body must contain a JSON object with the following properties:
PropertyTypeRequiredDescription
namestringYesThe name of the directory
descriptionstringNoA description for the directory
parentIdstringNoThe ID of the parent directory to create a subdirectory
If parentId is not provided, the directory will be created at the root level.

Directory Properties

Automatic Fields

The following fields are automatically set by the system:
FieldDescription
idUnique identifier assigned to the directory
statusSet to “active” by default
depthCalculated based on parent hierarchy (0 for root)
createdAtTimestamp when directory was created
updatedAtTimestamp when directory was last modified
metadataUser, organization, and workspace information

Depth Calculation

Directories created without a parentId are placed at the root level with depth: 0.
When you provide a parentId, the system automatically calculates the depth by incrementing the parent’s depth by 1.
The system enforces a maximum depth limit (default: 1 level). Attempting to create directories beyond this limit will result in a 400 error.

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
name
string
required

Directory name

Example:

"Directory 1"

description
string

Directory description

Example:

"Description"

parentId
string

Parent directory id

Example:

"649e2d2d2d2d2d2d2d2d2d2d"

isActive
boolean
default:true

Is active

Example:

true

Response

The directory is created

success
boolean
directory
object