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

# SDK method examples

> Copy-paste TypeScript and Python examples for every Flowra SDK facade method.

Examples for **every** product-facade method on [`@flowra/sdk`](https://www.npmjs.com/package/@flowra/sdk) and `flowra` ([`flowra-sdk` on PyPI](https://pypi.org/project/flowra-sdk/)). Bodies use placeholders — full schemas: [API reference](/api-reference). Method map: [SDK namespaces](/guides/sdk-namespaces). Source: [github.com/flowradev/sdk](https://github.com/flowradev/sdk).

Assume a client is already constructed:

<CodeGroup>
  ```ts theme={null}
  import { Flowra } from '@flowra/sdk';

  const flowra = new Flowra({ apiKey: process.env.FLOWRA_API_KEY! });
  ```

  ```python theme={null}
  from flowra import Flowra

  flowra = Flowra(api_key="YOUR_API_KEY")
  ```
</CodeGroup>

Ids like `toolId`, `workflowId`, and `threadId` are placeholders from list/create responses. Chat threads use `thread_id` (snake\_case) from Graphify.

## Root

### `getProfile` / `get_profile`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.getProfile();
  ```

  ```python theme={null}
  result = flowra.get_profile()
  ```
</CodeGroup>

### `asUser` / `as_user`

Returns a scoped client.

<CodeGroup>
  ```ts theme={null}
  const alice = flowra.asUser('customer_alice');
  ```

  ```python theme={null}
  alice = flowra.as_user('customer_alice')
  ```
</CodeGroup>

### `flowra.raw` (example)

Escape hatch.

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.raw.toolsControllerGetTools({ client: flowra.client, query: { limit: 5 } });
  ```

  ```python theme={null}
  result = flowra.request('GET', '/api/v1/tools', query={'limit': 5})
  ```
</CodeGroup>

## `tools`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.list({ limit: 10, toolkitSlug: 'slack' });
  ```

  ```python theme={null}
  result = flowra.tools.list(limit=10, toolkitSlug='slack')
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.get(toolId);
  ```

  ```python theme={null}
  result = flowra.tools.get(tool_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.create({ /* CreateToolDto */ });
  ```

  ```python theme={null}
  result = flowra.tools.create({...})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.update(toolId, { /* patch */ });
  ```

  ```python theme={null}
  result = flowra.tools.update(tool_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.remove(toolId);
  ```

  ```python theme={null}
  result = flowra.tools.remove(tool_id)
  ```
</CodeGroup>

### `setActive`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.setActive(toolId);
  ```

  ```python theme={null}
  result = flowra.tools.set_active(tool_id)
  ```
</CodeGroup>

### `execute`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.execute('SLACK_SEND_MESSAGE', { arguments: { /* ... */ } });
  ```

  ```python theme={null}
  result = flowra.tools.execute('SLACK_SEND_MESSAGE', {'arguments': {}})
  ```
</CodeGroup>

### `executionLogs`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.tools.executionLogs({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.tools.execution_logs(limit=20)
  ```
</CodeGroup>

## `toolkits`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.list({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.toolkits.list(limit=20)
  ```
</CodeGroup>

### `listWithTools`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.listWithTools({ q: 'gmail' });
  ```

  ```python theme={null}
  result = flowra.toolkits.list_with_tools(q='gmail')
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.get(toolkitId);
  ```

  ```python theme={null}
  result = flowra.toolkits.get(toolkit_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.create({ /* CreateToolkitDto */ });
  ```

  ```python theme={null}
  result = flowra.toolkits.create({...})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.update(toolkitId, { /* patch */ });
  ```

  ```python theme={null}
  result = flowra.toolkits.update(toolkit_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.remove(toolkitId);
  ```

  ```python theme={null}
  result = flowra.toolkits.remove(toolkit_id)
  ```
</CodeGroup>

### `setActive`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.setActive(toolkitId);
  ```

  ```python theme={null}
  result = flowra.toolkits.set_active(toolkit_id)
  ```
</CodeGroup>

### `messagingChannels`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.messagingChannels();
  ```

  ```python theme={null}
  result = flowra.toolkits.messaging_channels()
  ```
</CodeGroup>

### `listCategories`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.toolkits.listCategories();
  ```

  ```python theme={null}
  result = flowra.toolkits.list_categories()
  ```
</CodeGroup>

## `skills`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.list({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.skills.list(limit=20)
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.get(skillId);
  ```

  ```python theme={null}
  result = flowra.skills.get(skill_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.create({ /* CreateSkillDto */ });
  ```

  ```python theme={null}
  result = flowra.skills.create({...})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.update(skillId, { /* UpdateSkillDto */ });
  ```

  ```python theme={null}
  result = flowra.skills.update(skill_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.remove(skillId);
  ```

  ```python theme={null}
  result = flowra.skills.remove(skill_id)
  ```
</CodeGroup>

### `addToLibrary`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.addToLibrary(skillId);
  ```

  ```python theme={null}
  result = flowra.skills.add_to_library(skill_id)
  ```
</CodeGroup>

### `catalogBrowse`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.catalogBrowse({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.skills.catalog_browse(limit=20)
  ```
</CodeGroup>

### `importGithub`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.importGithub({ /* ImportGithub body */ });
  ```

  ```python theme={null}
  result = flowra.skills.import_github({...})
  ```
</CodeGroup>

### `registryInstall`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.registryInstall({ /* RegistryInstall body */ });
  ```

  ```python theme={null}
  result = flowra.skills.registry_install({...})
  ```
</CodeGroup>

### `registryList`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.registryList({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.skills.registry_list(limit=20)
  ```
</CodeGroup>

### `registrySearch`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.skills.registrySearch({ q: 'pdf' });
  ```

  ```python theme={null}
  result = flowra.skills.registry_search(q='pdf')
  ```
</CodeGroup>

## `workflows`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.list({ limit: 10 });
  ```

  ```python theme={null}
  result = flowra.workflows.list(limit=10)
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.get(workflowId);
  ```

  ```python theme={null}
  result = flowra.workflows.get(workflow_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.create({ /* CreateAgentDto */ });
  ```

  ```python theme={null}
  result = flowra.workflows.create({...})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.update(workflowId, { /* patch */ });
  ```

  ```python theme={null}
  result = flowra.workflows.update(workflow_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.remove(workflowId);
  ```

  ```python theme={null}
  result = flowra.workflows.remove(workflow_id)
  ```
</CodeGroup>

### `setActive`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.setActive(workflowId, { activeStatus: true });
  ```

  ```python theme={null}
  result = flowra.workflows.set_active(workflow_id, True)
  ```
</CodeGroup>

### `run`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.run(workflowId, { input: { message: 'hi' } });
  ```

  ```python theme={null}
  result = flowra.workflows.run(workflow_id, {'input': {'message': 'hi'}})
  ```
</CodeGroup>

### `status`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.status(threadId);
  ```

  ```python theme={null}
  result = flowra.workflows.status(thread_id)
  ```
</CodeGroup>

### `resume`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.resume(threadId, { resumeValue: { approved: true } });
  ```

  ```python theme={null}
  result = flowra.workflows.resume(thread_id, {'resumeValue': {'approved': True}})
  ```
</CodeGroup>

### `executions`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.executions({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.workflows.executions(limit=20)
  ```
</CodeGroup>

### `execution`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.execution(executionId);
  ```

  ```python theme={null}
  result = flowra.workflows.execution(execution_id)
  ```
</CodeGroup>

### `statistics`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.statistics(workflowId);
  ```

  ```python theme={null}
  result = flowra.workflows.statistics(workflow_id)
  ```
</CodeGroup>

### `executionsFor`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.executionsFor(workflowId, { limit: 20 });
  ```

  ```python theme={null}
  result = flowra.workflows.executions_for(workflow_id, limit=20)
  ```
</CodeGroup>

### `addConnection`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.addConnection({ /* body */ });
  ```

  ```python theme={null}
  result = flowra.workflows.add_connection({...})
  ```
</CodeGroup>

### `changeConnection`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.changeConnection(workflowId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.workflows.change_connection(workflow_id, {...})
  ```
</CodeGroup>

### `setAuthConfig`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.setAuthConfig(workflowId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.workflows.set_auth_config(workflow_id, {...})
  ```
</CodeGroup>

### `clearAuthConfig`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.clearAuthConfig(workflowId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.workflows.clear_auth_config(workflow_id, {...})
  ```
</CodeGroup>

### `clearConnection`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.workflows.clearConnection(workflowId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.workflows.clear_connection(workflow_id, {...})
  ```
</CodeGroup>

## `connections`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.list();
  ```

  ```python theme={null}
  result = flowra.connections.list()
  ```
</CodeGroup>

### `listGrouped`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.listGrouped();
  ```

  ```python theme={null}
  result = flowra.connections.list_grouped()
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.create({ /* body */ });
  ```

  ```python theme={null}
  result = flowra.connections.create({...})
  ```
</CodeGroup>

### `createLink`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.createLink({ toolkitSlug: 'slack', authConfigId });
  ```

  ```python theme={null}
  result = flowra.connections.create_link({'toolkitSlug': 'slack', 'authConfigId': auth_config_id})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.update(connectionId, { /* patch */ });
  ```

  ```python theme={null}
  result = flowra.connections.update(connection_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.connections.remove(connectionId);
  ```

  ```python theme={null}
  result = flowra.connections.remove(connection_id)
  ```
</CodeGroup>

## `authConfigs` / `auth_configs`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.authConfigs.list({ toolkitSlug: 'slack' });
  ```

  ```python theme={null}
  result = flowra.auth_configs.list(toolkitSlug='slack')
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.authConfigs.get(authConfigId);
  ```

  ```python theme={null}
  result = flowra.auth_configs.get(auth_config_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.authConfigs.create({ /* CreateAuthConfigDto */ });
  ```

  ```python theme={null}
  result = flowra.auth_configs.create({...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.authConfigs.remove(authConfigId);
  ```

  ```python theme={null}
  result = flowra.auth_configs.remove(auth_config_id)
  ```
</CodeGroup>

## `users`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.users.list();
  ```

  ```python theme={null}
  result = flowra.users.list()
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.users.create({ username: 'customer_alice' });
  ```

  ```python theme={null}
  result = flowra.users.create({'username': 'customer_alice'})
  ```
</CodeGroup>

### `getByUsername`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.users.getByUsername('customer_alice');
  ```

  ```python theme={null}
  result = flowra.users.get_by_username('customer_alice')
  ```
</CodeGroup>

### `toggleActive`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.users.toggleActive(userId);
  ```

  ```python theme={null}
  result = flowra.users.toggle_active(user_id)
  ```
</CodeGroup>

### `refreshAvatar`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.users.refreshAvatar(userId);
  ```

  ```python theme={null}
  result = flowra.users.refresh_avatar(user_id)
  ```
</CodeGroup>

## `triggers`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.list();
  ```

  ```python theme={null}
  result = flowra.triggers.list()
  ```
</CodeGroup>

### `upsert`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.upsert(slug, { /* UpsertTriggerInstanceDto */ });
  ```

  ```python theme={null}
  result = flowra.triggers.upsert(slug, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.remove(triggerId);
  ```

  ```python theme={null}
  result = flowra.triggers.remove(trigger_id)
  ```
</CodeGroup>

### `setStatus`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.setStatus(triggerId);
  ```

  ```python theme={null}
  result = flowra.triggers.set_status(trigger_id)
  ```
</CodeGroup>

### `invocationLogs`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.invocationLogs({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.triggers.invocation_logs(limit=20)
  ```
</CodeGroup>

### `replayWebhook`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.triggers.replayWebhook(logId);
  ```

  ```python theme={null}
  result = flowra.triggers.replay_webhook(log_id)
  ```
</CodeGroup>

## `chat`

### `createThread`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.createThread({ metadata: { ticketId: 'T-1' } });
  ```

  ```python theme={null}
  result = flowra.chat.create_thread({'metadata': {'ticketId': 'T-1'}})
  ```
</CodeGroup>

### `getThread`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.getThread(threadId);
  ```

  ```python theme={null}
  result = flowra.chat.get_thread(thread_id)
  ```
</CodeGroup>

### `updateThread`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.updateThread(threadId, { metadata: { title: 'Support' } });
  ```

  ```python theme={null}
  result = flowra.chat.update_thread(thread_id, {'metadata': {'title': 'Support'}})
  ```
</CodeGroup>

### `deleteThread`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.deleteThread(threadId);
  ```

  ```python theme={null}
  result = flowra.chat.delete_thread(thread_id)
  ```
</CodeGroup>

### `searchThreads`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.searchThreads({ /* SearchThreadsDto */ });
  ```

  ```python theme={null}
  result = flowra.chat.search_threads({...})
  ```
</CodeGroup>

### `history`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.history(threadId, {});
  ```

  ```python theme={null}
  result = flowra.chat.history(thread_id, {})
  ```
</CodeGroup>

### `state`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.state(threadId);
  ```

  ```python theme={null}
  result = flowra.chat.state(thread_id)
  ```
</CodeGroup>

### `stream`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.stream(threadId, { input: { messages: [{ role: 'user', content: 'Hi' }] } });
  ```

  ```python theme={null}
  result = flowra.chat.stream(thread_id, {'input': {'messages': [{'role': 'user', 'content': 'Hi'}]}}, as_events=True)
  ```
</CodeGroup>

### `listRuns`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.listRuns(threadId);
  ```

  ```python theme={null}
  result = flowra.chat.list_runs(thread_id)
  ```
</CodeGroup>

### `cancelRun`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.cancelRun(threadId, runId);
  ```

  ```python theme={null}
  result = flowra.chat.cancel_run(thread_id, run_id)
  ```
</CodeGroup>

### `generateTitle`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.generateTitle(threadId);
  ```

  ```python theme={null}
  result = flowra.chat.generate_title(thread_id)
  ```
</CodeGroup>

### `sendOperatorReply`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.sendOperatorReply(threadId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.chat.send_operator_reply(thread_id, {...})
  ```
</CodeGroup>

### `setReplyMode`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.setReplyMode(threadId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.chat.set_reply_mode(thread_id, {...})
  ```
</CodeGroup>

### `joinStream`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.chat.joinStream(threadId, runId);
  ```

  ```python theme={null}
  result = flowra.chat.join_stream(thread_id, run_id, as_events=True)
  ```
</CodeGroup>

## `files`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.list({ limit: 20 });
  ```

  ```python theme={null}
  result = flowra.files.list(limit=20)
  ```
</CodeGroup>

### `upload`

TS: multipart body for generated client; PY: path, bytes, or file object.

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.upload('document', formDataBody as never);
  ```

  ```python theme={null}
  result = flowra.files.upload('document', '/path/to/file.pdf')
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.remove(fileId);
  ```

  ```python theme={null}
  result = flowra.files.remove(file_id)
  ```
</CodeGroup>

### `download`

Returns file bytes / content.

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.download(fileId);
  ```

  ```python theme={null}
  result = flowra.files.download(file_id)
  ```
</CodeGroup>

### `storageBreakdown`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.storageBreakdown();
  ```

  ```python theme={null}
  result = flowra.files.storage_breakdown()
  ```
</CodeGroup>

### `serveByFilename`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.serveByFilename(filename);
  ```

  ```python theme={null}
  result = flowra.files.serve_by_filename(filename)
  ```
</CodeGroup>

### `deleteMany`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.deleteMany({ /* body */ });
  ```

  ```python theme={null}
  result = flowra.files.delete_many({...})
  ```
</CodeGroup>

### `fileType`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.fileType(fileType);
  ```

  ```python theme={null}
  result = flowra.files.file_type(file_type)
  ```
</CodeGroup>

### `fileTypes`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.fileTypes();
  ```

  ```python theme={null}
  result = flowra.files.file_types()
  ```
</CodeGroup>

### `pruneOldest`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.files.pruneOldest({ /* body */ });
  ```

  ```python theme={null}
  result = flowra.files.prune_oldest({...})
  ```
</CodeGroup>

## `knowledge`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.list();
  ```

  ```python theme={null}
  result = flowra.knowledge.list()
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.create({ name: 'Help center' });
  ```

  ```python theme={null}
  result = flowra.knowledge.create({'name': 'Help center'})
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.get(collectionId);
  ```

  ```python theme={null}
  result = flowra.knowledge.get(collection_id)
  ```
</CodeGroup>

### `rename`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.rename(collectionId, { name: 'Support FAQ' });
  ```

  ```python theme={null}
  result = flowra.knowledge.rename(collection_id, {'name': 'Support FAQ'})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.remove(collectionId);
  ```

  ```python theme={null}
  result = flowra.knowledge.remove(collection_id)
  ```
</CodeGroup>

### `chunks`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.chunks(collectionId, { limit: 20 });
  ```

  ```python theme={null}
  result = flowra.knowledge.chunks(collection_id, limit=20)
  ```
</CodeGroup>

### `sources`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.sources(collectionId);
  ```

  ```python theme={null}
  result = flowra.knowledge.sources(collection_id)
  ```
</CodeGroup>

### `deleteSource`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.deleteSource(collectionId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.knowledge.delete_source(collection_id, {...})
  ```
</CodeGroup>

### `ingestFile`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.ingestFile(collectionId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.knowledge.ingest_file(collection_id, {...})
  ```
</CodeGroup>

### `ingestText`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.ingestText(collectionId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.knowledge.ingest_text(collection_id, {...})
  ```
</CodeGroup>

### `ingestUrl`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.ingestUrl(collectionId, { url: 'https://docs.yoursite.com/faq' });
  ```

  ```python theme={null}
  result = flowra.knowledge.ingest_url(collection_id, {'url': 'https://docs.yoursite.com/faq'})
  ```
</CodeGroup>

### `search`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.search(collectionId, { query: 'refund policy' });
  ```

  ```python theme={null}
  result = flowra.knowledge.search(collection_id, {'query': 'refund policy'})
  ```
</CodeGroup>

### `setExposeViaMcp`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.knowledge.setExposeViaMcp(collectionId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.knowledge.set_expose_via_mcp(collection_id, {...})
  ```
</CodeGroup>

## `database`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.list();
  ```

  ```python theme={null}
  result = flowra.database.list()
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.get(collectionId);
  ```

  ```python theme={null}
  result = flowra.database.get(collection_id)
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.remove(collectionId);
  ```

  ```python theme={null}
  result = flowra.database.remove(collection_id)
  ```
</CodeGroup>

### `documents`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.documents(collectionId, { limit: 50 });
  ```

  ```python theme={null}
  result = flowra.database.documents(collection_id, limit=50)
  ```
</CodeGroup>

### `createDocument`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.createDocument(collectionId, { /* fields */ });
  ```

  ```python theme={null}
  result = flowra.database.create_document(collection_id, {...})
  ```
</CodeGroup>

### `updateDocument`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.updateDocument(collectionId, documentId, { /* fields */ });
  ```

  ```python theme={null}
  result = flowra.database.update_document(collection_id, document_id, {...})
  ```
</CodeGroup>

### `deleteDocument`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.deleteDocument(collectionId, documentId);
  ```

  ```python theme={null}
  result = flowra.database.delete_document(collection_id, document_id)
  ```
</CodeGroup>

### `setExposeViaMcp`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.database.setExposeViaMcp(collectionId, { /* body */ });
  ```

  ```python theme={null}
  result = flowra.database.set_expose_via_mcp(collection_id, {...})
  ```
</CodeGroup>

## `sandbox`

### `runEphemeral`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.runEphemeral({ language: 'javascript', source: 'return 1 + 1;' });
  ```

  ```python theme={null}
  result = flowra.sandbox.run_ephemeral({'language': 'javascript', 'source': 'return 1 + 1;'})
  ```
</CodeGroup>

### `createSession`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.createSession({});
  ```

  ```python theme={null}
  result = flowra.sandbox.create_session({})
  ```
</CodeGroup>

### `getSession`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.getSession(sessionId);
  ```

  ```python theme={null}
  result = flowra.sandbox.get_session(session_id)
  ```
</CodeGroup>

### `execute`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.execute(sessionId, { language: 'python', source: 'print(2)' });
  ```

  ```python theme={null}
  result = flowra.sandbox.execute(session_id, {'language': 'python', 'source': 'print(2)'})
  ```
</CodeGroup>

### `releaseSession`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.releaseSession(sessionId);
  ```

  ```python theme={null}
  result = flowra.sandbox.release_session(session_id)
  ```
</CodeGroup>

### `startThreadComputer`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.startThreadComputer(threadId);
  ```

  ```python theme={null}
  result = flowra.sandbox.start_thread_computer(thread_id)
  ```
</CodeGroup>

### `getThreadComputer`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.getThreadComputer(threadId);
  ```

  ```python theme={null}
  result = flowra.sandbox.get_thread_computer(thread_id)
  ```
</CodeGroup>

### `releaseThreadComputer`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.sandbox.releaseThreadComputer(threadId);
  ```

  ```python theme={null}
  result = flowra.sandbox.release_thread_computer(thread_id)
  ```
</CodeGroup>

## `mcp`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.list();
  ```

  ```python theme={null}
  result = flowra.mcp.list()
  ```
</CodeGroup>

### `get`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.get(serverId);
  ```

  ```python theme={null}
  result = flowra.mcp.get(server_id)
  ```
</CodeGroup>

### `create`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.create({ /* CreateMcpServerDto */ });
  ```

  ```python theme={null}
  result = flowra.mcp.create({...})
  ```
</CodeGroup>

### `update`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.update(serverId, { /* patch */ });
  ```

  ```python theme={null}
  result = flowra.mcp.update(server_id, {...})
  ```
</CodeGroup>

### `remove`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.remove(serverId);
  ```

  ```python theme={null}
  result = flowra.mcp.remove(server_id)
  ```
</CodeGroup>

### `config`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.config(serverId);
  ```

  ```python theme={null}
  result = flowra.mcp.config(server_id)
  ```
</CodeGroup>

### `setAuthConfig`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.setAuthConfig(serverId, { toolkitSlug: 'gmail', authConfigId });
  ```

  ```python theme={null}
  result = flowra.mcp.set_auth_config(server_id, {'toolkitSlug': 'gmail', 'authConfigId': auth_config_id})
  ```
</CodeGroup>

### `clearAuthConfig`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.clearAuthConfig(serverId, { toolkitSlug: 'gmail' });
  ```

  ```python theme={null}
  result = flowra.mcp.clear_auth_config(server_id, {'toolkitSlug': 'gmail'})
  ```
</CodeGroup>

### `hostedSse`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.hostedSse();
  ```

  ```python theme={null}
  result = flowra.mcp.hosted_sse()
  ```
</CodeGroup>

### `hostedPost`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.hostedPost({ /* MCP JSON-RPC body */ });
  ```

  ```python theme={null}
  result = flowra.mcp.hosted_post({...})
  ```
</CodeGroup>

### `handleSse`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.handleSse(serverId);
  ```

  ```python theme={null}
  result = flowra.mcp.handle_sse(server_id)
  ```
</CodeGroup>

### `handlePost`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.mcp.handlePost(serverId, { /* MCP JSON-RPC body */ });
  ```

  ```python theme={null}
  result = flowra.mcp.handle_post(server_id, {...})
  ```
</CodeGroup>

## `llm`

### `models`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.llm.models();
  ```

  ```python theme={null}
  result = flowra.llm.models()
  ```
</CodeGroup>

### `chat`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.llm.chat({ messages: [{ role: 'user', content: 'Hello' }] });
  ```

  ```python theme={null}
  result = flowra.llm.chat({'messages': [{'role': 'user', 'content': 'Hello'}]})
  ```
</CodeGroup>

### `generate`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.llm.generate({ /* GenerateDto */ });
  ```

  ```python theme={null}
  result = flowra.llm.generate({...})
  ```
</CodeGroup>

## `browser`

### `status`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.browser.status(sessionId);
  ```

  ```python theme={null}
  result = flowra.browser.status(session_id)
  ```
</CodeGroup>

### `touch`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.browser.touch(sessionId);
  ```

  ```python theme={null}
  result = flowra.browser.touch(session_id)
  ```
</CodeGroup>

### `close`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.browser.close(sessionId);
  ```

  ```python theme={null}
  result = flowra.browser.close(session_id)
  ```
</CodeGroup>

### `view`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.browser.view(sessionId, { /* query */ });
  ```

  ```python theme={null}
  result = flowra.browser.view(session_id)
  ```
</CodeGroup>

### `completeConnection`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.browser.completeConnection(sessionId);
  ```

  ```python theme={null}
  result = flowra.browser.complete_connection(session_id)
  ```
</CodeGroup>

## `usage`

### `list`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.usage.list({ threadId });
  ```

  ```python theme={null}
  result = flowra.usage.list(threadId=thread_id)
  ```
</CodeGroup>

### `balance`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.usage.balance();
  ```

  ```python theme={null}
  result = flowra.usage.balance()
  ```
</CodeGroup>

### `forExecution`

<CodeGroup>
  ```ts theme={null}
  const result = await flowra.usage.forExecution(executionId);
  ```

  ```python theme={null}
  result = flowra.usage.for_execution(execution_id)
  ```
</CodeGroup>

## Related

* [SDKs](/guides/sdk)
* [TypeScript SDK](/guides/sdk-typescript)
* [Python SDK](/guides/sdk-python)
* [SDK namespaces](/guides/sdk-namespaces)
* [Chat streaming](/guides/sdk-chat-streaming)
* [Usage and credits](/guides/usage-and-credits)
* [API reference](/api-reference)
