SageX - API
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Upload Document
      • Download Document
      • Download Export Data
Powered by GitBook
On this page
  • Get your SageX API keys
  • Getting Your Account Details
  • ID'sAssociated with API Calls
  • Initiating Your First API Request
  • Upload Document to workspace

Quick Start

PreviousWelcome!NextAPI Reference

Last updated 1 year ago

Good to know: A quick start guide can be helpful for users to quickly get started with SageX API in a few steps. Some people prefer to start with the basics instead of reading through all the documentation.

Get your SageX API keys

To ensure proper authentication of your API requests, it is necessary to include API keys. Failure to include an API key in a request will result in an error response.

To obtain an API key, simply follow these steps:

  1. Access your SageX Dashboard.

  2. Click on your profile.

  3. Navigate to the API Settings section.

From there, you will be able to generate an API key and utilize it for authentication in your API requests.

Getting Your Account Details

ID'sAssociated with API Calls

To successfully execute API calls, it is necessary to provide your account details along with a token. The following ID's are required for making API calls:

  1. Account Details: Realm ID and Workspace ID can be obtained from your Workspace. For a specific cluster workspace, you will need the workspace {cluster_guid} and export template {export_template_guid}.

By following these steps, you will be able to obtain the required account details and tokens for performing API calls:

  1. Access the WorkSpace Setup.

  2. Select the option to Edit Workspace.

Initiating Your First API Request

To commence your interaction with the API, it is essential to send an authenticated request to the API endpoint.

Upload Document to workspace

POST https://app.sagexglobal.ai/api/document/upload

Authorization: Bearer <API Key>

Request Body

Name
Type
Description

file*

file

/path/file.pdf

realm_guid*

Text

Your account realm id

workspace_guid*

Text

Your account workspace id

document_name*

Text

Name of the document

document_fields

JSON Object

Country,language,document_ref, publishing_year,publisher_name, document_type

*Refer below for details on JSON Object

//Sample
{
    "data": {
        "realm_guid": "NN",
        "workspace_guid": "xxxxxx-c160-11ed-xxxxx-xxxxxxx",
        "document_guid": "xxxx-068f-xxxx-xxxx-xxxxxxx"
    },
    "message": "success",
    "status": "success",
    "code": 200
}

// document_fields - JSON Object
{ 
    "country" :"<iso country code>",
    "language": "<iso language code>",
    "document_ref": "<client generated unique document id>",
    "publishing_year": "<year of publishing the document>",
    "publisher_name": "<name of entity/person/business publishing the document>",
    "document_type": "<document type defined by organization>"
}	

Take a look at how you might call this method using curl:

curl -X POST 'https://app.sagexglobal.ai/api/document/upload' \
--form 'file=@"/path/file.pdf"' \
--form 'realm_guid="<realm_id>"' \
--form 'workspace_guid="<workspace_id>"' \
--form 'document_name="<document_name>"' \
--form 'document_fields="{
    \"country\": \"IND\",
    \"language\": \"En\"
}"'
-H "Authorization: Bearer <token>"