Overview

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
  • 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
    • 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
  • 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

Endpoint:https://app.newra.ai/api/v1
Knowledge Base

Knowledge Base API

List Knowledge Bases

Returns a list of all knowledge bases associated with the account.

Headers

  • authorizationrequiredstring

Responses

    • iduuid
    • user_idinteger
    • iconstring
    • titlestring
    • slugstring
    • descriptionstring
    • deleted_atnull
    • created_atstring
    • is_activeboolean

Create a Knowledge Base

Creates a new knowledge base for the account.

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • titlestring
  • descriptionstringoptional
  • iconstringoptional

Responses

    • iduuid
    • user_idinteger
    • iconstring
    • titlestring
    • slugstring
    • descriptionstring
    • deleted_atnull
    • created_atstring
    • is_activeboolean

Get Knowledge Base By ID

Returns a specific knowledge base associated with the account.

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Responses

    • iduuid
    • user_idinteger
    • iconstring
    • titlestring
    • slugstring
    • descriptionstring
    • deleted_atnull
    • created_atstring
    • is_activeboolean
    • namespacestring
    • userobject[]
    • settingsobject[]

Update Knowledge Base

Updates a specific Knowledge Base

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • titlestring
  • descriptionstringoptional
  • iconstringoptional

Responses

    • iduuid
    • user_idinteger
    • iconstring
    • titlestring
    • slugstring
    • descriptionstring
    • deleted_atnull
    • created_atstring
    • is_activeboolean

Delete Knowledge Base

Deletes a specific Knowledge Base

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Responses

    No response specified
Datasource

Datasource API

List Data Sources

Returns a list of Data Sources for a specific Knowledge Base

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

query Parameters

  • page_limitinteger

    Limit of items to return per page

  • pageinteger

    Page number to return

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Responses

    object[]
    • dataobject[]
    • linksobject
    • metaobject

Get Data Source By ID

Returns a specific Data Source for a specific Knowledge Base

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

  • data_source_idrequiredstring

    ID of the Datasource of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Responses

    • iduuid
    • knowledge_base_iduuid
    • user_idinteger
    • typestring
    • titlestring
    • paragraphstring
    • scrap_all_urlboolean
    • urlstring
    • excluded_urlsstring|null
    • reference_urlstring
    • sizeinteger|null
    • estimated_tokensinteger
    • statusstring
    • is_content_fetchedboolean
    • last_sync_datestring
    • deleted_atnull
    • created_atstring
    • updated_atstring
    • custom_titlestring

Delete Data Source

Deletes a specific Data Source

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Responses

    No response specified

Sync Data Sources

Synchronizes all Data Sources across all Knowledge Bases

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • selected_sourcestringoptional

Responses

    • messagestring
    • successboolean
    • statusstringoptional

Train Data Sources

Trains all Data Sources across all Knowledge Bases

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • selected_sourcestringoptional

Responses

    • messagestring
    • successboolean
    • statusstringoptional
Webscrapping

Webscrapping API

Create Scrape URLs

Creates a new Web Scraping Data Source using urls for a specific Knowledge Base

Supported document are

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • source_urlstring

Responses

    • iduuid
    • knowledge_base_iduuid
    • user_idinteger
    • typestring
    • titlestring
    • paragraphstring
    • scrap_all_urlboolean
    • urlstring
    • excluded_urlsstring|null
    • reference_urlstring
    • sizeinteger|null
    • estimated_tokensinteger
    • statusstring
    • is_content_fetchedboolean
    • last_sync_datestring
    • deleted_atnull
    • created_atstring
    • updated_atstring
    • custom_titlestring

Create Whole Domain Datasource

Creates a new Web Scraping Data Source using entire domain for a specific Knowledge Base.

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • domainstring
  • excluded_urlsstring[]optional

Responses

    • messagestring
    • successboolean
    • statusstringoptional

Fetch Sitemap

Fetch sitemap for specific Knowledge Base

path Parameters

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • urlstring

Responses

    • datastring[]
    • successboolean
Document Upload Datasource

Document Upload API

Create Document Datasource

Note: Due to certain limitations, testing the API may not be feasible in this environment. We recommend using a platform such as 'Postman' for more effective.

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

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • documentfile

Responses

    • iduuid
    • knowledge_base_iduuid
    • user_idinteger
    • typestring
    • titlestring
    • paragraphstring
    • scrap_all_urlboolean
    • urlstring
    • excluded_urlsstring|null
    • reference_urlstring
    • sizeinteger|null
    • estimated_tokensinteger
    • statusstring
    • is_content_fetchedboolean
    • last_sync_datestring
    • deleted_atnull
    • created_atstring
    • updated_atstring
    • custom_titlestring
Text Scrapping Datasource

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

  • idrequiredstring

    ID of the Knowledge Base (required for all requests)

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • titlestring
  • paragraphstring

Responses

    • iduuid
    • knowledge_base_iduuid
    • user_idinteger
    • typestring
    • titlestring
    • paragraphstring
    • scrap_all_urlboolean
    • urlstring
    • excluded_urlsstring|null
    • reference_urlstring
    • sizeinteger|null
    • estimated_tokensinteger
    • statusstring
    • is_content_fetchedboolean
    • last_sync_datestring
    • deleted_atnull
    • created_atstring
    • updated_atstring
    • custom_titlestring
Chat

Chat API

This endpoint allows users to interact with a Chat Application based on a knowledge base or application.

Headers

  • content-typerequiredstring
  • authorizationrequiredstring

Request Body

  • question
  • sessionIdstring
  • modelNamestring
  • temperaturenumber
  • maxTokensinteger
  • knowledgebase_idstringoptional
  • prompt_fieldobject[]optional

Responses

    • statusinteger
    • messagestring
    • dataobject
    • sessionIdstring

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-typerequiredstring
  • authorizationrequiredstring

Request Body

  • sessionIdstringoptional
  • startDatestringoptional
  • endDatestringoptional

Responses

    • successboolean
    • dataobject[]