Skip to content
Framework Docs

Create Directory

client.Beta.Directories.New(ctx, params) (*BetaDirectoryNewResponse, error)
POST/api/v1/beta/directories

Create a new directory within the specified project.

If data_source_id is provided, validates that the data source exists and belongs to the same project.

ParametersExpand Collapse
params BetaDirectoryNewParams
Name param.Field[string]

Body param: Human-readable name for the directory.

minLength1
OrganizationID param.Field[string]optional

Query param

formatuuid
ProjectID param.Field[string]optional

Query param

formatuuid
DataSourceID param.Field[string]optional

Body param: Optional data source id the directory syncs from.

Description param.Field[string]optional

Body param: Optional description shown to users.

ReturnsExpand Collapse
type BetaDirectoryNewResponse struct{…}

API response schema for a directory.

ID string

Unique identifier for the directory.

Name string

Human-readable name for the directory.

minLength1
ProjectID string

Project the directory belongs to.

CreatedAt Timeoptional

Creation datetime

formatdate-time
DataSourceID stringoptional

Optional data source id the directory syncs from. Null if just manual uploads.

DeletedAt Timeoptional

Optional timestamp of when the directory was deleted. Null if not deleted.

formatdate-time
Description stringoptional

Optional description shown to users.

UpdatedAt Timeoptional

Update datetime

formatdate-time

Create Directory

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/llamacloud-prod-go"
  "github.com/stainless-sdks/llamacloud-prod-go/option"
)

func main() {
  client := llamacloudprod.NewClient(
    option.WithAPIKey("My API Key"),
  )
  directory, err := client.Beta.Directories.New(context.TODO(), llamacloudprod.BetaDirectoryNewParams{
    Name: "x",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", directory.ID)
}
{
  "id": "id",
  "name": "x",
  "project_id": "project_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "data_source_id": "data_source_id",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "id": "id",
  "name": "x",
  "project_id": "project_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "data_source_id": "data_source_id",
  "deleted_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "updated_at": "2019-12-27T18:11:19.117Z"
}