Skip to main content

What is a Client Secret?

The Client ID and Client Secret are secure credentials that allow external applications to interact with our platform APIs. You can use them to Upload documents and Extract structured data using a selected template.

external API integration


Step 1: How to Generate a Client Secret

  1. Go to the Sidebar

    • Navigate to Client Secret from the left-side menu.
  2. Click “Generate Client Secret”

    • You will see a button labeled Generate Client Secret. Click it to create a new set of credentials.
  3. Copy Immediately - The credentials will be shown only once:

    • Client ID
    • Client Secret
    • Generated Timestamp
  4. Download Credentials (Recommended)

    • Click the Download button to store your credentials in a JSON file securely.
    • Once saved, these credentials can be reused for API access.

external API integration


Step 2: How to Use the Credentials in API Requests

Add Headers to Every Request:

X-Client-Id: your-client-id

X-Client-Secret: your-client-secret

  • Replace your-client-id and your-client-secret with the values you generated.

external API integration


Step 3: API Endpoints Available

Extracted Data API

Use this to fetch extracted data for previously uploaded files.

external API integration


Step 4: Process PDF with Template

Use this to process a PDF using a specific template name. You must send:

  • File (PDF)
  • Template name in the request body

external API integration


Security Guidelines

  • One-Time Visibility

    The client secret is shown only once. Store it securely.

  • Use Secure Storage

    Do not hardcode or expose your credentials in frontend code or public spaces.

  • Regenerate If Needed

    If credentials are compromised, regenerate a new set and delete the old one.

  • Important: If you lose the secret, you must generate a new one. It cannot be retrieved later.

API Integration Code Samples

 import requests

# Replace with your actual credentials
CLIENT_ID = 'your-client-id'
CLIENT_SECRET = 'your-client-secret'
BASE_URL = 'https://papex.sholas.io/v1'
HEADERS = {
  'X-Client-Id': CLIENT_ID,
  'X-Client-Secret': CLIENT_SECRET
}
def process_document(file_path, prompt_type='invoice', split_by_page=True):
  """
  Upload a document and process it using a template.
  """
  with open(file_path, 'rb') as f:
      files = {
          'file': (file_path, f, 'application/octet-stream')
      }
      data = {
          'promptType': prompt_type,
          'splitByPage': str(split_by_page).lower()  # 'true' or 'false'
      }
      response = requests.post(
          f'{BASE_URL}/process',
          headers=HEADERS,
          files=files,
          data=data
      )
  print(" Process Document Response:")
  print(response.status_code, response.text)
def get_extracted_data():
  """
  Fetch all previously extracted document data.
  """
  response = requests.get(f'{BASE_URL}/extracted', headers=HEADERS)
  print("
 Extracted Data Response:")
  print(response.status_code, response.text)
def list_templates():
  """
  List all available AI extraction templates.
  """
  response = requests.get(f'{BASE_URL}/prompts', headers=HEADERS)
  print("
 List Templates Response:")
  print(response.status_code, response.text)
if __name__ == "__main__":
  # Run the integrations
  process_document('document.pdf', prompt_type='invoice', split_by_page=True)
  get_extracted_data()
  list_templates()