carbon-python-sdk 0.2.56
Client for Carbon
License: MIT
Requires Python: <4.0,>=3.8

<div align="center">

[![Visit Carbon](https://raw.githubusercontent.com/Carbon-for-Developers/carbon-sdks/HEAD/python/header.png)](https://carbon.ai)

# Carbon<a id="carbon"></a>

Connect external data to LLMs, no matter the source.


[![PyPI](https://img.shields.io/badge/PyPI-v0.2.56-blue)](https://pypi.org/project/carbon-python-sdk/0.2.56)
[![README.md](https://img.shields.io/badge/README-Click%20Here-green)](https://github.com/Carbon-for-Developers/carbon-sdks/tree/main/python#readme)

</div>

## Table of Contents<a id="table-of-contents"></a>

<!-- toc -->

- [Requirements](#requirements)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Async](#async)
- [Raw HTTP Response](#raw-http-response)
- [Reference](#reference)
  * [`carbon.auth.get_access_token`](#carbonauthget_access_token)
  * [`carbon.auth.get_white_labeling`](#carbonauthget_white_labeling)
  * [`carbon.crm.get_account`](#carboncrmget_account)
  * [`carbon.crm.get_accounts`](#carboncrmget_accounts)
  * [`carbon.crm.get_contact`](#carboncrmget_contact)
  * [`carbon.crm.get_contacts`](#carboncrmget_contacts)
  * [`carbon.crm.get_lead`](#carboncrmget_lead)
  * [`carbon.crm.get_leads`](#carboncrmget_leads)
  * [`carbon.crm.get_opportunities`](#carboncrmget_opportunities)
  * [`carbon.crm.get_opportunity`](#carboncrmget_opportunity)
  * [`carbon.data_sources.add_tags`](#carbondata_sourcesadd_tags)
  * [`carbon.data_sources.query`](#carbondata_sourcesquery)
  * [`carbon.data_sources.query_user_data_sources`](#carbondata_sourcesquery_user_data_sources)
  * [`carbon.data_sources.remove_tags`](#carbondata_sourcesremove_tags)
  * [`carbon.data_sources.revoke_access_token`](#carbondata_sourcesrevoke_access_token)
  * [`carbon.embeddings.get_documents`](#carbonembeddingsget_documents)
  * [`carbon.embeddings.get_embeddings_and_chunks`](#carbonembeddingsget_embeddings_and_chunks)
  * [`carbon.embeddings.list`](#carbonembeddingslist)
  * [`carbon.embeddings.upload_chunks_and_embeddings`](#carbonembeddingsupload_chunks_and_embeddings)
  * [`carbon.files.create_user_file_tags`](#carbonfilescreate_user_file_tags)
  * [`carbon.files.delete_file_tags`](#carbonfilesdelete_file_tags)
  * [`carbon.files.delete_many`](#carbonfilesdelete_many)
  * [`carbon.files.delete_v2`](#carbonfilesdelete_v2)
  * [`carbon.files.get_parsed_file`](#carbonfilesget_parsed_file)
  * [`carbon.files.get_raw_file`](#carbonfilesget_raw_file)
  * [`carbon.files.modify_cold_storage_parameters`](#carbonfilesmodify_cold_storage_parameters)
  * [`carbon.files.move_to_hot_storage`](#carbonfilesmove_to_hot_storage)
  * [`carbon.files.query_user_files`](#carbonfilesquery_user_files)
  * [`carbon.files.query_user_files_deprecated`](#carbonfilesquery_user_files_deprecated)
  * [`carbon.files.resync`](#carbonfilesresync)
  * [`carbon.files.upload`](#carbonfilesupload)
  * [`carbon.files.upload_from_url`](#carbonfilesupload_from_url)
  * [`carbon.files.upload_text`](#carbonfilesupload_text)
  * [`carbon.github.get_issue`](#carbongithubget_issue)
  * [`carbon.github.get_issues`](#carbongithubget_issues)
  * [`carbon.github.get_pr`](#carbongithubget_pr)
  * [`carbon.github.get_pr_comments`](#carbongithubget_pr_comments)
  * [`carbon.github.get_pr_commits`](#carbongithubget_pr_commits)
  * [`carbon.github.get_pr_files`](#carbongithubget_pr_files)
  * [`carbon.github.get_pull_requests`](#carbongithubget_pull_requests)
  * [`carbon.integrations.cancel`](#carbonintegrationscancel)
  * [`carbon.integrations.connect_data_source`](#carbonintegrationsconnect_data_source)
  * [`carbon.integrations.connect_document360`](#carbonintegrationsconnect_document360)
  * [`carbon.integrations.connect_freshdesk`](#carbonintegrationsconnect_freshdesk)
  * [`carbon.integrations.connect_gitbook`](#carbonintegrationsconnect_gitbook)
  * [`carbon.integrations.connect_guru`](#carbonintegrationsconnect_guru)
  * [`carbon.integrations.create_aws_iam_user`](#carbonintegrationscreate_aws_iam_user)
  * [`carbon.integrations.get_oauth_url`](#carbonintegrationsget_oauth_url)
  * [`carbon.integrations.list_confluence_pages`](#carbonintegrationslist_confluence_pages)
  * [`carbon.integrations.list_conversations`](#carbonintegrationslist_conversations)
  * [`carbon.integrations.list_data_source_items`](#carbonintegrationslist_data_source_items)
  * [`carbon.integrations.list_folders`](#carbonintegrationslist_folders)
  * [`carbon.integrations.list_gitbook_spaces`](#carbonintegrationslist_gitbook_spaces)
  * [`carbon.integrations.list_labels`](#carbonintegrationslist_labels)
  * [`carbon.integrations.list_outlook_categories`](#carbonintegrationslist_outlook_categories)
  * [`carbon.integrations.list_repos`](#carbonintegrationslist_repos)
  * [`carbon.integrations.list_sharepoint_sites`](#carbonintegrationslist_sharepoint_sites)
  * [`carbon.integrations.sync_azure_blob_files`](#carbonintegrationssync_azure_blob_files)
  * [`carbon.integrations.sync_azure_blob_storage`](#carbonintegrationssync_azure_blob_storage)
  * [`carbon.integrations.sync_confluence`](#carbonintegrationssync_confluence)
  * [`carbon.integrations.sync_data_source_items`](#carbonintegrationssync_data_source_items)
  * [`carbon.integrations.sync_files`](#carbonintegrationssync_files)
  * [`carbon.integrations.sync_git_hub`](#carbonintegrationssync_git_hub)
  * [`carbon.integrations.sync_gitbook`](#carbonintegrationssync_gitbook)
  * [`carbon.integrations.sync_gmail`](#carbonintegrationssync_gmail)
  * [`carbon.integrations.sync_outlook`](#carbonintegrationssync_outlook)
  * [`carbon.integrations.sync_repos`](#carbonintegrationssync_repos)
  * [`carbon.integrations.sync_rss_feed`](#carbonintegrationssync_rss_feed)
  * [`carbon.integrations.sync_s3_files`](#carbonintegrationssync_s3_files)
  * [`carbon.integrations.sync_slack`](#carbonintegrationssync_slack)
  * [`carbon.organizations.get`](#carbonorganizationsget)
  * [`carbon.organizations.update`](#carbonorganizationsupdate)
  * [`carbon.organizations.update_stats`](#carbonorganizationsupdate_stats)
  * [`carbon.users.delete`](#carbonusersdelete)
  * [`carbon.users.get`](#carbonusersget)
  * [`carbon.users.list`](#carbonuserslist)
  * [`carbon.users.toggle_user_features`](#carbonuserstoggle_user_features)
  * [`carbon.users.update_users`](#carbonusersupdate_users)
  * [`carbon.users.who_am_i`](#carbonuserswho_am_i)
  * [`carbon.utilities.fetch_urls`](#carbonutilitiesfetch_urls)
  * [`carbon.utilities.fetch_webpage`](#carbonutilitiesfetch_webpage)
  * [`carbon.utilities.fetch_youtube_transcripts`](#carbonutilitiesfetch_youtube_transcripts)
  * [`carbon.utilities.process_sitemap`](#carbonutilitiesprocess_sitemap)
  * [`carbon.utilities.scrape_sitemap`](#carbonutilitiesscrape_sitemap)
  * [`carbon.utilities.scrape_web`](#carbonutilitiesscrape_web)
  * [`carbon.utilities.search_urls`](#carbonutilitiessearch_urls)
  * [`carbon.utilities.user_webpages`](#carbonutilitiesuser_webpages)
  * [`carbon.webhooks.add_url`](#carbonwebhooksadd_url)
  * [`carbon.webhooks.delete_url`](#carbonwebhooksdelete_url)
  * [`carbon.webhooks.urls`](#carbonwebhooksurls)
  * [`carbon.white_label.create`](#carbonwhite_labelcreate)
  * [`carbon.white_label.delete`](#carbonwhite_labeldelete)
  * [`carbon.white_label.list`](#carbonwhite_labellist)
  * [`carbon.white_label.update`](#carbonwhite_labelupdate)

<!-- tocstop -->

## Requirements<a id="requirements"></a>

Python >=3.7

## Installation<a id="installation"></a>

```sh
pip install carbon-python-sdk==0.2.56
```

## Getting Started<a id="getting-started"></a>

```python
from carbon import Carbon

# 1) Get an access token for a customer
carbon = Carbon(
    api_key="YOUR_API_KEY",
    customer_id="YOUR_CUSTOMER_ID",
)

token = carbon.auth.get_access_token()

# 2) Use the access token to authenticate moving forward
carbon = Carbon(access_token=token.access_token)

# use SDK as usual
white_labeling = carbon.auth.get_white_labeling()
# etc.
```

## Async<a id="async"></a>

`async` support is available by prepending `a` to any method.

```python
import asyncio
from pprint import pprint
from carbon import Carbon, ApiException

carbon = Carbon(
    access_token="YOUR_API_KEY",
    api_key="YOUR_API_KEY",
    customer_id="YOUR_API_KEY",
)


async def main():
    try:
        # Get Access Token
        get_access_token_response = await carbon.auth.aget_access_token()
        print(get_access_token_response)
    except ApiException as e:
        print("Exception when calling AuthApi.get_access_token: %s\n" % e)
        pprint(e.body)
        if e.status == 422:
            pprint(e.body["detail"])
        pprint(e.headers)
        pprint(e.status)
        pprint(e.reason)
        pprint(e.round_trip_time)


asyncio.run(main())
```

## Raw HTTP Response<a id="raw-http-response"></a>

To access raw HTTP response values, use the `.raw` namespace.

```python
from pprint import pprint
from carbon import Carbon, ApiException

carbon = Carbon(
    access_token="YOUR_API_KEY",
    api_key="YOUR_API_KEY",
    customer_id="YOUR_API_KEY",
)

try:
    # Get Access Token
    get_access_token_response = carbon.auth.raw.get_access_token()
    pprint(get_access_token_response.body)
    pprint(get_access_token_response.body["access_token"])
    pprint(get_access_token_response.body["refresh_token"])
    pprint(get_access_token_response.headers)
    pprint(get_access_token_response.status)
    pprint(get_access_token_response.round_trip_time)
except ApiException as e:
    print("Exception when calling AuthApi.get_access_token: %s\n" % e)
    pprint(e.body)
    if e.status == 422:
        pprint(e.body["detail"])
    pprint(e.headers)
    pprint(e.status)
    pprint(e.reason)
    pprint(e.round_trip_time)
```


## Reference<a id="reference"></a>
### `carbon.auth.get_access_token`<a id="carbonauthget_access_token"></a>

Get Access Token

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_access_token_response = carbon.auth.get_access_token()
```

#### 🔄 Return<a id="🔄-return"></a>

[`TokenResponse`](./carbon/pydantic/token_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/auth/v1/access_token` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.auth.get_white_labeling`<a id="carbonauthget_white_labeling"></a>

Returns whether or not the organization is white labeled and which integrations are white labeled

:param current_user: the current user
:param db: the database session
:return: a WhiteLabelingResponse

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_white_labeling_response = carbon.auth.get_white_labeling()
```

#### 🔄 Return<a id="🔄-return"></a>

[`WhiteLabelingResponse`](./carbon/pydantic/white_labeling_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/auth/v1/white_labeling` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_account`<a id="carboncrmget_account"></a>

Get Account

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_account_response = carbon.crm.get_account(
    id="id_example",
    data_source_id=1,
    include_remote_data=False,
    includes=["string_example"],
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### id: `str`<a id="id-str"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

#### 🔄 Return<a id="🔄-return"></a>

[`Account`](./carbon/pydantic/account.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/accounts/{id}` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_accounts`<a id="carboncrmget_accounts"></a>

Get Accounts

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_accounts_response = carbon.crm.get_accounts(
    data_source_id=1,
    include_remote_data=False,
    next_cursor="string_example",
    page_size=1,
    order_dir="asc",
    includes=[],
    filters={},
    order_by="created_at",
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### next_cursor: `Optional[str]`<a id="next_cursor-optionalstr"></a>

##### page_size: `Optional[int]`<a id="page_size-optionalint"></a>

##### order_dir: [`OrderDirV2Nullable`](./carbon/type/order_dir_v2_nullable.py)<a id="order_dir-orderdirv2nullablecarbontypeorder_dir_v2_nullablepy"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

##### filters: [`AccountFilters`](./carbon/type/account_filters.py)<a id="filters-accountfilterscarbontypeaccount_filterspy"></a>


##### order_by: [`AccountsOrderByNullable`](./carbon/type/accounts_order_by_nullable.py)<a id="order_by-accountsorderbynullablecarbontypeaccounts_order_by_nullablepy"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`AccountsRequest`](./carbon/type/accounts_request.py)
#### 🔄 Return<a id="🔄-return"></a>

[`AccountResponse`](./carbon/pydantic/account_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/accounts` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_contact`<a id="carboncrmget_contact"></a>

Get Contact

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_contact_response = carbon.crm.get_contact(
    id="id_example",
    data_source_id=1,
    include_remote_data=False,
    includes=["string_example"],
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### id: `str`<a id="id-str"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

#### 🔄 Return<a id="🔄-return"></a>

[`Contact`](./carbon/pydantic/contact.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/contacts/{id}` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_contacts`<a id="carboncrmget_contacts"></a>

Get Contacts

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_contacts_response = carbon.crm.get_contacts(
    data_source_id=1,
    include_remote_data=False,
    next_cursor="string_example",
    page_size=1,
    order_dir="asc",
    includes=[],
    filters={},
    order_by="created_at",
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### next_cursor: `Optional[str]`<a id="next_cursor-optionalstr"></a>

##### page_size: `Optional[int]`<a id="page_size-optionalint"></a>

##### order_dir: [`OrderDirV2Nullable`](./carbon/type/order_dir_v2_nullable.py)<a id="order_dir-orderdirv2nullablecarbontypeorder_dir_v2_nullablepy"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

##### filters: [`ContactFilters`](./carbon/type/contact_filters.py)<a id="filters-contactfilterscarbontypecontact_filterspy"></a>


##### order_by: [`ContactsOrderByNullable`](./carbon/type/contacts_order_by_nullable.py)<a id="order_by-contactsorderbynullablecarbontypecontacts_order_by_nullablepy"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`ContactsRequest`](./carbon/type/contacts_request.py)
#### 🔄 Return<a id="🔄-return"></a>

[`ContactsResponse`](./carbon/pydantic/contacts_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/contacts` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_lead`<a id="carboncrmget_lead"></a>

Get Lead

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_lead_response = carbon.crm.get_lead(
    id="id_example",
    data_source_id=1,
    include_remote_data=False,
    includes=["string_example"],
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### id: `str`<a id="id-str"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

#### 🔄 Return<a id="🔄-return"></a>

[`Lead`](./carbon/pydantic/lead.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/leads/{id}` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_leads`<a id="carboncrmget_leads"></a>

Get Leads

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_leads_response = carbon.crm.get_leads(
    data_source_id=1,
    include_remote_data=False,
    next_cursor="string_example",
    page_size=1,
    order_dir="asc",
    includes=[],
    filters={},
    order_by="created_at",
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### next_cursor: `Optional[str]`<a id="next_cursor-optionalstr"></a>

##### page_size: `Optional[int]`<a id="page_size-optionalint"></a>

##### order_dir: [`OrderDirV2Nullable`](./carbon/type/order_dir_v2_nullable.py)<a id="order_dir-orderdirv2nullablecarbontypeorder_dir_v2_nullablepy"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

##### filters: [`LeadFilters`](./carbon/type/lead_filters.py)<a id="filters-leadfilterscarbontypelead_filterspy"></a>


##### order_by: [`LeadsOrderByNullable`](./carbon/type/leads_order_by_nullable.py)<a id="order_by-leadsorderbynullablecarbontypeleads_order_by_nullablepy"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`LeadsRequest`](./carbon/type/leads_request.py)
#### 🔄 Return<a id="🔄-return"></a>

[`LeadsResponse`](./carbon/pydantic/leads_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/leads` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_opportunities`<a id="carboncrmget_opportunities"></a>

Get Opportunities

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_opportunities_response = carbon.crm.get_opportunities(
    data_source_id=1,
    include_remote_data=False,
    next_cursor="string_example",
    page_size=1,
    order_dir="asc",
    includes=[],
    filters={
        "status": "WON",
    },
    order_by="created_at",
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### next_cursor: `Optional[str]`<a id="next_cursor-optionalstr"></a>

##### page_size: `Optional[int]`<a id="page_size-optionalint"></a>

##### order_dir: [`OrderDirV2Nullable`](./carbon/type/order_dir_v2_nullable.py)<a id="order_dir-orderdirv2nullablecarbontypeorder_dir_v2_nullablepy"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

##### filters: [`OpportunityFilters`](./carbon/type/opportunity_filters.py)<a id="filters-opportunityfilterscarbontypeopportunity_filterspy"></a>


##### order_by: [`OpportunitiesOrderByNullable`](./carbon/type/opportunities_order_by_nullable.py)<a id="order_by-opportunitiesorderbynullablecarbontypeopportunities_order_by_nullablepy"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`OpportunitiesRequest`](./carbon/type/opportunities_request.py)
#### 🔄 Return<a id="🔄-return"></a>

[`OpportunitiesResponse`](./carbon/pydantic/opportunities_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/opportunities` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.crm.get_opportunity`<a id="carboncrmget_opportunity"></a>

Get Opportunity

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_opportunity_response = carbon.crm.get_opportunity(
    id="id_example",
    data_source_id=1,
    include_remote_data=False,
    includes=["string_example"],
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### id: `str`<a id="id-str"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### include_remote_data: `bool`<a id="include_remote_data-bool"></a>

##### includes: List[[`BaseIncludes`](./carbon/type/base_includes.py)]<a id="includes-listbaseincludescarbontypebase_includespy"></a>

#### 🔄 Return<a id="🔄-return"></a>

[`Opportunity`](./carbon/pydantic/opportunity.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/integrations/data/crm/opportunities/{id}` `get`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.data_sources.add_tags`<a id="carbondata_sourcesadd_tags"></a>

Add Data Source Tags

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
add_tags_response = carbon.data_sources.add_tags(
    tags={},
    data_source_id=1,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### tags: `Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]`<a id="tags-dictstr-unionbool-date-datetime-dict-float-int-list-str-none"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`AddDataSourceTagsInput`](./carbon/type/add_data_source_tags_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`OrganizationUserDataSourceAPI`](./carbon/pydantic/organization_user_data_source_api.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/data_sources/tags/add` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.data_sources.query`<a id="carbondata_sourcesquery"></a>

Data Sources

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
query_response = carbon.data_sources.query(
    pagination={
        "limit": 10,
        "offset": 0,
        "starting_id": 0,
    },
    order_by="created_at",
    order_dir="desc",
    filters={
        "source": "GOOGLE_CLOUD_STORAGE",
    },
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### pagination: [`Pagination`](./carbon/type/pagination.py)<a id="pagination-paginationcarbontypepaginationpy"></a>


##### order_by: [`OrganizationUserDataSourceOrderByColumns`](./carbon/type/organization_user_data_source_order_by_columns.py)<a id="order_by-organizationuserdatasourceorderbycolumnscarbontypeorganization_user_data_source_order_by_columnspy"></a>

##### order_dir: [`OrderDir`](./carbon/type/order_dir.py)<a id="order_dir-orderdircarbontypeorder_dirpy"></a>

##### filters: [`OrganizationUserDataSourceFilters`](./carbon/type/organization_user_data_source_filters.py)<a id="filters-organizationuserdatasourcefilterscarbontypeorganization_user_data_source_filterspy"></a>


#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`OrganizationUserDataSourceQueryInput`](./carbon/type/organization_user_data_source_query_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`OrganizationUserDataSourceResponse`](./carbon/pydantic/organization_user_data_source_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/data_sources` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.data_sources.query_user_data_sources`<a id="carbondata_sourcesquery_user_data_sources"></a>

User Data Sources

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
query_user_data_sources_response = carbon.data_sources.query_user_data_sources(
    pagination={
        "limit": 10,
        "offset": 0,
        "starting_id": 0,
    },
    order_by="created_at",
    order_dir="desc",
    filters={
        "source": "GOOGLE_CLOUD_STORAGE",
    },
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### pagination: [`Pagination`](./carbon/type/pagination.py)<a id="pagination-paginationcarbontypepaginationpy"></a>


##### order_by: [`OrganizationUserDataSourceOrderByColumns`](./carbon/type/organization_user_data_source_order_by_columns.py)<a id="order_by-organizationuserdatasourceorderbycolumnscarbontypeorganization_user_data_source_order_by_columnspy"></a>

##### order_dir: [`OrderDir`](./carbon/type/order_dir.py)<a id="order_dir-orderdircarbontypeorder_dirpy"></a>

##### filters: [`OrganizationUserDataSourceFilters`](./carbon/type/organization_user_data_source_filters.py)<a id="filters-organizationuserdatasourcefilterscarbontypeorganization_user_data_source_filterspy"></a>


#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`OrganizationUserDataSourceQueryInput`](./carbon/type/organization_user_data_source_query_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`OrganizationUserDataSourceResponse`](./carbon/pydantic/organization_user_data_source_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/user_data_sources` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.data_sources.remove_tags`<a id="carbondata_sourcesremove_tags"></a>

Remove Data Source Tags

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
remove_tags_response = carbon.data_sources.remove_tags(
    data_source_id=1,
    tags_to_remove=[],
    remove_all_tags=False,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

##### tags_to_remove: [`RemoveDataSourceTagsInputTagsToRemove`](./carbon/type/remove_data_source_tags_input_tags_to_remove.py)<a id="tags_to_remove-removedatasourcetagsinputtagstoremovecarbontyperemove_data_source_tags_input_tags_to_removepy"></a>

##### remove_all_tags: `bool`<a id="remove_all_tags-bool"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`RemoveDataSourceTagsInput`](./carbon/type/remove_data_source_tags_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`OrganizationUserDataSourceAPI`](./carbon/pydantic/organization_user_data_source_api.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/data_sources/tags/remove` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.data_sources.revoke_access_token`<a id="carbondata_sourcesrevoke_access_token"></a>

Revoke Access Token

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
revoke_access_token_response = carbon.data_sources.revoke_access_token(
    data_source_id=1,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### data_source_id: `int`<a id="data_source_id-int"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`RevokeAccessTokenInput`](./carbon/type/revoke_access_token_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`GenericSuccessResponse`](./carbon/pydantic/generic_success_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/revoke_access_token` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.embeddings.get_documents`<a id="carbonembeddingsget_documents"></a>

For pre-filtering documents, using `tags_v2` is preferred to using `tags` (which is now deprecated). If both `tags_v2`
and `tags` are specified, `tags` is ignored. `tags_v2` enables
building complex filters through the use of "AND", "OR", and negation logic. Take the below input as an example:
```json
{
    "OR": [
        {
            "key": "subject",
            "value": "holy-bible",
            "negate": false
        },
        {
            "key": "person-of-interest",
            "value": "jesus christ",
            "negate": false
        },
        {
            "key": "genre",
            "value": "religion",
            "negate": true
        }
        {
            "AND": [
                {
                    "key": "subject",
                    "value": "tao-te-ching",
                    "negate": false
                },
                {
                    "key": "author",
                    "value": "lao-tzu",
                    "negate": false
                }
            ]
        }
    ]
}
```
In this case, files will be filtered such that:
1. "subject" = "holy-bible" OR
2. "person-of-interest" = "jesus christ" OR
3. "genre" != "religion" OR
4. "subject" = "tao-te-ching" AND "author" = "lao-tzu"

Note that the top level of the query must be either an "OR" or "AND" array. Currently, nesting is limited to 3.
For tag blocks (those with "key", "value", and "negate" keys), the following typing rules apply:
1. "key" isn't optional and must be a `string`
2. "value" isn't optional and can be `any` or list[`any`]
3. "negate" is optional and must be `true` or `false`. If present and `true`, then the filter block is negated in
the resulting query. It is `false` by default.


When querying embeddings, you can optionally specify the `media_type` parameter in your request. By default (if
not set), it is equal to "TEXT". This means that the query will be performed over files that have
been parsed as text (for now, this covers all files except image files). If it is equal to "IMAGE",
the query will be performed over image files (for now, `.jpg` and `.png` files). You can think of this
field as an additional filter on top of any filters set in `file_ids` and


When `hybrid_search` is set to true, a combination of keyword search and semantic search are used to rank
and select candidate embeddings during information retrieval. By default, these search methods are weighted
equally during the ranking process. To adjust the weight (or "importance") of each search method, you can use
the `hybrid_search_tuning_parameters` property. The description for the different tuning parameters are:
- `weight_a`: weight to assign to semantic search
- `weight_b`: weight to assign to keyword search

You must ensure that `sum(weight_a, weight_b,..., weight_n)` for all *n* weights is equal to 1. The equality
has an error tolerance of 0.001 to account for possible floating point issues.

In order to use hybrid search for a customer across a set of documents, two flags need to be enabled:
1. Use the `/modify_user_configuration` endpoint to to enable `sparse_vectors` for the customer. The payload
body for this request is below:
```
{
  "configuration_key_name": "sparse_vectors",
  "value": {
    "enabled": true
  }
}
```
2. Make sure hybrid search is enabled for the documents across which you want to perform the search. For the
`/uploadfile` endpoint, this can be done by setting the following query parameter: `generate_sparse_vectors=true`


Carbon supports multiple models for use in generating embeddings for files. For images, we support Vertex AI's
multimodal model; for text, we support OpenAI's `text-embedding-ada-002` and Cohere's embed-multilingual-v3.0.
The model can be specified via the `embedding_model` parameter (in the POST body for `/embeddings`, and a query 
parameter in `/uploadfile`). If no model is supplied, the `text-embedding-ada-002` is used by default. When performing
embedding queries, embeddings from files that used the specified model will be considered in the query.
For example, if files A and B have embeddings generated with `OPENAI`, and files C and D have embeddings generated with
`COHERE_MULTILINGUAL_V3`, then by default, queries will only consider files A and B. If `COHERE_MULTILINGUAL_V3` is
specified as the `embedding_model` in `/embeddings`, then only files C and D will be considered. Make sure that
the set of all files you want considered for a query have embeddings generated via the same model. For now, **do not**
set `VERTEX_MULTIMODAL` as an `embedding_model`. This model is used automatically by Carbon when it detects an image file.

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_documents_response = carbon.embeddings.get_documents(
    query="a",
    k=1,
    tags={
        "key": "string_example",
    },
    query_vector=[3.14],
    file_ids=[1],
    parent_file_ids=[1],
    include_all_children=False,
    tags_v2={},
    include_tags=True,
    include_vectors=True,
    include_raw_file=True,
    hybrid_search=True,
    hybrid_search_tuning_parameters={
        "weight_a": 0.5,
        "weight_b": 0.5,
    },
    media_type="TEXT",
    embedding_model="OPENAI",
    include_file_level_metadata=False,
    high_accuracy=False,
    rerank={
        "model": "model_example",
    },
    file_types_at_source=["string_example"],
    exclude_cold_storage_files=False,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### query: `str`<a id="query-str"></a>

Query for which to get related chunks and embeddings.

##### k: `int`<a id="k-int"></a>

Number of related chunks to return.

##### tags: [`GetEmbeddingDocumentsBodyTags`](./carbon/type/get_embedding_documents_body_tags.py)<a id="tags-getembeddingdocumentsbodytagscarbontypeget_embedding_documents_body_tagspy"></a>

##### query_vector: [`GetEmbeddingDocumentsBodyQueryVector`](./carbon/type/get_embedding_documents_body_query_vector.py)<a id="query_vector-getembeddingdocumentsbodyqueryvectorcarbontypeget_embedding_documents_body_query_vectorpy"></a>

##### file_ids: [`GetEmbeddingDocumentsBodyFileIds`](./carbon/type/get_embedding_documents_body_file_ids.py)<a id="file_ids-getembeddingdocumentsbodyfileidscarbontypeget_embedding_documents_body_file_idspy"></a>

##### parent_file_ids: [`GetEmbeddingDocumentsBodyParentFileIds`](./carbon/type/get_embedding_documents_body_parent_file_ids.py)<a id="parent_file_ids-getembeddingdocumentsbodyparentfileidscarbontypeget_embedding_documents_body_parent_file_idspy"></a>

##### include_all_children: `bool`<a id="include_all_children-bool"></a>

Flag to control whether or not to include all children of filtered files in the embedding search.

##### tags_v2: `Optional[Dict[str, Union[bool, date, datetime, dict, float, int, list, str, None]]]`<a id="tags_v2-optionaldictstr-unionbool-date-datetime-dict-float-int-list-str-none"></a>

A set of tags to limit the search to. Use this instead of `tags`, which is deprecated.

##### include_tags: `Optional[bool]`<a id="include_tags-optionalbool"></a>

Flag to control whether or not to include tags for each chunk in the response.

##### include_vectors: `Optional[bool]`<a id="include_vectors-optionalbool"></a>

Flag to control whether or not to include embedding vectors in the response.

##### include_raw_file: `Optional[bool]`<a id="include_raw_file-optionalbool"></a>

Flag to control whether or not to include a signed URL to the raw file containing each chunk         in the response.

##### hybrid_search: `Optional[bool]`<a id="hybrid_search-optionalbool"></a>

Flag to control whether or not to perform hybrid search.

##### hybrid_search_tuning_parameters: [`HybridSearchTuningParamsNullable`](./carbon/type/hybrid_search_tuning_params_nullable.py)<a id="hybrid_search_tuning_parameters-hybridsearchtuningparamsnullablecarbontypehybrid_search_tuning_params_nullablepy"></a>


##### media_type: [`FileContentTypesNullable`](./carbon/type/file_content_types_nullable.py)<a id="media_type-filecontenttypesnullablecarbontypefile_content_types_nullablepy"></a>

##### embedding_model: [`EmbeddingGeneratorsNullable`](./carbon/type/embedding_generators_nullable.py)<a id="embedding_model-embeddinggeneratorsnullablecarbontypeembedding_generators_nullablepy"></a>

##### include_file_level_metadata: `Optional[bool]`<a id="include_file_level_metadata-optionalbool"></a>

Flag to control whether or not to include file-level metadata in the response. This metadata         will be included in the `content_metadata` field of each document along with chunk/embedding level metadata.

##### high_accuracy: `Optional[bool]`<a id="high_accuracy-optionalbool"></a>

Flag to control whether or not to perform a high accuracy embedding search. By default, this is set to false.         If true, the search may return more accurate results, but may take longer to complete.

##### rerank: [`RerankParamsNullable`](./carbon/type/rerank_params_nullable.py)<a id="rerank-rerankparamsnullablecarbontypererank_params_nullablepy"></a>


##### file_types_at_source: [`GetEmbeddingDocumentsBodyFileTypesAtSource`](./carbon/type/get_embedding_documents_body_file_types_at_source.py)<a id="file_types_at_source-getembeddingdocumentsbodyfiletypesatsourcecarbontypeget_embedding_documents_body_file_types_at_sourcepy"></a>

##### exclude_cold_storage_files: `bool`<a id="exclude_cold_storage_files-bool"></a>

Flag to control whether or not to exclude files that are not in hot storage. If set to False, then an error will be returned if any filtered         files are in cold storage.

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`GetEmbeddingDocumentsBody`](./carbon/type/get_embedding_documents_body.py)
#### 🔄 Return<a id="🔄-return"></a>

[`DocumentResponseList`](./carbon/pydantic/document_response_list.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/embeddings` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.embeddings.get_embeddings_and_chunks`<a id="carbonembeddingsget_embeddings_and_chunks"></a>

Retrieve Embeddings And Content

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
get_embeddings_and_chunks_response = carbon.embeddings.get_embeddings_and_chunks(
    filters={
        "user_file_id": 1,
        "embedding_model": "OPENAI",
    },
    pagination={
        "limit": 10,
        "offset": 0,
        "starting_id": 0,
    },
    order_by="created_at",
    order_dir="desc",
    include_vectors=False,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### filters: [`EmbeddingsAndChunksFilters`](./carbon/type/embeddings_and_chunks_filters.py)<a id="filters-embeddingsandchunksfilterscarbontypeembeddings_and_chunks_filterspy"></a>


##### pagination: [`Pagination`](./carbon/type/pagination.py)<a id="pagination-paginationcarbontypepaginationpy"></a>


##### order_by: [`EmbeddingsAndChunksOrderByColumns`](./carbon/type/embeddings_and_chunks_order_by_columns.py)<a id="order_by-embeddingsandchunksorderbycolumnscarbontypeembeddings_and_chunks_order_by_columnspy"></a>

##### order_dir: [`OrderDir`](./carbon/type/order_dir.py)<a id="order_dir-orderdircarbontypeorder_dirpy"></a>

##### include_vectors: `bool`<a id="include_vectors-bool"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`EmbeddingsAndChunksQueryInput`](./carbon/type/embeddings_and_chunks_query_input.py)
#### 🔄 Return<a id="🔄-return"></a>

[`EmbeddingsAndChunksResponse`](./carbon/pydantic/embeddings_and_chunks_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/text_chunks` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.embeddings.list`<a id="carbonembeddingslist"></a>

Retrieve Embeddings And Content V2

#### 🛠️ Usage<a id="🛠️-usage"></a>

```python
list_response = carbon.embeddings.list(
    filters={
        "include_all_children": False,
        "non_synced_only": False,
    },
    pagination={
        "limit": 10,
        "offset": 0,
        "starting_id": 0,
    },
    order_by="created_at",
    order_dir="desc",
    include_vectors=False,
)
```

#### ⚙️ Parameters<a id="⚙️-parameters"></a>

##### filters: [`OrganizationUserFilesToSyncFilters`](./carbon/type/organization_user_files_to_sync_filters.py)<a id="filters-organizationuserfilestosyncfilterscarbontypeorganization_user_files_to_sync_filterspy"></a>


##### pagination: [`Pagination`](./carbon/type/pagination.py)<a id="pagination-paginationcarbontypepaginationpy"></a>


##### order_by: [`OrganizationUserFilesToSyncOrderByTypes`](./carbon/type/organization_user_files_to_sync_order_by_types.py)<a id="order_by-organizationuserfilestosyncorderbytypescarbontypeorganization_user_files_to_sync_order_by_typespy"></a>

##### order_dir: [`OrderDir`](./carbon/type/order_dir.py)<a id="order_dir-orderdircarbontypeorder_dirpy"></a>

##### include_vectors: `bool`<a id="include_vectors-bool"></a>

#### ⚙️ Request Body<a id="⚙️-request-body"></a>

[`EmbeddingsAndChunksQueryInputV2`](./carbon/type/embeddings_and_chunks_query_input_v2.py)
#### 🔄 Return<a id="🔄-return"></a>

[`EmbeddingsAndChunksResponse`](./carbon/pydantic/embeddings_and_chunks_response.py)

#### 🌐 Endpoint<a id="🌐-endpoint"></a>

`/list_chunks_and_embeddings` `post`

[🔙 **Back to Table of Contents**](#table-of-contents)

---

### `carbon.embeddings.upload_chunks