NewRA APIs
Welcome to the API documentation for Newra.ai! This resource is designed to help developers seamlessly integrate and interact with our powerful AI-driven services. Here, you will find detailed information on how to authenticate your requests, utilize various endpoints, and leverage the full capabilities of our API. Whether you're building applications, automating workflows, or enhancing user experiences, our API provides the tools you need to harness the potential of artificial intelligence effectively.
Steps for Authenticating Requests
To ensure secure access to our API, it is essential to authenticate your requests properly. Follow the guidelines below for effective authentication:
Authorization Token/Key:
-
Account-Level API Key:
- Description:
- To create a knowledge base and list all knowledge base, an account-level API key is required.
- Obtain this key from your account settings page: Account-Level API Key.
- Add an authorization header in your API requests with the value
{YOUR_AUTH_KEY}generated from the Account-Level API Key.
- Required: Yes
- In: Header
- Description:
-
Knowledge Base Level API Key:
- Description:
- To manage the knowledge base, datasources, and chat functionality effectively, a knowledgebase-level API key is required.
- Ensure the generated token includes the following permission scopes:
- Knowledgebase (all permissions):
- Delete
- View
- Update
- Datasource (all permissions):
- List
- Create
- Delete
- View
- Update
- Sync
- Train
- Knowledgebase (all permissions):
- Obtain this key by adding the permission from your particular Knowledge Base setting section.
- Scroll to Knowledge Base Tokens: https://app.newra.ai/knowledgebases/<KB_ID>/settings.
- Add an authorization header in your API requests with the value
{YOUR_AUTH_KEY}generated from the Knowledge Base Level API Key. - Required: Yes
- In: Header
- Description:
-
App Level API Key:
- Description:
- Create an API key that is restricted to chat API usage through third-party integrations.
- Generate this key from the Apps module Share tab by clicking on API Token: https://app.newra.ai/apps/share/<APP_ID>.
- Required: Yes
- In: Header
- Description:
https://app.newra.ai/api/v1Knowledge Base API
Create a Knowledge Base
Creates a new knowledge base for the account.
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
titlestring
descriptionstringoptionaliconstringoptional
Responses
iduuiduser_idintegericonstringtitlestringslugstringdescriptionstringdeleted_atnullcreated_atstringis_activeboolean
Get Knowledge Base By ID
Returns a specific knowledge base associated with the account.
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Responses
iduuiduser_idintegericonstringtitlestringslugstringdescriptionstringdeleted_atnullcreated_atstringis_activebooleannamespacestringuserobject[]settingsobject[]
Update Knowledge Base
Updates a specific Knowledge Base
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
titlestring
descriptionstringoptionaliconstringoptional
Responses
iduuiduser_idintegericonstringtitlestringslugstringdescriptionstringdeleted_atnullcreated_atstringis_activeboolean
Datasource API
List Data Sources
Returns a list of Data Sources for a specific Knowledge Base
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
query Parameters
page_limitintegerLimit of items to return per page
pageintegerPage number to return
Headers
content-typerequiredstringauthorizationrequiredstring
Responses
dataobject[]linksobjectmetaobject
Get Data Source By ID
Returns a specific Data Source for a specific Knowledge Base
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
data_source_idrequiredstringID of the Datasource of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Responses
iduuidknowledge_base_iduuiduser_idintegertypestringtitlestringparagraphstringscrap_all_urlbooleanurlstringexcluded_urlsstring|nullreference_urlstringsizeinteger|nullestimated_tokensintegerstatusstringis_content_fetchedbooleanlast_sync_datestringdeleted_atnullcreated_atstringupdated_atstringcustom_titlestring
Webscrapping API
Create Scrape URLs
Creates a new Web Scraping Data Source using urls for a specific Knowledge Base
Supported document are
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
source_urlstring
Responses
iduuidknowledge_base_iduuiduser_idintegertypestringtitlestringparagraphstringscrap_all_urlbooleanurlstringexcluded_urlsstring|nullreference_urlstringsizeinteger|nullestimated_tokensintegerstatusstringis_content_fetchedbooleanlast_sync_datestringdeleted_atnullcreated_atstringupdated_atstringcustom_titlestring
Create Whole Domain Datasource
Creates a new Web Scraping Data Source using entire domain for a specific Knowledge Base.
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
domainstring
excluded_urlsstring[]optional
Responses
messagestringsuccessbooleanstatusstringoptional
Document Upload API
Create Document Datasource
Creates a new Datasource by uploading document for a specific Knowledge Base
Supported document types: PDF, CSV, TXT
Read Before You Upload
- File Formats: Please ensure the files are in an accepted format for successful conversion.
- File Size: Larger files might take more time to upload and process. Confirm your file sizes are manageable.
- Content: Ensure your files are free of errors to avoid conversion issues. Images in the file content will be ignored.
- Data Privacy: We respect your data privacy. Your files will be used only for conversion purposes and will not be stored without your consent.
By uploading files, you agree to these terms and understand the processing requirements. Please ensure that your files meet the stated requirements for a smooth conversion process.
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
documentfile
Responses
iduuidknowledge_base_iduuiduser_idintegertypestringtitlestringparagraphstringscrap_all_urlbooleanurlstringexcluded_urlsstring|nullreference_urlstringsizeinteger|nullestimated_tokensintegerstatusstringis_content_fetchedbooleanlast_sync_datestringdeleted_atnullcreated_atstringupdated_atstringcustom_titlestring
Create TextScrapping DataSource
Creates a new Datasource by providing text content for a specific Knowledge Base
Read Before You Upload
- Content: Ensure your text content is free of errors to avoid conversion issues.
- Data Privacy: We respect your data privacy. Your text content will be used only for conversion purposes and will not be stored without your consent.
By providing text content, you agree to these terms and understand the processing requirements. Please ensure that your text content meets the stated requirements for a smooth conversion process.
path Parameters
idrequiredstringID of the Knowledge Base (required for all requests)
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
titlestringparagraphstring
Responses
iduuidknowledge_base_iduuiduser_idintegertypestringtitlestringparagraphstringscrap_all_urlbooleanurlstringexcluded_urlsstring|nullreference_urlstringsizeinteger|nullestimated_tokensintegerstatusstringis_content_fetchedbooleanlast_sync_datestringdeleted_atnullcreated_atstringupdated_atstringcustom_titlestring
Chat API
This endpoint allows users to interact with a Chat Application based on a knowledge base or application.
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
questionsessionIdstringmodelNamestringtemperaturenumbermaxTokensinteger
knowledgebase_idstringoptionalprompt_fieldobject[]optional
Responses
statusintegermessagestringdataobjectsessionIdstring
Chat Logs
This API endpoint allows users to access all chat logs. Users can filter the results by a specific session ID and apply optional date range filters to refine their search.
Headers
content-typerequiredstringauthorizationrequiredstring
Request Body
sessionIdstringoptionalstartDatestringoptionalendDatestringoptional
Responses
successbooleandataobject[]