Extracta.ai
DashboardJoin Discord
  • extracta.ai
    • Introduction
    • Overview
  • API Reference
    • 🔓Authentication
    • 📁Supported File Types
  • Data Extraction - API
    • đŸ’ģAPI Endpoints - Data Extraction
      • 1. Create extraction
      • 2. View extraction
      • 3. Update extraction
      • 4. Delete extraction
      • 5. Upload Files
      • 6. Get results
    • Extraction Details
      • 🌎Supported Languages
      • âš™ī¸Options
      • 📋Fields
    • Receiving Batch Results
      • Polling vs Webhook
      • How to use the Webhook
    • đŸ•šī¸Postman Integration
  • Document Classification - API
    • đŸ’ģAPI Endpoints - Document Classification
      • 1. Create classification
      • 2. View classification
      • 3. Update classification
      • 4. Delete data
        • 4.1 Delete classification
        • 4.2 Delete batch
        • 4.3 Delete files
      • 5. Upload Files
      • 6. Get results
    • Classification Details
      • 📄Document Types
  • Documents
    • Custom Document
    • Resume / CV
    • Contract
    • Business Card
    • Email
    • Invoice
    • Receipt
    • Bank Statement
  • Support
    • 💁Tutorials
    • đŸŸĸAPI Status
  • Contact
    • 📧Contact Us
    • ❓FAQ
Powered by GitBook
On this page
  • Server URL
  • Headers
  • Body
  • Body Example
  • Code Example
  • Responses

Was this helpful?

  1. Document Classification - API
  2. API Endpoints - Document Classification

2. View classification

POST /documentClassification/viewClassification

This endpoint retrieves the details of a classification process previously defined in the system. By submitting the unique classificationId, you can obtain information such as the classification name, description, configured document types, associated keywords, and any linked extraction templates. This is useful for verifying your classification setup or for debugging and auditing purposes.

Server URL

https://api.extracta.ai/api/v1

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Required
Description

classificationId

string

true

Unique identifier for the classification.

Body Example

{
    "classificationId": "classificationId"
}

Code Example

const axios = require('axios');

async function viewClassification(token, classificationId) {
    const url = "https://api.extracta.ai/api/v1/documentClassification/viewClassification";

    try {
        const response = await axios.post(url, {
            classificationId: classificationId
        }, {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${token}`
            }
        });

        return response.data;
    } catch (error) {
        throw error.response ? error.response.data : new Error('An unknown error occurred');
    }
}

async function main() {
    const token = 'apiKey';
    const classificationId = 'classificationId';

    try {
        const classificationDetails = await viewClassification(token, classificationId);
        console.log("Classification Details:", classificationDetails);
    } catch (error) {
        console.error("Failed to retrieve classification details:", error);
    }
}

main();
import requests

def view_classification(token, classification_id):   
    url = "https://api.extracta.ai/api/v1/documentClassification/viewClassification"
    
    headers = {
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {token}'
    }
    
    payload = {
        'classificationId': classification_id
    }

    try:
        response = requests.post(url, json=payload, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.RequestException as e:
        print(f"Failed to retrieve classification details: {e}")
        return None

# Example usage
if __name__ == "__main__":
    token = 'apiKey'
    classification_id = 'classificationId'

    classification_details = view_classification(token, classification_id)
    if classification_details is not None:
        print("Classification Details:", classification_details)
<?php

function viewClassification($token, $classificationId) {
    $url = 'https://api.extracta.ai/api/v1/documentClassification/viewClassification';

    // Initialize cURL session
    $ch = curl_init($url);

    // Prepare the payload
    $payload = json_encode(['classificationId' => $classificationId]);

    // Set cURL options
    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $token
    ]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);

    try {
        // Execute cURL session
        $response = curl_exec($ch);

        // Check for cURL errors
        if (curl_errno($ch)) {
            throw new Exception('Curl error: ' . curl_error($ch));
        }

        // return the response as an associative array
        return json_decode($response, true);
    } catch (Exception $e) {
        return 'Error: ' . $e->getMessage();
    } finally {
        curl_close($ch);
    }
}

// Example usage
$token = 'apiKey';
$classificationId = 'classificationId';

try {
    $classificationDetails = viewClassification($token, $classificationId);
    print_r($classificationDetails);
} catch (Exception $e) {
    echo "Failed to retrieve classification details: " . $e->getMessage();
}

?>

Responses

{
    "status": "success",
    "classificationId": "-OPkce8E1CuEQeHDZetx",
    "classificationDetails": {
        "createdAt": 1746720170530,
        "name": "Financial Document Classifier"
        "description": "Classifies uploaded documents into predefined financial document types.",
        "documentTypes": [
            {
                "description": "Standard commercial invoice from vendors or suppliers.",
                "extractionId": "-OPXR1F82I0cRYJPcHNo",
                "name": "Invoice",
                "uniqueWords": [
                    "invoice number",
                    "bill to",
                    "total amount"
                ]
            },
            {
                "description": "Internal or external purchase order documents.",
                "name": "Purchase Order",
                "uniqueWords": [
                    "PO number",
                    "item description",
                    "quantity ordered"
                ]
            },
            {
                "description": "Retail or online transaction receipts.",
                "name": "Receipt",
                "uniqueWords": [
                    "receipt",
                    "paid",
                    "transaction id"
                ]
            }
        ]
    }
}
{
    "status": "error",
    "message": "Classification does not exist"
}
{
    "status": "error",
    "message": "Error viewing classification"
}
Previous1. Create classificationNext3. Update classification

Last updated 16 hours ago

Was this helpful?

đŸ’ģ