DocuDive API documentation
Overview
This documentation provides details on various APIs available in DocuDive, including Information Extractor APIs, Business Insights APIs, Summary APIs, Key Questions and Answers APIs, and Conversational APIs. All APIs accept a PDF document, image, or website link as input and return output in text format with markup language.
API Reference
The DocuDive API is structured around REST principles, offering predictable resource-oriented URLs, accepting JSON-encoded request bodies, returning JSON-encoded responses, and using standard HTTP response codes, authentication, and verbs. It is designed to extract and analyze various types of information from documents, images, and web links.
API Access and Authentication
To use these APIs, customers must obtain an API key provided by DocuDive. Follow these steps to get your API key:
- Request API Key: Send an email request to [email protected] with your full name and company details. Or send us a message through our contact us page.
- Add Payment Method: Ensure a valid payment method is added to your DocuDive profile.
- API Key Delivery: The API key will be delivered to you within 12 hours of request, provided all account and payment information is verified.
Base URL
All API requests should be made to the following base URL:
https://api.docudive.comCommon Request Structure
- Input: File upload (PDF or image) or URL.
- Request Payload: Includes
client_id,information_type, content details, and API key.
- Output: JSON with client details (name, ID), timestamp, and the extracted information in text format with markup language.
Error Codes and Types
HTTP Status Code Summary
Status code Summary 200 OK Everything worked as expected. 400 Bad Request The request was unacceptable, often due to missing a required parameter. 401 Unauthorized No valid API key provided. 402 Request Failed The parameters were valid, but the request failed. 403 Forbidden The API key doesn’t have permissions to perform the request. 404 Not Found The requested resource doesn’t exist. 409 Conflict The request conflicts with another request (perhaps due to using the same idempotent key). 429 Too Many Requests Too many requests hit the API too quickly. We recommend exponential backoff. 500, 502, 503, 504 Server Errors Something went wrong on DocuDive’s end (these are rare).
Error Types
Error type Summary api_error General errors related to server issues or unexpected conditions on DocuDive's side. payment_error Occurs when there are insufficient credits in the account for the requested operation. invalid_request_error Arises when the request contains invalid parameters or lacks required information.
API endpoints
Details
Purpose: Extracts specified types of information from input content based on the
typeandsub_typeparameter.Endpoint:
/extract-informationMethod: POST
Input: File (PDF/image) or URL
Output: Extracted information with client details and timestamp
Information Types:
type sub_type information topic information time_line information named_entity information citations information info_snippet information cited_examples business_insights educational_information business_insights financial_information business_insights editorial_information business_insights legal_information summary short_summary summary detailed_summary qa qa
Sample Request Payload
{ "api_key": "your_api_key_here", "client_id": "client_12345", "type": "information" "sub_type": "topic" }
Sample Response
{ "client_id": "client_12345", "client_name": "Company XYZ", "timestamp": "2024-07-28T12:34:56Z", "type": "information", "sub_type": "topic", "data": { "topics": [ { "topic": "Data Privacy", "description": "Discussion on data protection laws and compliance measures." }, { "topic": "Artificial Intelligence", "description": "Overview of AI applications in various industries." } ] } }
Code Examples
cURL
curl -X POST https://api.docudive.com/v1/extract-information \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "api_key": "your_api_key_here", "client_id": "client_12345", "type": "information", "sub_type": "topic", "file": "base64_encoded_string_of_pdf" }'
PHP
'your_api_key_here', 'client_id' => 'client_12345', 'type' => 'information', 'sub_type' => 'topic', 'file' => 'base64_encoded_string_of_pdf' ); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n", 'method' => 'POST', 'content' => json_encode($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); echo $result; ?>
Java
import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; public class DocuDiveAPI { public static void main(String[] args) throws Exception { String url = "https://api.docudive.com/v1/extract-information"; String jsonInputString = "{\"api_key\": \"your_api_key_here\", \"client_id\": \"client_12345\", \"type\": \"information\", \"sub_type\": \"topic\", \"file\": \"base64_encoded_string_of_pdf\"}"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "application/json; utf-8"); con.setRequestProperty("Accept", "application/json"); con.setDoOutput(true); try (OutputStream os = con.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } int responseCode = con.getResponseCode(); System.out.println("POST Response Code :: " + responseCode); } }
Python
import requests import json url = 'https://api.docudive.com/v1/extract-information' data = { 'api_key': 'your_api_key_here', 'client_id': 'client_12345', 'type': 'information', 'sub_type': 'topic', 'file': 'base64_encoded_string_of_pdf' } headers = { 'Authorization': 'Bearer your_api_key_here', 'Content-Type': 'application/json' } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json())
Node.js
const fetch = require('node-fetch'); const url = 'https://api.docudive.com/v1/extract-information'; const data = { api_key: 'your_api_key_here', client_id: 'client_12345', type: 'information', sub_type: 'topic', file: 'base64_encoded_string_of_pdf' }; fetch(url, { method: 'POST', headers: { 'Authorization': 'Bearer your_api_key_here', 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
.NET
using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://api.docudive.com/v1/extract-information"); var json = "{\"api_key\": \"your_api_key_here\", \"client_id\": \"client_12345\", \"type\": \"information\", \"sub_type\": \"topic\", \"file\": \"base64_encoded_string_of_pdf\"}"; request.Content = new StringContent(json, Encoding.UTF8, "application/json"); request.Headers.Add("Authorization", "Bearer your_api_key_here"); var response = await client.SendAsync(request); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); } }
Get started
Sign in
Contact us
Start diving