## Create Session

`client.Chat.New(ctx, params) (*ChatNewResponse, error)`

**post** `/api/v1/chat`

Create a chat session, optionally bound to indexes (locked after the first message).

### Parameters

- `params ChatNewParams`

  - `OrganizationID param.Field[string]`

    Query param

  - `ProjectID param.Field[string]`

    Query param

  - `IndexIDs param.Field[[]string]`

    Body param: Indexes this session will retrieve from. Once set and the first message has been sent, the source set is locked for the session's lifetime. Leave null to create an unbound session.

  - `SharedAccess param.Field[ChatNewParamsSharedAccess]`

    Body param: What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions). Null follows the deployment default.

    - `const ChatNewParamsSharedAccessQuery ChatNewParamsSharedAccess = "query"`

    - `const ChatNewParamsSharedAccessReadOnly ChatNewParamsSharedAccess = "read_only"`

### Returns

- `type ChatNewResponse struct{…}`

  Summary of a chat session, including its title and last run metadata.

  - `LastUpdatedAt string`

    ISO-format timestamp showing when the session was last updated.

  - `SessionID string`

    Unique session identifier.

  - `SharedAccess ChatNewResponseSharedAccess`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `const ChatNewResponseSharedAccessQuery ChatNewResponseSharedAccess = "query"`

    - `const ChatNewResponseSharedAccessReadOnly ChatNewResponseSharedAccess = "read_only"`

  - `GeneratedTitle string`

    Auto-generated title derived from the first user message.

  - `IndexIDs []string`

    Indexes this session is bound to. Null on unbound sessions.

  - `JobMetadata ChatNewResponseJobMetadata`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `DurationMs float64`

    - `Error string`

    - `ExportConfigIDs []string`

    - `IsError bool`

    - `TotalInputTokens int64`

    - `TotalOutputTokens int64`

    - `Turns int64`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llama-parse-go"
  "github.com/run-llama/llama-parse-go/option"
)

func main() {
  client := llamacloud.NewClient(
    option.WithAPIKey("My API Key"),
  )
  chat, err := client.Chat.New(context.TODO(), llamacloud.ChatNewParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", chat.SessionID)
}
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```
