# Indexing Jobs ## Create `client.knowledgeBases.indexingJobs.create(IndexingJobCreateParamsbody?, RequestOptionsoptions?): IndexingJobCreateResponse` **post** `/v2/gen-ai/indexing_jobs` To start an indexing job for a knowledge base, send a POST request to `/v2/gen-ai/indexing_jobs`. ### Parameters - `body: IndexingJobCreateParams` - `data_source_uuids?: Array` List of data source ids to index, if none are provided, all data sources will be indexed - `knowledge_base_uuid?: string` Knowledge base id ### Returns - `IndexingJobCreateResponse` StartKnowledgeBaseIndexingJobOutput description - `job?: APIIndexingJob` IndexingJob description - `completed_datasources?: number` Number of datasources indexed completed - `created_at?: string` Creation date / time - `data_source_uuids?: Array` - `finished_at?: string` - `knowledge_base_uuid?: string` Knowledge base id - `phase?: "BATCH_JOB_PHASE_UNKNOWN" | "BATCH_JOB_PHASE_PENDING" | "BATCH_JOB_PHASE_RUNNING" | 4 more` - `"BATCH_JOB_PHASE_UNKNOWN"` - `"BATCH_JOB_PHASE_PENDING"` - `"BATCH_JOB_PHASE_RUNNING"` - `"BATCH_JOB_PHASE_SUCCEEDED"` - `"BATCH_JOB_PHASE_FAILED"` - `"BATCH_JOB_PHASE_ERROR"` - `"BATCH_JOB_PHASE_CANCELLED"` - `started_at?: string` - `status?: "INDEX_JOB_STATUS_UNKNOWN" | "INDEX_JOB_STATUS_PARTIAL" | "INDEX_JOB_STATUS_IN_PROGRESS" | 4 more` - `"INDEX_JOB_STATUS_UNKNOWN"` - `"INDEX_JOB_STATUS_PARTIAL"` - `"INDEX_JOB_STATUS_IN_PROGRESS"` - `"INDEX_JOB_STATUS_COMPLETED"` - `"INDEX_JOB_STATUS_FAILED"` - `"INDEX_JOB_STATUS_NO_CHANGES"` - `"INDEX_JOB_STATUS_PENDING"` - `tokens?: number` Number of tokens - `total_datasources?: number` Number of datasources being indexed - `total_items_failed?: string` Total Items Failed - `total_items_indexed?: string` Total Items Indexed - `total_items_skipped?: string` Total Items Skipped - `updated_at?: string` Last modified - `uuid?: string` Unique id ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const indexingJob = await client.knowledgeBases.indexingJobs.create(); console.log(indexingJob.job); ``` ## Retrieve `client.knowledgeBases.indexingJobs.retrieve(stringuuid, RequestOptionsoptions?): IndexingJobRetrieveResponse` **get** `/v2/gen-ai/indexing_jobs/{uuid}` To get status of an indexing Job for a knowledge base, send a GET request to `/v2/gen-ai/indexing_jobs/{uuid}`. ### Parameters - `uuid: string` ### Returns - `IndexingJobRetrieveResponse` GetKnowledgeBaseIndexingJobOutput description - `job?: APIIndexingJob` IndexingJob description - `completed_datasources?: number` Number of datasources indexed completed - `created_at?: string` Creation date / time - `data_source_uuids?: Array` - `finished_at?: string` - `knowledge_base_uuid?: string` Knowledge base id - `phase?: "BATCH_JOB_PHASE_UNKNOWN" | "BATCH_JOB_PHASE_PENDING" | "BATCH_JOB_PHASE_RUNNING" | 4 more` - `"BATCH_JOB_PHASE_UNKNOWN"` - `"BATCH_JOB_PHASE_PENDING"` - `"BATCH_JOB_PHASE_RUNNING"` - `"BATCH_JOB_PHASE_SUCCEEDED"` - `"BATCH_JOB_PHASE_FAILED"` - `"BATCH_JOB_PHASE_ERROR"` - `"BATCH_JOB_PHASE_CANCELLED"` - `started_at?: string` - `status?: "INDEX_JOB_STATUS_UNKNOWN" | "INDEX_JOB_STATUS_PARTIAL" | "INDEX_JOB_STATUS_IN_PROGRESS" | 4 more` - `"INDEX_JOB_STATUS_UNKNOWN"` - `"INDEX_JOB_STATUS_PARTIAL"` - `"INDEX_JOB_STATUS_IN_PROGRESS"` - `"INDEX_JOB_STATUS_COMPLETED"` - `"INDEX_JOB_STATUS_FAILED"` - `"INDEX_JOB_STATUS_NO_CHANGES"` - `"INDEX_JOB_STATUS_PENDING"` - `tokens?: number` Number of tokens - `total_datasources?: number` Number of datasources being indexed - `total_items_failed?: string` Total Items Failed - `total_items_indexed?: string` Total Items Indexed - `total_items_skipped?: string` Total Items Skipped - `updated_at?: string` Last modified - `uuid?: string` Unique id ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const indexingJob = await client.knowledgeBases.indexingJobs.retrieve( '"123e4567-e89b-12d3-a456-426614174000"', ); console.log(indexingJob.job); ``` ## List `client.knowledgeBases.indexingJobs.list(IndexingJobListParamsquery?, RequestOptionsoptions?): IndexingJobListResponse` **get** `/v2/gen-ai/indexing_jobs` To list all indexing jobs for a knowledge base, send a GET request to `/v2/gen-ai/indexing_jobs`. ### Parameters - `query: IndexingJobListParams` - `page?: number` Page number. - `per_page?: number` Items per page. ### Returns - `IndexingJobListResponse` Indexing jobs - `jobs?: Array` The indexing jobs - `completed_datasources?: number` Number of datasources indexed completed - `created_at?: string` Creation date / time - `data_source_uuids?: Array` - `finished_at?: string` - `knowledge_base_uuid?: string` Knowledge base id - `phase?: "BATCH_JOB_PHASE_UNKNOWN" | "BATCH_JOB_PHASE_PENDING" | "BATCH_JOB_PHASE_RUNNING" | 4 more` - `"BATCH_JOB_PHASE_UNKNOWN"` - `"BATCH_JOB_PHASE_PENDING"` - `"BATCH_JOB_PHASE_RUNNING"` - `"BATCH_JOB_PHASE_SUCCEEDED"` - `"BATCH_JOB_PHASE_FAILED"` - `"BATCH_JOB_PHASE_ERROR"` - `"BATCH_JOB_PHASE_CANCELLED"` - `started_at?: string` - `status?: "INDEX_JOB_STATUS_UNKNOWN" | "INDEX_JOB_STATUS_PARTIAL" | "INDEX_JOB_STATUS_IN_PROGRESS" | 4 more` - `"INDEX_JOB_STATUS_UNKNOWN"` - `"INDEX_JOB_STATUS_PARTIAL"` - `"INDEX_JOB_STATUS_IN_PROGRESS"` - `"INDEX_JOB_STATUS_COMPLETED"` - `"INDEX_JOB_STATUS_FAILED"` - `"INDEX_JOB_STATUS_NO_CHANGES"` - `"INDEX_JOB_STATUS_PENDING"` - `tokens?: number` Number of tokens - `total_datasources?: number` Number of datasources being indexed - `total_items_failed?: string` Total Items Failed - `total_items_indexed?: string` Total Items Indexed - `total_items_skipped?: string` Total Items Skipped - `updated_at?: string` Last modified - `uuid?: string` Unique id - `links?: APILinks` Links to other pages - `pages?: Pages` Information about how to reach other pages - `first?: string` First page - `last?: string` Last page - `next?: string` Next page - `previous?: string` Previous page - `meta?: APIMeta` Meta information about the data set - `page?: number` The current page - `pages?: number` Total number of pages - `total?: number` Total amount of items over all pages ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const indexingJobs = await client.knowledgeBases.indexingJobs.list(); console.log(indexingJobs.jobs); ``` ## Retrieve Data Sources `client.knowledgeBases.indexingJobs.retrieveDataSources(stringindexingJobUuid, RequestOptionsoptions?): IndexingJobRetrieveDataSourcesResponse` **get** `/v2/gen-ai/indexing_jobs/{indexing_job_uuid}/data_sources` To list all datasources for an indexing job, send a GET request to `/v2/gen-ai/indexing_jobs/{indexing_job_uuid}/data_sources`. ### Parameters - `indexingJobUuid: string` ### Returns - `IndexingJobRetrieveDataSourcesResponse` - `indexed_data_sources?: Array` - `completed_at?: string` Timestamp when data source completed indexing - `data_source_uuid?: string` Uuid of the indexed data source - `error_details?: string` A detailed error description - `error_msg?: string` A string code provinding a hint which part of the system experienced an error - `failed_item_count?: string` Total count of files that have failed - `indexed_file_count?: string` Total count of files that have been indexed - `indexed_item_count?: string` Total count of files that have been indexed - `removed_item_count?: string` Total count of files that have been removed - `skipped_item_count?: string` Total count of files that have been skipped - `started_at?: string` Timestamp when data source started indexing - `status?: "DATA_SOURCE_STATUS_UNKNOWN" | "DATA_SOURCE_STATUS_IN_PROGRESS" | "DATA_SOURCE_STATUS_UPDATED" | 3 more` - `"DATA_SOURCE_STATUS_UNKNOWN"` - `"DATA_SOURCE_STATUS_IN_PROGRESS"` - `"DATA_SOURCE_STATUS_UPDATED"` - `"DATA_SOURCE_STATUS_PARTIALLY_UPDATED"` - `"DATA_SOURCE_STATUS_NOT_UPDATED"` - `"DATA_SOURCE_STATUS_FAILED"` - `total_bytes?: string` Total size of files in data source in bytes - `total_bytes_indexed?: string` Total size of files in data source in bytes that have been indexed - `total_file_count?: string` Total file count in the data source ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const response = await client.knowledgeBases.indexingJobs.retrieveDataSources( '"123e4567-e89b-12d3-a456-426614174000"', ); console.log(response.indexed_data_sources); ``` ## Update Cancel `client.knowledgeBases.indexingJobs.updateCancel(stringpathUuid, IndexingJobUpdateCancelParamsbody?, RequestOptionsoptions?): IndexingJobUpdateCancelResponse` **put** `/v2/gen-ai/indexing_jobs/{uuid}/cancel` To cancel an indexing job for a knowledge base, send a PUT request to `/v2/gen-ai/indexing_jobs/{uuid}/cancel`. ### Parameters - `pathUuid: string` - `body: IndexingJobUpdateCancelParams` - `body_uuid?: string` A unique identifier for an indexing job. ### Returns - `IndexingJobUpdateCancelResponse` CancelKnowledgeBaseIndexingJobOutput description - `job?: APIIndexingJob` IndexingJob description - `completed_datasources?: number` Number of datasources indexed completed - `created_at?: string` Creation date / time - `data_source_uuids?: Array` - `finished_at?: string` - `knowledge_base_uuid?: string` Knowledge base id - `phase?: "BATCH_JOB_PHASE_UNKNOWN" | "BATCH_JOB_PHASE_PENDING" | "BATCH_JOB_PHASE_RUNNING" | 4 more` - `"BATCH_JOB_PHASE_UNKNOWN"` - `"BATCH_JOB_PHASE_PENDING"` - `"BATCH_JOB_PHASE_RUNNING"` - `"BATCH_JOB_PHASE_SUCCEEDED"` - `"BATCH_JOB_PHASE_FAILED"` - `"BATCH_JOB_PHASE_ERROR"` - `"BATCH_JOB_PHASE_CANCELLED"` - `started_at?: string` - `status?: "INDEX_JOB_STATUS_UNKNOWN" | "INDEX_JOB_STATUS_PARTIAL" | "INDEX_JOB_STATUS_IN_PROGRESS" | 4 more` - `"INDEX_JOB_STATUS_UNKNOWN"` - `"INDEX_JOB_STATUS_PARTIAL"` - `"INDEX_JOB_STATUS_IN_PROGRESS"` - `"INDEX_JOB_STATUS_COMPLETED"` - `"INDEX_JOB_STATUS_FAILED"` - `"INDEX_JOB_STATUS_NO_CHANGES"` - `"INDEX_JOB_STATUS_PENDING"` - `tokens?: number` Number of tokens - `total_datasources?: number` Number of datasources being indexed - `total_items_failed?: string` Total Items Failed - `total_items_indexed?: string` Total Items Indexed - `total_items_skipped?: string` Total Items Skipped - `updated_at?: string` Last modified - `uuid?: string` Unique id ### Example ```typescript import Gradient from '@digitalocean/gradient'; const client = new Gradient(); const response = await client.knowledgeBases.indexingJobs.updateCancel( '"123e4567-e89b-12d3-a456-426614174000"', ); console.log(response.job); ``` ## Domain Types ### API Indexed Data Source - `APIIndexedDataSource` - `completed_at?: string` Timestamp when data source completed indexing - `data_source_uuid?: string` Uuid of the indexed data source - `error_details?: string` A detailed error description - `error_msg?: string` A string code provinding a hint which part of the system experienced an error - `failed_item_count?: string` Total count of files that have failed - `indexed_file_count?: string` Total count of files that have been indexed - `indexed_item_count?: string` Total count of files that have been indexed - `removed_item_count?: string` Total count of files that have been removed - `skipped_item_count?: string` Total count of files that have been skipped - `started_at?: string` Timestamp when data source started indexing - `status?: "DATA_SOURCE_STATUS_UNKNOWN" | "DATA_SOURCE_STATUS_IN_PROGRESS" | "DATA_SOURCE_STATUS_UPDATED" | 3 more` - `"DATA_SOURCE_STATUS_UNKNOWN"` - `"DATA_SOURCE_STATUS_IN_PROGRESS"` - `"DATA_SOURCE_STATUS_UPDATED"` - `"DATA_SOURCE_STATUS_PARTIALLY_UPDATED"` - `"DATA_SOURCE_STATUS_NOT_UPDATED"` - `"DATA_SOURCE_STATUS_FAILED"` - `total_bytes?: string` Total size of files in data source in bytes - `total_bytes_indexed?: string` Total size of files in data source in bytes that have been indexed - `total_file_count?: string` Total file count in the data source ### API Indexing Job - `APIIndexingJob` IndexingJob description - `completed_datasources?: number` Number of datasources indexed completed - `created_at?: string` Creation date / time - `data_source_uuids?: Array` - `finished_at?: string` - `knowledge_base_uuid?: string` Knowledge base id - `phase?: "BATCH_JOB_PHASE_UNKNOWN" | "BATCH_JOB_PHASE_PENDING" | "BATCH_JOB_PHASE_RUNNING" | 4 more` - `"BATCH_JOB_PHASE_UNKNOWN"` - `"BATCH_JOB_PHASE_PENDING"` - `"BATCH_JOB_PHASE_RUNNING"` - `"BATCH_JOB_PHASE_SUCCEEDED"` - `"BATCH_JOB_PHASE_FAILED"` - `"BATCH_JOB_PHASE_ERROR"` - `"BATCH_JOB_PHASE_CANCELLED"` - `started_at?: string` - `status?: "INDEX_JOB_STATUS_UNKNOWN" | "INDEX_JOB_STATUS_PARTIAL" | "INDEX_JOB_STATUS_IN_PROGRESS" | 4 more` - `"INDEX_JOB_STATUS_UNKNOWN"` - `"INDEX_JOB_STATUS_PARTIAL"` - `"INDEX_JOB_STATUS_IN_PROGRESS"` - `"INDEX_JOB_STATUS_COMPLETED"` - `"INDEX_JOB_STATUS_FAILED"` - `"INDEX_JOB_STATUS_NO_CHANGES"` - `"INDEX_JOB_STATUS_PENDING"` - `tokens?: number` Number of tokens - `total_datasources?: number` Number of datasources being indexed - `total_items_failed?: string` Total Items Failed - `total_items_indexed?: string` Total Items Indexed - `total_items_skipped?: string` Total Items Skipped - `updated_at?: string` Last modified - `uuid?: string` Unique id