> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Directory

> Create a directory inside the session workspace. Parents are created automatically.

## Overview

Creates a directory at the given workspace-relative path. Missing parent directories are created automatically (`mkdir -p` semantics). Creating an existing directory is a no-op and returns 201.

## Path Parameters

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID).
</ParamField>

## Body

<ParamField body="path" type="string" required={true}>
  Workspace-relative directory path to create.
</ParamField>

<ParamField body="mode" type="integer" default="0755">
  Unix mode (octal). Applied to the final directory.
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/dir" \
    -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "path": "exports/csv"
    }'
  ```
</CodeGroup>

## Response

### Success Response (201)

<ResponseField name="path" type="string">
  The created workspace-relative directory path.
</ResponseField>

**Example Response:**

```json theme={null}
{
  "path": "exports/csv"
}
```

### Error Responses

| Status | Description                                |
| ------ | ------------------------------------------ |
| `400`  | Invalid path.                              |
| `401`  | Unauthorized — invalid or missing API key. |
| `404`  | Session not found.                         |
| `409`  | Path exists and is not a directory.        |
