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
  3. 4. Delete data

4.2 Delete batch

DELETE /documentClassification/deleteBatch

This endpoint permanently deletes a specific batch from a document classification process.

You must provide both the classificationId and the batchId in the request body. This action is irreversible and will remove the selected batch along with all results and files associated with it.

Use this endpoint when you need to clean up or remove a specific batch without affecting the overall classification. Separate endpoints are available for deleting entire classifications or individual files.

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

The classification id.

batchId

string

true

The batch id.

Body Example

{
    "classificationId": "classificationId",
    "batchId": "batchId"
}

Code Example

const axios = require('axios');

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

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

        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';
    const batchId = 'batchId';

    try {
        const response = await deleteBatch(token, classificationId, batchId);
        console.log("Batch Deleted:", response);
    } catch (error) {
        console.error("Failed to delete batch:", error);
    }
}

main();
import requests

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

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

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

    response = delete_batch(token, classification_id, batch_id)
    if response:
        print("Batch Deleted:", response)
    else:
        print("Failed to delete batch.")
<?php

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

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

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

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

    try {
        $response = curl_exec($ch);

        if (curl_errno($ch)) {
            throw new Exception('Curl error: ' . curl_error($ch));
        }

        return $response;
    } catch (Exception $e) {
        return 'Error: ' . $e->getMessage();
    } finally {
        curl_close($ch);
    }
}

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

try {
    $response = deleteBatch($token, $classificationId, $batchId);
    echo "Batch Deleted: " . $response;
} catch (Exception $e) {
    echo "Failed to delete batch: " . $e->getMessage();
}

?>

Responses

{
    "status": "success",
    "message": "Batch deleted"
}
{
    "status": "success",
    "message": "Batch deleted"
}
{
    "status": "error",
    "message": "Internal server error"
}
Previous4.1 Delete classificationNext4.3 Delete files

Last updated 15 days ago

Was this helpful?

đŸ’ģ