- Installation
- Getting Started
-
Reference
carbon.auth.getAccessToken
carbon.auth.getWhiteLabeling
carbon.cRM.getAccount
carbon.cRM.getAccounts
carbon.cRM.getContact
carbon.cRM.getContacts
carbon.cRM.getLead
carbon.cRM.getLeads
carbon.cRM.getOpportunities
carbon.cRM.getOpportunity
carbon.dataSources.addTags
carbon.dataSources.query
carbon.dataSources.queryUserDataSources
carbon.dataSources.removeTags
carbon.dataSources.revokeAccessToken
carbon.embeddings.getDocuments
carbon.embeddings.getEmbeddingsAndChunks
carbon.embeddings.list
carbon.embeddings.uploadChunksAndEmbeddings
carbon.files.createUserFileTags
carbon.files.deleteFileTags
carbon.files.deleteMany
carbon.files.deleteV2
carbon.files.getParsedFile
carbon.files.getRawFile
carbon.files.modifyColdStorageParameters
carbon.files.moveToHotStorage
carbon.files.queryUserFiles
carbon.files.queryUserFilesDeprecated
carbon.files.resync
carbon.files.upload
carbon.files.uploadFromUrl
carbon.files.uploadText
carbon.github.getIssue
carbon.github.getIssues
carbon.github.getPr
carbon.github.getPrComments
carbon.github.getPrCommits
carbon.github.getPrFiles
carbon.github.getPullRequests
carbon.integrations.cancel
carbon.integrations.connectDataSource
carbon.integrations.connectDocument360
carbon.integrations.connectFreshdesk
carbon.integrations.connectGitbook
carbon.integrations.connectGuru
carbon.integrations.createAwsIamUser
carbon.integrations.getOauthUrl
carbon.integrations.listConfluencePages
carbon.integrations.listConversations
carbon.integrations.listDataSourceItems
carbon.integrations.listFolders
carbon.integrations.listGitbookSpaces
carbon.integrations.listLabels
carbon.integrations.listOutlookCategories
carbon.integrations.listRepos
carbon.integrations.listSharepointSites
carbon.integrations.syncAzureBlobFiles
carbon.integrations.syncAzureBlobStorage
carbon.integrations.syncConfluence
carbon.integrations.syncDataSourceItems
carbon.integrations.syncFiles
carbon.integrations.syncGitHub
carbon.integrations.syncGitbook
carbon.integrations.syncGmail
carbon.integrations.syncOutlook
carbon.integrations.syncRepos
carbon.integrations.syncRssFeed
carbon.integrations.syncS3Files
carbon.integrations.syncSlack
carbon.organizations.get
carbon.organizations.update
carbon.organizations.updateStats
carbon.users.delete
carbon.users.get
carbon.users.list
carbon.users.toggleUserFeatures
carbon.users.updateUsers
carbon.users.whoAmI
carbon.utilities.fetchUrls
carbon.utilities.fetchWebpage
carbon.utilities.fetchYoutubeTranscripts
carbon.utilities.processSitemap
carbon.utilities.scrapeSitemap
carbon.utilities.scrapeWeb
carbon.utilities.searchUrls
carbon.utilities.userWebpages
carbon.webhooks.addUrl
carbon.webhooks.deleteUrl
carbon.webhooks.urls
carbon.whiteLabel.create
carbon.whiteLabel.delete
carbon.whiteLabel.list
carbon.whiteLabel.update
npm |
pnpm |
yarn |
---|---|---|
npm i carbon-typescript-sdk |
pnpm i carbon-typescript-sdk |
yarn add carbon-typescript-sdk |
import { Carbon } from "carbon-typescript-sdk";
// Generally this is done in the backend to avoid exposing API key to the client
const carbonWithApiKey = new Carbon({
apiKey: "API_KEY",
customerId: "CUSTOMER_ID",
});
const accessToken = await carbonWithApiKey.auth.getAccessToken();
// Once an access token is obtained, it can be passed to the frontend
// and used to instantiate the SDK client without an API key
const carbon = new Carbon({
accessToken: accessToken.data.access_token,
});
// use SDK as usual
const whiteLabeling = await carbon.auth.getWhiteLabeling();
// etc.
Get Access Token
const getAccessTokenResponse = await carbon.auth.getAccessToken();
/auth/v1/access_token
GET
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
const getWhiteLabelingResponse = await carbon.auth.getWhiteLabeling();
/auth/v1/white_labeling
GET
Get Account
const getAccountResponse = await carbon.cRM.getAccount({
id: "id_example",
dataSourceId: 1,
includeRemoteData: false,
});
includes: BaseIncludes
[]
/integrations/data/crm/accounts/{id}
GET
Get Accounts
const getAccountsResponse = await carbon.cRM.getAccounts({
data_source_id: 1,
include_remote_data: false,
order_dir: "asc",
includes: [],
order_by: "created_at",
});
order_dir: OrderDirV2Nullable
includes: BaseIncludes
[]
filters: AccountFilters
order_by: AccountsOrderByNullable
/integrations/data/crm/accounts
POST
Get Contact
const getContactResponse = await carbon.cRM.getContact({
id: "id_example",
dataSourceId: 1,
includeRemoteData: false,
});
includes: BaseIncludes
[]
/integrations/data/crm/contacts/{id}
GET
Get Contacts
const getContactsResponse = await carbon.cRM.getContacts({
data_source_id: 1,
include_remote_data: false,
order_dir: "asc",
includes: [],
order_by: "created_at",
});
order_dir: OrderDirV2Nullable
includes: BaseIncludes
[]
filters: ContactFilters
order_by: ContactsOrderByNullable
/integrations/data/crm/contacts
POST
Get Lead
const getLeadResponse = await carbon.cRM.getLead({
id: "id_example",
dataSourceId: 1,
includeRemoteData: false,
});
includes: BaseIncludes
[]
/integrations/data/crm/leads/{id}
GET
Get Leads
const getLeadsResponse = await carbon.cRM.getLeads({
data_source_id: 1,
include_remote_data: false,
order_dir: "asc",
includes: [],
order_by: "created_at",
});
order_dir: OrderDirV2Nullable
includes: BaseIncludes
[]
filters: LeadFilters
order_by: LeadsOrderByNullable
/integrations/data/crm/leads
POST
Get Opportunities
const getOpportunitiesResponse = await carbon.cRM.getOpportunities({
data_source_id: 1,
include_remote_data: false,
order_dir: "asc",
includes: [],
order_by: "created_at",
});
order_dir: OrderDirV2Nullable
includes: BaseIncludes
[]
filters: OpportunityFilters
order_by: OpportunitiesOrderByNullable
/integrations/data/crm/opportunities
POST
Get Opportunity
const getOpportunityResponse = await carbon.cRM.getOpportunity({
id: "id_example",
dataSourceId: 1,
includeRemoteData: false,
});
includes: BaseIncludes
[]
/integrations/data/crm/opportunities/{id}
GET
Add Data Source Tags
const addTagsResponse = await carbon.dataSources.addTags({
tags: {},
data_source_id: 1,
});
/data_sources/tags/add
POST
Data Sources
const queryResponse = await carbon.dataSources.query({
order_by: "created_at",
order_dir: "desc",
});
pagination: Pagination
order_by: OrganizationUserDataSourceOrderByColumns
order_dir: OrderDir
filters: OrganizationUserDataSourceFilters
OrganizationUserDataSourceResponse
/data_sources
POST
User Data Sources
const queryUserDataSourcesResponse =
await carbon.dataSources.queryUserDataSources({
order_by: "created_at",
order_dir: "desc",
});
pagination: Pagination
order_by: OrganizationUserDataSourceOrderByColumns
order_dir: OrderDir
filters: OrganizationUserDataSourceFilters
OrganizationUserDataSourceResponse
/user_data_sources
POST
Remove Data Source Tags
const removeTagsResponse = await carbon.dataSources.removeTags({
data_source_id: 1,
tags_to_remove: [],
remove_all_tags: false,
});
/data_sources/tags/remove
POST
Revoke Access Token
const revokeAccessTokenResponse = await carbon.dataSources.revokeAccessToken({
data_source_id: 1,
});
/revoke_access_token
POST
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:
{
"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:
- "subject" = "holy-bible" OR
- "person-of-interest" = "jesus christ" OR
- "genre" != "religion" OR
- "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:
- "key" isn't optional and must be a
string
- "value" isn't optional and can be
any
or list[any
] - "negate" is optional and must be
true
orfalse
. If present andtrue
, then the filter block is negated in the resulting query. It isfalse
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:
- Use the
/modify_user_configuration
endpoint to to enablesparse_vectors
for the customer. The payload body for this request is below:
{
"configuration_key_name": "sparse_vectors",
"value": {
"enabled": true
}
}
- 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.
const getDocumentsResponse = await carbon.embeddings.getDocuments({
query: "query_example",
k: 1,
include_all_children: false,
media_type: "TEXT",
embedding_model: "OPENAI",
include_file_level_metadata: false,
high_accuracy: false,
exclude_cold_storage_files: false,
});
Query for which to get related chunks and embeddings.
Number of related chunks to return.
tags: Record<string, Tags1
>
A set of tags to limit the search to. Deprecated and may be removed in the future.
Optional query vector for which to get related chunks and embeddings. It must have been generated by the same model used to generate the embeddings across which the search is being conducted. Cannot provide both query
and query_vector
.
Optional list of file IDs to limit the search to
Optional list of parent file IDs to limit the search to. A parent file describes a file to which another file belongs (e.g. a folder)
Flag to control whether or not to include all children of filtered files in the embedding search.
A set of tags to limit the search to. Use this instead of tags
, which is deprecated.
Flag to control whether or not to include tags for each chunk in the response.
Flag to control whether or not to include embedding vectors in the response.
Flag to control whether or not to include a signed URL to the raw file containing each chunk in the response.
Flag to control whether or not to perform hybrid search.
hybrid_search_tuning_parameters: HybridSearchTuningParamsNullable
media_type: FileContentTypesNullable
embedding_model: EmbeddingGeneratorsNullable
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.
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
file_types_at_source: AutoSyncedSourceTypesPropertyInner
[]
Filter files based on their type at the source (for example help center tickets and articles)
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.
/embeddings
POST
Retrieve Embeddings And Content
const getEmbeddingsAndChunksResponse =
await carbon.embeddings.getEmbeddingsAndChunks({
order_by: "created_at",
order_dir: "desc",
filters: {
user_file_id: 1,
embedding_model: "OPENAI",
},
include_vectors: false,
});
filters: EmbeddingsAndChunksFilters
pagination: Pagination
order_by: EmbeddingsAndChunksOrderByColumns
order_dir: OrderDir
/text_chunks
POST
Retrieve Embeddings And Content V2
const listResponse = await carbon.embeddings.list({
order_by: "created_at",
order_dir: "desc",
filters: {
include_all_children: false,
non_synced_only: false,
},
include_vectors: false,
});
filters: OrganizationUserFilesToSyncFilters
pagination: Pagination
order_by: OrganizationUserFilesToSyncOrderByTypes
order_dir: OrderDir
/list_chunks_and_embeddings
POST
Upload Chunks And Embeddings
const uploadChunksAndEmbeddingsResponse =
await carbon.embeddings.uploadChunksAndEmbeddings({
embedding_model: "OPENAI",
chunks_and_embeddings: [
{
file_id: 1,
chunks_and_embeddings: [
{
chunk_number: 1,
chunk: "chunk_example",
},
],
},
],
overwrite_existing: false,
chunks_only: false,
});
embedding_model: EmbeddingGenerators
chunks_and_embeddings: SingleChunksAndEmbeddingsUploadInput
[]
/upload_chunks_and_embeddings
POST
A tag is a key-value pair that can be added to a file. This pair can then be used for searches (e.g. embedding searches) in order to narrow down the scope of the search. A file can have any number of tags. The following are reserved keys that cannot be used:
- db_embedding_id
- organization_id
- user_id
- organization_user_file_id
Carbon currently supports two data types for tag values - string
and list<string>
.
Keys can only be string
. If values other than string
and list<string>
are used,
they're automatically converted to strings (e.g. 4 will become "4").
const createUserFileTagsResponse = await carbon.files.createUserFileTags({
tags: {
key: "string_example",
},
organization_user_file_id: 1,
});
tags: Record<string, Tags1
>
/create_user_file_tags
POST
Delete File Tags
const deleteFileTagsResponse = await carbon.files.deleteFileTags({
tags: ["tags_example"],
organization_user_file_id: 1,
});
/delete_user_file_tags
POST
Delete Files Endpoint
const deleteManyResponse = await carbon.files.deleteMany({
delete_non_synced_only: false,
send_webhook: false,
delete_child_files: false,
});
sync_statuses: ExternalFileSyncStatuses
[]
/delete_files
POST
Delete Files V2 Endpoint
const deleteV2Response = await carbon.files.deleteV2({
send_webhook: false,
preserve_file_record: false,
});
filters: OrganizationUserFilesToSyncFilters
Whether or not to delete all data related to the file from the database, BUT to preserve the file metadata, allowing for resyncs. By default preserve_file_record
is false, which means that all data related to the file as well as its metadata will be deleted. Note that even if preserve_file_record
is true, raw files uploaded via the uploadfile
endpoint still cannot be resynced.
/delete_files_v2
POST
This route is deprecated. Use /user_files_v2
instead.
const getParsedFileResponse = await carbon.files.getParsedFile({
fileId: 1,
});
/parsed_file/{file_id}
GET
This route is deprecated. Use /user_files_v2
instead.
const getRawFileResponse = await carbon.files.getRawFile({
fileId: 1,
});
/raw_file/{file_id}
GET
Modify Cold Storage Parameters
const modifyColdStorageParametersResponse =
await carbon.files.modifyColdStorageParameters({});
filters: OrganizationUserFilesToSyncFilters
/modify_cold_storage_parameters
POST
Move To Hot Storage
const moveToHotStorageResponse = await carbon.files.moveToHotStorage({});
filters: OrganizationUserFilesToSyncFilters
/move_to_hot_storage
POST
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:
{
"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:
- "subject" = "holy-bible" OR
- "person-of-interest" = "jesus christ" OR
- "genre" != "religion" OR
- "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:
- "key" isn't optional and must be a
string
- "value" isn't optional and can be
any
or list[any
] - "negate" is optional and must be
true
orfalse
. If present andtrue
, then the filter block is negated in the resulting query. It isfalse
by default.
const queryUserFilesResponse = await carbon.files.queryUserFiles({
order_by: "created_at",
order_dir: "desc",
presigned_url_expiry_time_seconds: 3600,
});
pagination: Pagination
order_by: OrganizationUserFilesToSyncOrderByTypes
order_dir: OrderDir
filters: OrganizationUserFilesToSyncFilters
If true, the query will return presigned URLs for the raw file. Only relevant for the /user_files_v2 endpoint.
If true, the query will return presigned URLs for the parsed text file. Only relevant for the /user_files_v2 endpoint.
If true, the query will return presigned URLs for additional files. Only relevant for the /user_files_v2 endpoint.
The expiry time for the presigned URLs. Only relevant for the /user_files_v2 endpoint.
/user_files_v2
POST
This route is deprecated. Use /user_files_v2
instead.
const queryUserFilesDeprecatedResponse =
await carbon.files.queryUserFilesDeprecated({
order_by: "created_at",
order_dir: "desc",
presigned_url_expiry_time_seconds: 3600,
});
pagination: Pagination
order_by: OrganizationUserFilesToSyncOrderByTypes
order_dir: OrderDir
filters: OrganizationUserFilesToSyncFilters
If true, the query will return presigned URLs for the raw file. Only relevant for the /user_files_v2 endpoint.
If true, the query will return presigned URLs for the parsed text file. Only relevant for the /user_files_v2 endpoint.
If true, the query will return presigned URLs for additional files. Only relevant for the /user_files_v2 endpoint.
The expiry time for the presigned URLs. Only relevant for the /user_files_v2 endpoint.
/user_files
POST
Resync File
const resyncResponse = await carbon.files.resync({
file_id: 1,
force_embedding_generation: false,
skip_file_processing: false,
});
/resync_file
POST
This endpoint is used to directly upload local files to Carbon. The POST
request should be a multipart form request.
Note that the set_page_as_boundary
query parameter is applicable only to PDFs for now. When this value is set,
PDF chunks are at most one page long. Additional information can be retrieved for each chunk, however, namely the coordinates
of the bounding box around the chunk (this can be used for things like text highlighting). Following is a description
of all possible query parameters:
-
chunk_size
: the chunk size (in tokens) applied when splitting the document -
chunk_overlap
: the chunk overlap (in tokens) applied when splitting the document -
skip_embedding_generation
: whether or not to skip the generation of chunks and embeddings -
set_page_as_boundary
: described above -
embedding_model
: the model used to generate embeddings for the document chunks -
use_ocr
: whether or not to use OCR as a preprocessing step prior to generating chunks. Valid for PDFs, JPEGs, and PNGs -
generate_sparse_vectors
: whether or not to generate sparse vectors for the file. Required for hybrid search. -
prepend_filename_to_chunks
: whether or not to prepend the filename to the chunk text
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.
const uploadResponse = await carbon.files.upload({
skipEmbeddingGeneration: false,
setPageAsBoundary: false,
useOcr: false,
generateSparseVectors: false,
prependFilenameToChunks: false,
parsePdfTablesWithOcr: false,
detectAudioLanguage: false,
transcriptionService: "assemblyai",
includeSpeakerLabels: false,
mediaType: "TEXT",
splitRows: false,
enableColdStorage: false,
generateChunksOnly: false,
storeFileOnly: false,
file: fs.readFileSync("/path/to/file"),
});
Chunk size in tiktoken tokens to be used when processing file.
Chunk overlap in tiktoken tokens to be used when processing file.
Flag to control whether or not embeddings should be generated and stored when processing file.
Flag to control whether or not to set the a page's worth of content as the maximum amount of content that can appear in a chunk. Only valid for PDFs. See description route description for more information.
embeddingModel: EmbeddingModel
Embedding model that will be used to embed file chunks.
Whether or not to use OCR when processing files. Valid for PDFs, JPEGs, and PNGs. Useful for documents with tables, images, and/or scanned text.
Whether or not to generate sparse vectors for the file. This is required for the file to be a candidate for hybrid search.
Whether or not to prepend the file's name to chunks.
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
Whether to use rich table parsing when use_ocr
is enabled.
Whether to automatically detect the language of the uploaded audio file.
transcriptionService: TranscriptionServiceNullable
The transcription service to use for audio files. If no service is specified, 'deepgram' will be used.
Detect multiple speakers and label segments of speech by speaker for audio files.
mediaType: FileContentTypesNullable
The media type of the file. If not provided, it will be inferred from the file extension.
Whether to split tabular rows into chunks. Currently only valid for CSV, TSV, and XLSX files.
Enable cold storage for the file. If set to true, the file will be moved to cold storage after a certain period of inactivity. Default is false.
Time in days after which the file will be moved to cold storage. Must be one of [1, 3, 7, 14, 30].
If this flag is enabled, the file will be chunked and stored with Carbon, but no embeddings will be generated. This overrides the skip_embedding_generation flag.
If this flag is enabled, the file will be stored with Carbon, but no processing will be done.
/uploadfile
POST
Create Upload File From Url
const uploadFromUrlResponse = await carbon.files.uploadFromUrl({
url: "url_example",
skip_embedding_generation: false,
set_page_as_boundary: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
use_textract: false,
prepend_filename_to_chunks: false,
parse_pdf_tables_with_ocr: false,
detect_audio_language: false,
transcription_service: "assemblyai",
include_speaker_labels: false,
media_type: "TEXT",
split_rows: false,
generate_chunks_only: false,
store_file_only: false,
});
embedding_model: EmbeddingGenerators
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
transcription_service: TranscriptionServiceNullable
media_type: FileContentTypesNullable
cold_storage_params: ColdStorageProps
If this flag is enabled, the file will be chunked and stored with Carbon, but no embeddings will be generated. This overrides the skip_embedding_generation flag.
If this flag is enabled, the file will be stored with Carbon, but no processing will be done.
/upload_file_from_url
POST
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.
const uploadTextResponse = await carbon.files.uploadText({
contents: "contents_example",
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
generate_chunks_only: false,
store_file_only: false,
});
embedding_model: EmbeddingGeneratorsNullable
cold_storage_params: ColdStorageProps
If this flag is enabled, the file will be chunked and stored with Carbon, but no embeddings will be generated. This overrides the skip_embedding_generation flag.
If this flag is enabled, the file will be stored with Carbon, but no processing will be done.
/upload_text
POST
Issue
const getIssueResponse = await carbon.github.getIssue({
issueNumber: 1,
includeRemoteData: false,
});
/integrations/data/github/issues/{issue_number}
GET
Issues
const getIssuesResponse = await carbon.github.getIssues({
data_source_id: 1,
include_remote_data: false,
repository: "repository_example",
page: 1,
page_size: 30,
order_by: "created",
order_dir: "asc",
});
Full name of the repository, denoted as {owner}/{repo}
filters: IssuesFilter
order_by: IssuesOrderBy
order_dir: OrderDirV2Nullable
/integrations/data/github/issues
POST
Get Pr
const getPrResponse = await carbon.github.getPr({
pullNumber: 1,
includeRemoteData: false,
});
/integrations/data/github/pull_requests/{pull_number}
GET
Pr Comments
const getPrCommentsResponse = await carbon.github.getPrComments({
data_source_id: 1,
include_remote_data: false,
repository: "repository_example",
page: 1,
page_size: 30,
pull_number: 1,
order_by: "created",
order_dir: "asc",
});
Full name of the repository, denoted as {owner}/{repo}
order_by: CommentsOrderBy
order_dir: OrderDirV2Nullable
/integrations/data/github/pull_requests/comments
POST
Pr Commits
const getPrCommitsResponse = await carbon.github.getPrCommits({
data_source_id: 1,
include_remote_data: false,
repository: "repository_example",
page: 1,
page_size: 30,
pull_number: 1,
});
Full name of the repository, denoted as {owner}/{repo}
/integrations/data/github/pull_requests/commits
POST
Pr Files
const getPrFilesResponse = await carbon.github.getPrFiles({
data_source_id: 1,
include_remote_data: false,
repository: "repository_example",
page: 1,
page_size: 30,
pull_number: 1,
});
Full name of the repository, denoted as {owner}/{repo}
/integrations/data/github/pull_requests/files
POST
Get Prs
const getPullRequestsResponse = await carbon.github.getPullRequests({
data_source_id: 1,
include_remote_data: false,
repository: "repository_example",
page: 1,
page_size: 30,
order_by: "created",
order_dir: "asc",
});
Full name of the repository, denoted as {owner}/{repo}
filters: PullRequestFilters
order_by: PROrderBy
order_dir: OrderDirV2Nullable
/integrations/data/github/pull_requests
POST
Cancel Data Source Items Sync
const cancelResponse = await carbon.integrations.cancel({
data_source_id: 1,
});
/integrations/items/sync/cancel
POST
Connect Data Source
const connectDataSourceResponse = await carbon.integrations.connectDataSource({
authentication: {
source: "GOOGLE_DRIVE",
access_token: "access_token_example",
},
});
authentication: AuthenticationProperty
sync_options: SyncOptions
/integrations/connect
POST
You will need an access token to connect your Document360 account. To obtain an access token, follow the steps highlighted here https://apidocs.document360.com/apidocs/api-token.
const connectDocument360Response = await carbon.integrations.connectDocument360(
{
account_email: "account_email_example",
access_token: "access_token_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_files_on_connection: true,
sync_source_items: true,
}
);
This email will be used to identify your carbon data source. It should have access to the Document360 account you wish to connect.
embedding_model: EmbeddingGenerators
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
file_sync_config: FileSyncConfigNullable
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/document360
POST
Refer this article to obtain an API key https://support.freshdesk.com/en/support/solutions/articles/215517. Make sure that your API key has the permission to read solutions from your account and you are on a paid plan. Once you have an API key, you can make a request to this endpoint along with your freshdesk domain. This will trigger an automatic sync of the articles in your "solutions" tab. Additional parameters below can be used to associate data with the synced articles or modify the sync behavior.
const connectFreshdeskResponse = await carbon.integrations.connectFreshdesk({
domain: "domain_example",
api_key: "api_key_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_files_on_connection: true,
sync_source_items: true,
});
embedding_model: EmbeddingGeneratorsNullable
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
file_sync_config: FileSyncConfigNullable
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/freshdesk
POST
You will need an access token to connect your Gitbook account. Note that the permissions will be defined by the user generating access token so make sure you have the permission to access spaces you will be syncing. Refer this article for more details https://developer.gitbook.com/gitbook-api/authentication. Additionally, you need to specify the name of organization you will be syncing data from.
const connectGitbookResponse = await carbon.integrations.connectGitbook({
organization: "organization_example",
access_token: "access_token_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_files_on_connection: true,
sync_source_items: true,
});
embedding_model: EmbeddingGenerators
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
file_sync_config: FileSyncConfigNullable
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/gitbook
POST
You will need an access token to connect your Guru account. To obtain an access token, follow the steps highlighted here https://help.getguru.com/docs/gurus-api#obtaining-a-user-token. The username should be your Guru username.
const connectGuruResponse = await carbon.integrations.connectGuru({
username: "username_example",
access_token: "access_token_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_files_on_connection: true,
sync_source_items: true,
});
embedding_model: EmbeddingGenerators
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
file_sync_config: FileSyncConfigNullable
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/guru
POST
This endpoint can be used to connect S3 as well as Digital Ocean Spaces (S3 compatible)
For S3, create a new IAM user with permissions to:
- List all buckets.
- Read from the specific buckets and objects to sync with Carbon. Ensure any future buckets or objects carry the same permissions.
const createAwsIamUserResponse = await carbon.integrations.createAwsIamUser({
access_key: "access_key_example",
access_key_secret: "access_key_secret_example",
sync_source_items: true,
});
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
You can specify a Digital Ocean endpoint URL to connect a Digital Ocean Space through this endpoint. The URL should be of format .digitaloceanspaces.com. It\'s not required for S3 buckets.
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/s3
POST
This endpoint can be used to generate the following URLs
- An OAuth URL for OAuth based connectors
- A file syncing URL which skips the OAuth flow if the user already has a valid access token and takes them to the success state.
const getOauthUrlResponse = await carbon.integrations.getOauthUrl({
scopes: [],
service: "BOX",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_files_on_connection: true,
set_page_as_boundary: false,
connecting_new_account: false,
use_ocr: false,
parse_pdf_tables_with_ocr: false,
enable_file_picker: true,
sync_source_items: true,
incremental_sync: false,
});
service: OauthBasedConnectors
List of scopes to request from the OAuth provider. Please that the scopes will be used as it is, not combined with the default props that Carbon uses. One scope should be one array element.
embedding_model: EmbeddingGeneratorsNullable
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
Used to specify whether Carbon should attempt to sync all your files automatically when authorization is complete. This is only supported for a subset of connectors and will be ignored for the rest. Supported connectors: Intercom, Zendesk, Gitbook, Confluence, Salesforce, Freshdesk
Used to specify a data source to sync from if you have multiple connected. It can be skipped if you only have one data source of that type connected or are connecting a new account.
Used to connect a new data source. If not specified, we will attempt to create a sync URL for an existing data source based on type and ID.
This request id will be added to all files that get synced using the generated OAuth URL
Enable OCR for files that support it. Supported formats: pdf, png, jpg
Enable integration\'s file picker for sources that support it. Supported sources: BOX, DROPBOX, GOOGLE_DRIVE, ONEDRIVE, SHAREPOINT
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
Only sync files if they have not already been synced or if the embedding properties have changed. This flag is currently supported by ONEDRIVE, GOOGLE_DRIVE, BOX, DROPBOX, INTERCOM, GMAIL, OUTLOOK, ZENDESK, CONFLUENCE, NOTION, SHAREPOINT, SERVICENOW. It will be ignored for other data sources.
file_sync_config: FileSyncConfigNullable
Automatically open source file picker after the OAuth flow is complete. This flag is currently supported by BOX, DROPBOX, GOOGLE_DRIVE, ONEDRIVE, SHAREPOINT. It will be ignored for other data sources.
If you are connecting a Gong account, you need to input the email of the account you wish to connect. This email will be used to identify your carbon data source.
servicenow_credentials: ServiceNowCredentialsNullable
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/oauth_url
POST
This endpoint has been deprecated. Use /integrations/items/list instead.
To begin listing a user's Confluence pages, at least a data_source_id
of a connected
Confluence account must be specified. This base request returns a list of root pages for
every space the user has access to in a Confluence instance. To traverse further down
the user's page directory, additional requests to this endpoint can be made with the same
data_source_id
and with parent_id
set to the id of page from a previous request. For
convenience, the has_children
property in each directory item in the response list will
flag which pages will return non-empty lists of pages when set as the parent_id
.
const listConfluencePagesResponse =
await carbon.integrations.listConfluencePages({
data_source_id: 1,
});
/integrations/confluence/list
POST
List all of your public and private channels, DMs, and Group DMs. The ID from response
can be used as a filter to sync messages to Carbon
types: Comma separated list of types. Available types are im (DMs), mpim (group DMs), public_channel, and private_channel.
Defaults to public_channel.
cursor: Used for pagination. If next_cursor is returned in response, you need to pass it as the cursor in the next request
data_source_id: Data source needs to be specified if you have linked multiple slack accounts
exclude_archived: Should archived conversations be excluded, defaults to true
const listConversationsResponse = await carbon.integrations.listConversations({
types: "public_channel",
excludeArchived: true,
});
/integrations/slack/conversations
GET
List Data Source Items
const listDataSourceItemsResponse =
await carbon.integrations.listDataSourceItems({
data_source_id: 1,
order_by: "name",
order_dir: "asc",
});
filters: ListItemsFiltersNullable
pagination: Pagination
order_by: ExternalSourceItemsOrderBy
order_dir: OrderDirV2
/integrations/items/list
POST
After connecting your Outlook account, you can use this endpoint to list all of your folders on outlook. This includes both system folders like "inbox" and user created folders.
const listFoldersResponse = await carbon.integrations.listFolders({});
/integrations/outlook/user_folders
GET
After connecting your Gitbook account, you can use this endpoint to list all of your spaces under current organization.
const listGitbookSpacesResponse = await carbon.integrations.listGitbookSpaces({
dataSourceId: 1,
});
/integrations/gitbook/spaces
GET
After connecting your Gmail account, you can use this endpoint to list all of your labels. User created labels will have the type "user" and Gmail's default labels will have the type "system"
const listLabelsResponse = await carbon.integrations.listLabels({});
/integrations/gmail/user_labels
GET
After connecting your Outlook account, you can use this endpoint to list all of your categories on outlook. We currently support listing up to 250 categories.
const listOutlookCategoriesResponse =
await carbon.integrations.listOutlookCategories({});
/integrations/outlook/user_categories
GET
Once you have connected your GitHub account, you can use this endpoint to list the repositories your account has access to. You can use a data source ID or username to fetch from a specific account.
const listReposResponse = await carbon.integrations.listRepos({
perPage: 30,
page: 1,
});
/integrations/github/repos
GET
List all Sharepoint sites in the connected tenant. The site names from the response can be used as the site name when connecting a Sharepoint site. If site name is null in the response, then site name should be left null when connecting to the site.
This endpoint requires an additional Sharepoint scope: "Sites.Read.All". Include this scope along with the default Sharepoint scopes to list Sharepoint sites, connect to a site, and finally sync files from the site. The default Sharepoint scopes are: [o, p, e, n, i, d, , o, f, f, l, i, n, e, _, a, c, c, e, s, s, , U, s, e, r, ., R, e, a, d, , F, i, l, e, s, ., R, e, a, d, ., A, l, l].
data_soure_id: Data source needs to be specified if you have linked multiple Sharepoint accounts cursor: Used for pagination. If next_cursor is returned in response, you need to pass it as the cursor in the next request
const listSharepointSitesResponse =
await carbon.integrations.listSharepointSites({});
/integrations/sharepoint/sites/list
GET
After optionally loading the items via /integrations/items/sync and integrations/items/list, use the container name and file name as the ID in this endpoint to sync them into Carbon. Additional parameters below can associate data with the selected items or modify the sync behavior
const syncAzureBlobFilesResponse = await carbon.integrations.syncAzureBlobFiles(
{
ids: [{}],
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
set_page_as_boundary: false,
use_ocr: false,
parse_pdf_tables_with_ocr: false,
}
);
ids: AzureBlobGetFileInput
[]
embedding_model: EmbeddingGenerators
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
file_sync_config: FileSyncConfigNullable
/integrations/azure_blob_storage/files
POST
This endpoint can be used to connect Azure Blob Storage.
For Azure Blob Storage, follow these steps:
- Create a new Azure Storage account and grant the following permissions:
- List containers.
- Read from specific containers and blobs to sync with Carbon. Ensure any future containers or blobs carry the same permissions.
- Generate a shared access signature (SAS) token or an access key for the storage account.
Once created, provide us with the following details to generate the connection URL:
- Storage Account KeyName.
- Storage Account Name.
const syncAzureBlobStorageResponse =
await carbon.integrations.syncAzureBlobStorage({
account_name: "account_name_example",
account_key: "account_key_example",
sync_source_items: true,
});
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/azure_blob_storage
POST
This endpoint has been deprecated. Use /integrations/files/sync instead.
After listing pages in a user's Confluence account, the set of selected page ids
and the
connected account's data_source_id
can be passed into this endpoint to sync them into
Carbon. Additional parameters listed below can be used to associate data to the selected
pages or alter the behavior of the sync.
const syncConfluenceResponse = await carbon.integrations.syncConfluence({
data_source_id: 1,
ids: ["string_example"],
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
set_page_as_boundary: false,
use_ocr: false,
parse_pdf_tables_with_ocr: false,
incremental_sync: false,
});
ids: IdsProperty
embedding_model: EmbeddingGeneratorsNullable
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
Only sync files if they have not already been synced or if the embedding properties have changed. This flag is currently supported by ONEDRIVE, GOOGLE_DRIVE, BOX, DROPBOX, INTERCOM, GMAIL, OUTLOOK, ZENDESK, CONFLUENCE, NOTION, SHAREPOINT, SERVICENOW. It will be ignored for other data sources.
file_sync_config: FileSyncConfigNullable
/integrations/confluence/sync
POST
Sync Data Source Items
const syncDataSourceItemsResponse =
await carbon.integrations.syncDataSourceItems({
data_source_id: 1,
});
/integrations/items/sync
POST
After listing files and folders via /integrations/items/sync and integrations/items/list, use the selected items' external ids as the ids in this endpoint to sync them into Carbon. Sharepoint items take an additional parameter root_id, which identifies the drive the file or folder is in and is stored in root_external_id. That additional paramter is optional and excluding it will tell the sync to assume the item is stored in the default Documents drive.
const syncFilesResponse = await carbon.integrations.syncFiles({
data_source_id: 1,
ids: ["string_example"],
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
set_page_as_boundary: false,
use_ocr: false,
parse_pdf_tables_with_ocr: false,
incremental_sync: false,
});
ids: IdsProperty
embedding_model: EmbeddingGeneratorsNullable
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
Only sync files if they have not already been synced or if the embedding properties have changed. This flag is currently supported by ONEDRIVE, GOOGLE_DRIVE, BOX, DROPBOX, INTERCOM, GMAIL, OUTLOOK, ZENDESK, CONFLUENCE, NOTION, SHAREPOINT, SERVICENOW. It will be ignored for other data sources.
file_sync_config: FileSyncConfigNullable
/integrations/files/sync
POST
Refer this article to obtain an access token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens. Make sure that your access token has the permission to read content from your desired repos. Note that if your access token expires you will need to manually update it through this endpoint.
const syncGitHubResponse = await carbon.integrations.syncGitHub({
username: "username_example",
access_token: "access_token_example",
sync_source_items: false,
});
Enabling this flag will fetch all available content from the source to be listed via list items endpoint
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/github
POST
You can sync upto 20 Gitbook spaces at a time using this endpoint. Additional parameters below can be used to associate data with the synced pages or modify the sync behavior.
const syncGitbookResponse = await carbon.integrations.syncGitbook({
space_ids: ["space_ids_example"],
data_source_id: 1,
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
});
embedding_model: EmbeddingGenerators
file_sync_config: FileSyncConfigNullable
/integrations/gitbook/sync
POST
Once you have successfully connected your gmail account, you can choose which emails to sync with us using the filters parameter. Filters is a JSON object with key value pairs. It also supports AND and OR operations. For now, we support a limited set of keys listed below.
label: Inbuilt Gmail labels, for example "Important" or a custom label you created.
after or before: A date in YYYY/mm/dd format (example 2023/12/31). Gets emails after/before a certain date.
You can also use them in combination to get emails from a certain period.
is: Can have the following values - starred, important, snoozed, and unread
from: Email address of the sender
to: Email address of the recipient
in: Can have the following values - sent (sync emails sent by the user)
has: Can have the following values - attachment (sync emails that have attachments)
Using keys or values outside of the specified values can lead to unexpected behaviour.
An example of a basic query with filters can be
{
"filters": {
"key": "label",
"value": "Test"
}
}
Which will list all emails that have the label "Test".
You can use AND and OR operation in the following way:
{
"filters": {
"AND": [
{
"key": "after",
"value": "2024/01/07"
},
{
"OR": [
{
"key": "label",
"value": "Personal"
},
{
"key": "is",
"value": "starred"
}
]
}
]
}
}
This will return emails after 7th of Jan that are either starred or have the label "Personal". Note that this is the highest level of nesting we support, i.e. you can't add more AND/OR filters within the OR filter in the above example.
const syncGmailResponse = await carbon.integrations.syncGmail({
filters: {},
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_attachments: false,
incremental_sync: false,
});
embedding_model: EmbeddingGenerators
file_sync_config: FileSyncConfigNullable
/integrations/gmail/sync
POST
Once you have successfully connected your Outlook account, you can choose which emails to sync with us
using the filters and folder parameter. "folder" should be the folder you want to sync from Outlook. By default
we get messages from your inbox folder.
Filters is a JSON object with key value pairs. It also supports AND and OR operations.
For now, we support a limited set of keys listed below.
category: Custom categories that you created in Outlook.
after or before: A date in YYYY/mm/dd format (example 2023/12/31). Gets emails after/before a certain date. You can also use them in combination to get emails from a certain period.
is: Can have the following values: flagged
from: Email address of the sender
An example of a basic query with filters can be
{
"filters": {
"key": "category",
"value": "Test"
}
}
Which will list all emails that have the category "Test".
Specifying a custom folder in the same query
{
"folder": "Folder Name",
"filters": {
"key": "category",
"value": "Test"
}
}
You can use AND and OR operation in the following way:
{
"filters": {
"AND": [
{
"key": "after",
"value": "2024/01/07"
},
{
"OR": [
{
"key": "category",
"value": "Personal"
},
{
"key": "category",
"value": "Test"
},
]
}
]
}
}
This will return emails after 7th of Jan that have either Personal or Test as category. Note that this is the highest level of nesting we support, i.e. you can't add more AND/OR filters within the OR filter in the above example.
const syncOutlookResponse = await carbon.integrations.syncOutlook({
folder: "Inbox",
filters: {},
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
sync_attachments: false,
incremental_sync: false,
});
embedding_model: EmbeddingGenerators
file_sync_config: FileSyncConfigNullable
/integrations/outlook/sync
POST
You can retreive repos your token has access to using /integrations/github/repos and sync their content. You can also pass full name of any public repository (username/repo-name). This will store the repo content with carbon which can be accessed through /integrations/items/list endpoint. Maximum of 25 repositories are accepted per request.
const syncReposResponse = await carbon.integrations.syncRepos({
repos: ["repos_example"],
});
/integrations/github/sync_repos
POST
Rss Feed
const syncRssFeedResponse = await carbon.integrations.syncRssFeed({
url: "url_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
});
embedding_model: EmbeddingGenerators
Tags to be associated with the data source. If the data source already has tags set, then an upsert will be performed.
/integrations/rss_feed
POST
After optionally loading the items via /integrations/items/sync and integrations/items/list, use the bucket name and object key as the ID in this endpoint to sync them into Carbon. Additional parameters below can associate data with the selected items or modify the sync behavior
const syncS3FilesResponse = await carbon.integrations.syncS3Files({
ids: [{}],
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
set_page_as_boundary: false,
use_ocr: false,
parse_pdf_tables_with_ocr: false,
});
ids: S3GetFileInput
[]
Each input should be one of the following: A bucket name, a bucket name and a prefix, or a bucket name and an object key. A prefix is the common path for all objects you want to sync. Paths should end with a forward slash.
embedding_model: EmbeddingGenerators
Number of objects per chunk. For csv, tsv, xlsx, and json files only.
file_sync_config: FileSyncConfigNullable
/integrations/s3/files
POST
You can list all conversations using the endpoint /integrations/slack/conversations. The ID of conversation will be used as an input for this endpoint with timestamps as optional filters.
const syncSlackResponse = await carbon.integrations.syncSlack({
filters: {
conversation_id: "conversation_id_example",
},
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
embedding_model: "OPENAI",
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
});
filters: SlackFilters
embedding_model: EmbeddingGenerators
/integrations/slack/sync
POST
Get Organization
const getResponse = await carbon.organizations.get();
/organization
GET
Update Organization
const updateResponse = await carbon.organizations.update({});
global_user_config: UserConfigurationNullable
data_source_configs: Record<string, DataSourceConfiguration
>
Used to set organization level defaults for configuration related to data sources.
/organization/update
POST
Use this endpoint to reaggregate the statistics for an organization, for example aggregate_file_size. The reaggregation process is asyncronous so a webhook will be sent with the event type being FILE_STATISTICS_AGGREGATED to notify when the process is complee. After this aggregation is complete, the updated statistics can be retrieved using the /organization endpoint. The response of /organization willalso contain a timestamp of the last time the statistics were reaggregated.
const updateStatsResponse = await carbon.organizations.updateStats();
/organization/statistics
POST
Delete Users
const deleteResponse = await carbon.users.delete({
customer_ids: ["customer_ids_example"],
});
/delete_users
POST
User Endpoint
const getResponse = await carbon.users.get({
customer_id: "customer_id_example",
});
/user
POST
List users within an organization
const listResponse = await carbon.users.list({
order_by: "created_at",
order_dir: "asc",
include_count: false,
});
pagination: Pagination
filters: ListUsersFilters
order_by: ListUsersOrderByTypes
order_dir: OrderDirV2
/list_users
POST
Toggle User Features
const toggleUserFeaturesResponse = await carbon.users.toggleUserFeatures({
configuration_key_name: "sparse_vectors",
value: {},
});
configuration_key_name: ConfigurationKeys
/modify_user_configuration
POST
Update Users
const updateUsersResponse = await carbon.users.updateUsers({
customer_ids: ["customer_ids_example"],
});
List of organization supplied user IDs
auto_sync_enabled_sources: AutoSyncEnabledSourcesProperty
Custom file upload limit for the user over all user\'s files across all uploads. If set, then the user will not be allowed to upload more files than this limit. If not set, or if set to -1, then the user will have no limit.
Custom file upload limit for the user across a single upload. If set, then the user will not be allowed to upload more files than this limit in a single upload. If not set, or if set to -1, then the user will have no limit.
Custom character upload limit for the user over all user\'s files across all uploads. If set, then the user will not be allowed to upload more characters than this limit. If not set, or if set to -1, then the user will have no limit.
A single file upload from the user can not exceed this character limit. If set, then the file will not be synced if it exceeds this limit. If not set, or if set to -1, then the user will have no limit.
Custom character upload limit for the user across a single upload. If set, then the user won\'t be able to sync more than this many characters in one upload. If not set, or if set to -1, then the user will have no limit.
The interval in hours at which the user\'s data sources should be synced. If not set or set to -1, the user will be synced at the organization level interval or default interval if that is also not set. Must be one of [3, 6, 12, 24]
/update_users
POST
Me Endpoint
const whoAmIResponse = await carbon.users.whoAmI();
/whoami
GET
Extracts all URLs from a webpage.
Args: url (str): URL of the webpage
Returns: FetchURLsResponse: A response object with a list of URLs extracted from the webpage and the webpage content.
const fetchUrlsResponse = await carbon.utilities.fetchUrls({
url: "url_example",
});
/fetch_urls
GET
Fetch Urls V2
const fetchWebpageResponse = await carbon.utilities.fetchWebpage({
url: "url_example",
});
/fetch_webpage
POST
Fetches english transcripts from YouTube videos.
Args: id (str): The ID of the YouTube video. raw (bool): Whether to return the raw transcript or not. Defaults to False.
Returns: dict: A dictionary with the transcript of the YouTube video.
const fetchYoutubeTranscriptsResponse =
await carbon.utilities.fetchYoutubeTranscripts({
id: "id_example",
raw: false,
});
/fetch_youtube_transcript
GET
Retrieves all URLs from a sitemap, which can subsequently be utilized with our web_scrape
endpoint.
const processSitemapResponse = await carbon.utilities.processSitemap({
url: "url_example",
});
/process_sitemap
GET
Extracts all URLs from a sitemap and performs a web scrape on each of them.
Args: sitemap_url (str): URL of the sitemap
Returns: dict: A response object with the status of the scraping job message.-->
const scrapeSitemapResponse = await carbon.utilities.scrapeSitemap({
url: "url_example",
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
enable_auto_sync: false,
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
html_tags_to_skip: [],
css_classes_to_skip: [],
css_selectors_to_skip: [],
embedding_model: "OPENAI",
url_paths_to_include: [],
url_paths_to_exclude: [],
urls_to_scrape: [],
download_css_and_media: false,
generate_chunks_only: false,
store_file_only: false,
use_premium_proxies: false,
});
tags: Record<string, Tags1
>
embedding_model: EmbeddingGenerators
URL subpaths or directories that you want to include. For example if you want to only include URLs that start with /questions in stackoverflow.com, you will add /questions/ in this input
URL subpaths or directories that you want to exclude. For example if you want to exclude URLs that start with /questions in stackoverflow.com, you will add /questions/ in this input
You can submit a subset of URLs from the sitemap that should be scraped. To get the list of URLs, you can check out /process_sitemap endpoint. If left empty, all URLs from the sitemap will be scraped.
Whether the scraper should download css and media from the page (images, fonts, etc). Scrapes might take longer to finish with this flag enabled, but the success rate is improved.
If this flag is enabled, the file will be chunked and stored with Carbon, but no embeddings will be generated. This overrides the skip_embedding_generation flag.
If this flag is enabled, the file will be stored with Carbon, but no processing will be done.
If the default proxies are blocked and not returning results, this flag can be enabled to use alternate proxies (residential and office). Scrapes might take longer to finish with this flag enabled.
/scrape_sitemap
POST
Conduct a web scrape on a given webpage URL. Our web scraper is fully compatible with JavaScript and supports recursion depth, enabling you to efficiently extract all content from the target website.
const scrapeWebResponse = await carbon.utilities.scrapeWeb([
{
url: "url_example",
recursion_depth: 3,
max_pages_to_scrape: 100,
chunk_size: 1500,
chunk_overlap: 20,
skip_embedding_generation: false,
enable_auto_sync: false,
generate_sparse_vectors: false,
prepend_filename_to_chunks: false,
html_tags_to_skip: [],
css_classes_to_skip: [],
css_selectors_to_skip: [],
embedding_model: "OPENAI",
url_paths_to_include: [],
download_css_and_media: false,
generate_chunks_only: false,
store_file_only: false,
use_premium_proxies: false,
},
]);
/web_scrape
POST
Perform a web search and obtain a list of relevant URLs.
As an illustration, when you perform a search for “content related to MRNA,” you will receive a list of links such as the following:
- https://tomrenz.substack.com/p/mrna-and-why-it-matters
- https://www.statnews.com/2020/11/10/the-story-of-mrna-how-a-once-dismissed-idea-became-a-leading-technology-in-the-covid-vaccine-race/
- https://www.statnews.com/2022/11/16/covid-19-vaccines-were-a-success-but-mrna-still-has-a-delivery-problem/
- https://joomi.substack.com/p/were-still-being-misled-about-how
Subsequently, you can submit these links to the web_scrape endpoint in order to retrieve the content of the respective web pages.
Args: query (str): Query to search for
Returns: FetchURLsResponse: A response object with a list of URLs for a given search query.
const searchUrlsResponse = await carbon.utilities.searchUrls({
query: "query_example",
});
/search_urls
GET
User Web Pages
const userWebpagesResponse = await carbon.utilities.userWebpages({
order_by: "created_at",
order_dir: "asc",
});
filters: UserWebPagesFilters
pagination: Pagination
order_by: UserWebPageOrderByTypes
order_dir: OrderDirV2
/user_webpages
POST
Add Webhook Url
const addUrlResponse = await carbon.webhooks.addUrl({
url: "url_example",
});
/add_webhook
POST
Delete Webhook Url
const deleteUrlResponse = await carbon.webhooks.deleteUrl({
webhookId: 1,
});
/delete_webhook/{webhook_id}
DELETE
Webhook Urls
const urlsResponse = await carbon.webhooks.urls({
order_by: "created_at",
order_dir: "desc",
});
pagination: Pagination
order_by: WebhookOrderByColumns
order_dir: OrderDir
filters: WebhookFilters
/webhooks
POST
Create White Labels
const createResponse = await carbon.whiteLabel.create([
{
data_source_type: "GOOGLE_DRIVE",
credentials: {
client_id: "client_id_example",
redirect_uri: "redirect_uri_example",
},
},
]);
WhiteLabelCreateRequestInner
[]
/white_label/create
POST
Delete White Labels
const deleteResponse = await carbon.whiteLabel.delete({
ids: [1],
});
/white_label/delete
POST
List White Labels
const listResponse = await carbon.whiteLabel.list({
order_by: "created_at",
order_dir: "desc",
});
pagination: Pagination
order_by: WhiteLabelOrderByColumns
order_dir: OrderDir
filters: WhiteLabelFilters
/white_label/list
POST
Update White Label
const updateResponse = await carbon.whiteLabel.update({
data_source_type: "GOOGLE_DRIVE",
credentials: {
client_id: "client_id_example",
redirect_uri: "redirect_uri_example",
},
});
credentials: Credentials
/white_label/update
POST
This TypeScript package is automatically generated by Konfig