# ai-index ## ai_index_orgs_users_documents_retrieve - [GET /api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_retrieve.md): Retrieve details of a specific document embedding. This endpoint returns detailed information about a specific document embedding identified by its ID. Args: request: The HTTP request. org: Organization key identifier. document_id: The ID of the document embedding to retrieve. Returns: Response: Detailed information about the document embedding. Raises: NotFound: If the specified document embedding does not exist. ## ai_index_orgs_users_documents_update - [PUT /api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_update.md): Update a specific document embedding. This endpoint allows updating various properties of a document embedding, including its name, type, pathway, and training status. Args: request: The HTTP request containing the updated document data. org: Organization key identifier. document_id: The ID of the document embedding to update. Returns: Response: The updated document embedding information. Raises: BadRequest: If the provided data is invalid. NotFound: If the specified document embedding does not exist. ## ai_index_orgs_users_documents_destroy - [DELETE /api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_destroy.md): Delete a specific document embedding. This endpoint removes a document embedding from the system, including untraining it from any associated pathways. Args: request: The HTTP request. org: Organization key identifier. document_id: The ID of the document embedding to delete. Returns: Response: An empty response with a 204 status code if successful. Raises: NotFound: If the specified document embedding does not exist. ## ai_index_orgs_users_documents_settings_retrieve - [GET /api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/settings/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_settings_retrieve.md): Mixin that includes the StudentTokenAuthentication and IsPlatformAdmin ## ai_index_orgs_users_documents_settings_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/{document_id}/settings/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_settings_create.md): Mixin that includes the StudentTokenAuthentication and IsPlatformAdmin ## ai_index_orgs_users_documents_graph_train_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/graph-train/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_graph_train_create.md): Train a graph-based document through a worker process. This endpoint queues graph-based documents for training through a specialized worker process that handles knowledge graph processing. Args: request: The HTTP request containing the document information. org: Organization key identifier. Returns: Response: A confirmation that the document was queued for training, including a task ID for tracking the progress. Raises: ValidationError: If the request data is invalid. BadRequest: If there was an error processing the document. ## ai_index_orgs_users_documents_pathways_list - [GET /api/ai-index/orgs/{org}/users/{user_id}/documents/pathways/{pathway}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_pathways_list.md): Description: Retrieves a list of document embeddings for a specific pathway with optional search and pagination. Methods: - GET: Retrieves document embeddings that match the specified search criteria and are paginated according to offset and limit. Parameters: - search (str): Search query to filter document names or URLs. - offset (int): Offset number for pagination. - limit (int): Limit number for pagination. Returns: - GET: A paginated list of document embeddings with their details. { "count": 10, "next": "http://api.example.com/retriever_documents/?offset=10&limit=2", "previous": "http://api.example.com/retriever_documents/?offset=0&limit=2", "results": [ { "document_name": "Document2", "platform_key": "example_platform", "pathway": "example_pathway" } ] } Error Responses: - 400 Bad Request: Invalid query parameters. - 404 Not Found: No document embeddings found for the specified criteria. ## ai_index_orgs_users_documents_search_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/search/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_search_create.md): Retrieve resource documents similar to the given query. This endpoint performs a semantic search to find documents that are relevant to the provided query within the specified pathway. Args: request: The HTTP request containing the search query. org: Organization key identifier. Returns: Response: A list of documents relevant to the search query. Raises: ValidationError: If the request data is invalid. ## ai_index_orgs_users_documents_sources_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/sources/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_sources_create.md): Retrieve document sources related to a given query. This endpoint performs a semantic search to find document sources that are relevant to the provided query within the specified pathway, and returns them along with confidence levels. Args: request: The HTTP request containing the search query. org: Organization key identifier. Returns: Response: A list of document sources with confidence levels. Raises: ValidationError: If the request data is invalid. ## ai_index_orgs_users_documents_tasks_retrieve - [GET /api/ai-index/orgs/{org}/users/{user_id}/documents/tasks/{task_id}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_tasks_retrieve.md): Check the status of a document training task. This endpoint retrieves the current status of an asynchronous document training task that was previously initiated. Args: request: The HTTP request. org: Organization key identifier. task_id: The ID of the training task to check. Returns: Response: The current status of the document training task, which can be "pending", "completed", or "failed". ## ai_index_orgs_users_documents_train_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/train/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_train_create.md): Train a document through a worker process. This endpoint queues larger documents for training through a worker process, which is more suitable for handling documents that would take too long to process directly. Args: request: The HTTP request containing the document information. org: Organization key identifier. Returns: Response: A confirmation that the document was queued for training, including a task ID for tracking the progress. Raises: ValidationError: If the request data is invalid. BadRequest: If there was an error processing the document. ## ai_index_orgs_users_documents_train_retriever_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/train/retriever/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_train_retriever_create.md): Train a document directly without using a worker. This endpoint is designed for training smaller documents directly without queuing them through a worker process. For larger documents, use the TrainDocumentView endpoint instead. Args: request: The HTTP request containing the document information. org: Organization key identifier. Returns: Response: A confirmation that the document was trained successfully. Raises: ValidationError: If the request data is invalid. BadRequest: If the document training failed. ## ai_index_orgs_users_documents_train_sessions_create - [POST /api/ai-index/orgs/{org}/users/{user_id}/documents/train/sessions/{session_id}/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_documents_train_sessions_create.md): Description: Submit a document file in a chat session. Checks file type, size, and ensures the session exists, then processes the file. Process document for use in a specific chat session. which will be processed and made available for the AI to reference when responding to queries in that session. Methods: - POST: Submits a document or media file for training within a specified chat session. Parameters: - org (str): - session_id (str): UUID of the chat session for which the document is being submitted. - *kwargs: Additional arguments. - file (file): Multipart file input. Returns: - POST: Returns a JSON message with the result of the upload process. Response code 200 on success. { "message": "File processed." } Error Responses: - 400 Bad Request: - "File field is required" if the 'file' parameter is missing. - "invalid file object" if the file object is not valid. - Specific error message if an exception occurs while saving to Redis. - 404 Not Found: - "Session not found" if the provided session_id does not match any existing session. - 413 Request Entity Too Large: - "file is too large" including specific limits for document and media files if the file exceeds size limits. Access Control: Requires authentication with a Bearer token in the Authorization header. The user associated with the session must exist and be authorized for the request. ## ai_index_orgs_users_resource_data_scrapped_retrieve - [GET /api/ai-index/orgs/{org}/users/{user_id}/resource/{resource_id}/data/scrapped/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_resource_data_scrapped_retrieve.md): Retrieve detailed information about a specific scraped resource. This endpoint returns the complete scraped data for a specific resource identified by its ID. Args: request: The HTTP request. org: Organization key identifier. user_id: The username of the user associated with the resource. resource_id: The ID of the resource to retrieve. Returns: Response: The complete scraped data for the specified resource. Raises: NotFound: If the specified resource data does not exist. ## ai_index_orgs_users_resource_data_scrapped_list - [GET /api/ai-index/orgs/{org}/users/{user_id}/resource/data/scrapped/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_orgs_users_resource_data_scrapped_list.md): Retrieve and filter scraped data from resources. This endpoint returns a list of scraped data from resources associated with the specified user, with optional filtering based on query parameters. Args: request: The HTTP request containing filter query parameters. org: Organization key identifier. user_id: The username of the user whose resources to retrieve. Returns: Response: A list of scraped resource data matching the filter criteria. Raises: BadRequest: If the username is invalid or query parameters are incorrect. ## ai_index_webhook_scan_create - [POST /api/ai-index/webhook/scan/](https://docs.ibl.ai/apis/ibl/ai-index/ai_index_webhook_scan_create.md): Receive and process file scan status from external security scanning services. This webhook endpoint receives scan results for files that have been submitted for security scanning. It processes the results asynchronously and determines if the files are safe for further processing. Args: request: The HTTP request containing scan result data. Returns: Response: A confirmation that the scan result was received and is being processed. Raises: BadRequest: If the provided scan result data is invalid.