Import invoices provides a robust suite of APIs designed to handle all your document parsing requirements. Our aim is to simplify the complex process of document management, be it retrieval, parsing, or error handling. This includes effortless pagination, a plethora of supported document types, and meticulous error detail.
Through our versatile APIs, you can not just retrieve uploaded documents but also queue documents for parsing either via a direct upload or through an external link. Our APIs are designed keeping in mind the dynamic nature of businesses and therefore, they seamlessly cater to varying business needs and configurations.
The APIs are coded following the OpenAPI Specification (OAS), making the integration process hassle-free and straightforward. We provide complete Swagger UI-based documentation that details the potential responses and possible status and error codes.
All API requests are authenticated via JWT headers for maximum security. This ensures that your sensitive document data remains protected at all times.
We are thrilled to have you onboard and can't wait to see how you integrate and maximize the utility of Import invoices in your document management operations!
GET /v1/documents
A GET method that fetches the details of uploaded documents from ParseDocuments.com. The results can be filtered and paginated using specific query parameters.
GET /v1/documents?page=0
status
(optional): Status filter conditions:confirmed
(optional): Filter only confirmed documents (true/false or null for all)
page
(optional): The page number for pagination.
import requests url = "https://api.parseinvoices.com/v1/documents" querystring = { "status": "0", "period": "0", "used": "2022-01-01", "confirmed": "true", "page": "0" } headers = { "Authorization": "Bearer " + 'YourAuthTokenHere' } response = requests.get(url, headers=headers, params=querystring) response.raise_for_status() print(response.text)
package main import ( "fmt" "net/http" "net/url" ) func main() { url := "https://api.parseinvoices.com/v1/documents" params := url.Values{ "status": {"0"}, "period": {"0"}, "used": {"2022-01-01"}, "confirmed": {"true"}, "page": {"0"}, } req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println("Error creating request:", err) return } req.URL.RawQuery = params.Encode() req.Header.Set("Authorization", "Bearer "+YourAuthTokenHere) client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error making GET request:", err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println("Error reading response body:", err) return } fmt.Println(string(body)) }
<?php $url = "https://api.parseinvoices.com/v1/documents"; $queryParams = [ "status" => "0", "period" => "0", "used" => "2022-01-01", "confirmed" => "true", "page" => "0" ]; $headers = [ "Authorization: Bearer " . 'YourAuthTokenHere' ]; $url .= '?' . http_build_query($queryParams); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if ($error) { echo "Error: " . $error; } else { echo $response; }
using System; using System.Net.Http; public class Program { private static readonly HttpClient client = new HttpClient(); public static void Main(string[] args) { GetDocumentList().Wait(); } private static async Task GetDocumentList() { try { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YourAuthTokenHere"); var queryParams = new System.Collections.Specialized.NameValueCollection { { "status", "0" }, { "period", "0" }, { "used", "2022-01-01" }, { "confirmed", "true" }, { "page", "0" } }; var query = new System.Net.Http.FormUrlEncodedContent(queryParams); var requestUri = new UriBuilder("https://api.parseinvoices.com/v1/documents") { Query = query.ReadAsStringAsync().Result }; var response = await client.GetAsync(requestUri.ToString()); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } }
In this code, we define a simple program with a single method `GetDocumentList`.
This method first sets up the authentication header by adding the bearer token to the HttpClient's default headers.
Then, it constructs the query parameters using a `System.Collections.Specialized.NameValueCollection` object.
It converts the query parameters to a `System.Net.Http.FormUrlEncodedContent` object and appends it to the request URL using a `System.Net.UriBuilder`.
If the request fails for any reason, an HttpRequestException will be thrown and the method will catch it and print the error message to the console.
If the request is successful, the method will read the response body as a string and print it to the console.
Query Parameters:
status
(optional): Status filter conditions (0-2).period
(optional): Export filter conditions (0-16).used
(optional): Last used date (YYYY-MM-DD format).confirmed
(optional): Only filter confirmed documents (true/false).page
(optional): The page number for pagination.GET /v1/documents/{id}
A GET method that retrieves the details of a specific document from ParseDocuments.com using its primary key.
GET /v1/documents/1
id
: The primary key of the document.
import requests url = "https://api.parseinvoices.com/v1/documents/1" headers = { "Authorization": "Bearer YourAuthTokenHere" } response = requests.get(url, headers=headers) print(response.text)
package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.parseinvoices.com/v1/documents/1" req, _ := http.NewRequest("GET", url, nil) req.Header.Set("Authorization", "Bearer YourAuthTokenHere") client := &http.Client{} response, _ := client.Do(req) defer response.Body.Close() body, _ := ioutil.ReadAll(response.Body) fmt.Println(string(body)) }
<?php $url = "https://api.parseinvoices.com/v1/documents/1"; $headers = array( "Authorization: Bearer " . Model ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response;
using System; using System.Net.Http; using System.Threading.Tasks; class Program { private static readonly HttpClient client = new HttpClient(); static void Main(string[] args) { GetDocumentDetails(1).Wait(); } private static async Task GetDocumentDetails(int id) { try { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", Model); var response = await client.GetAsync($"https://api.parseinvoices.com/v1/documents/{id}"); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } }
In this code, we define a simple program with a single method `GetDocumentDetails` that takes the document ID as an input parameter.
This method first sets up the authentication header by adding the bearer token to the HttpClient's default headers.
Then, it constructs the request URL by appending the document ID to the base URL.
If the request fails for any reason, an HttpRequestException will be thrown and the method will catch it and print the error message to the console.
If the request is successful, the method will read the response body as a string and print it to the console.
Path Parameters:
id
: The primary key of the document.POST /v1/documents/queue/base64
A POST method that enqueues a document for parsing fields and tables using a base64 encoded binary representation. The document is identified by its filename.
Example RequestPOST /v1/documents/queue/base64?filename=my_document.pdf
filename
(required): The identification of the file (filename).
{ "type": "string", "format": "base64" }
import requests base_url = "https://example.com/api" base64_document = "YOUR_BASE64_DOCUMENT_HERE" def enqueue_document(): try: headers = { "Authorization": "Bearer YOUR_ACCESS_TOKEN_HERE" } query_params = { "filename": "my_document.pdf" } response = requests.post( f"{base_url}/v1/documents/queue/base64", headers=headers, params=query_params, json={"document": base64_document} ) response.raise_for_status() print("Document enqueued successfully.") except requests.exceptions.RequestException as e: print(f"Error: {e}") enqueue_document()
package main import ( "fmt" "net/http" "net/url" "io/ioutil" ) func main() { EnqueueDocument() } func EnqueueDocument() { baseURL := "https://example.com/api" base64Document := "YOUR_BASE64_DOCUMENT_HERE" endpoint := "/v1/documents/queue/base64" filename := "my_document.pdf" u, err := url.Parse(fmt.Sprintf("%s%s", baseURL, endpoint)) if err != nil { fmt.Println(err) return } q := u.Query() q.Set("filename", filename) u.RawQuery = q.Encode() req, err := http.NewRequest("POST", u.String(), nil) if err != nil { fmt.Println(err) return } req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE") client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println(err) return } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { body, _ := ioutil.ReadAll(resp.Body) fmt.Printf("Error: %s\n", string(body)) return } fmt.Println("Document enqueued successfully.") }
<?php $baseUrl = "https://example.com/api"; $base64Document = "YOUR_BASE64_DOCUMENT_HERE"; function enqueueDocument() { global $baseUrl, $base64Document; try { $filename = "my_document.pdf"; $headers = array( "Authorization: Bearer YOUR_ACCESS_TOKEN_HERE", "Content-Type: application/json" ); $queryParams = array( "filename" => $filename ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "{$baseUrl}/v1/documents/queue/base64?" . http_build_query($queryParams)); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array("document" => $base64Document))); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode !== 200) { throw new Exception("Error: " . $response); } echo "Document enqueued successfully."; } catch (Exception $e) { echo $e->getMessage(); } } enqueueDocument();
using System; using System.Net.Http; using System.Threading.Tasks; using System.Text; class Program { private static readonly HttpClient client = new HttpClient(); private static readonly string base64Document = "YOUR_BASE64_DOCUMENT_HERE"; static void Main(string[] args) { EnqueueDocument().Wait(); } private static async Task EnqueueDocument() { try { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_ACCESS_TOKEN_HERE"); var queryParams = new System.Collections.Specialized.NameValueCollection { { "filename", "my_document.pdf" } }; var query = new System.Net.Http.FormUrlEncodedContent(queryParams); var requestUri = new UriBuilder("https://example.com/api/v1/documents/queue/base64") { Query = query.ReadAsStringAsync().Result }; var requestBody = new StringContent(base64Document, Encoding.UTF8, "application/json"); var response = await client.PostAsync(requestUri.ToString(), requestBody); response.EnsureSuccessStatusCode(); Console.WriteLine("Document enqueued successfully."); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } }
In this code, we define a simple program with a single method `EnqueueDocument`.
This method first sets up the authentication header by adding the bearer token to the HttpClient's default headers.
Then, it constructs the query parameters using a `System.Collections.Specialized.NameValueCollection` object.
It converts the query parameters to a `System.Net.Http.FormUrlEncodedContent` object and appends it to the request URL using a `System.Net.UriBuilder`.
The method also constructs the request body as a `System.Net.Http.StringContent` object with the base64 encoded document data.
If the request fails for any reason, an HttpRequestException will be thrown and the method will catch it and print the error message to the console.
If the request is successful, the method will print a success message to the console.
Query Parameters:
filename
(required): The identification of the file (filename).POST /v1/documents/queue/url
A POST method that enqueues a document for parsing fields and tables using an external link.
POST /v1/documents/queue/url?filename=example.pdf&url=http://example.com/docs/example.pdf
filename
(optional): The identification of the file (filename).
url
(required): The URL of the document to download and parse.
import requests def enqueue_document(): try: headers = { "Authorization": "Bearer {TOKEN}" } params = { "filename": "example.pdf", "url": "http://example.com/docs/example.pdf" } response = requests.post("https://{baseUrl}/v1/documents/queue/url", headers=headers, params=params) response.raise_for_status() print("Document enqueued successfully.") except requests.exceptions.RequestException as e: print("Error:", e) enqueue_document()
package main import ( "fmt" "net/http" "net/url" ) func main() { enqueueDocument() } func enqueueDocument() { url := "https://api.parseinvoices.com/v1/documents/queue/url" params := url.Values{} params.Set("filename", "example.pdf") params.Set("url", "http://example.com/docs/example.pdf") req, err := http.NewRequest("POST", url, nil) if err != nil { fmt.Println("Error:", err) return } req.URL.RawQuery = params.Encode() client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println("Error:", err) return } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { fmt.Println("Error:", resp.Status) return } fmt.Println("Document enqueued successfully.") }
<?php function enqueue_document() { try { $headers = array( "Authorization: Bearer {TOKEN}" ); $params = array( "filename" => "example.pdf", "url" => "http://example.com/docs/example.pdf" ); $options = array( "http" => array( "header" => $headers, "method" => "POST", "content" => http_build_query($params) ) ); $context = stream_context_create($options); $response = file_get_contents("https://{baseUrl}/v1/documents/queue/url", false, $context); if ($response === false) { echo "Error: Failed to enqueue document."; } else { echo "Document enqueued successfully."; } } catch (Exception $e) { echo "Error: " . $e->getMessage(); } } enqueue_document();
using System; using System.Net.Http; using System.Threading.Tasks; class Program { private static readonly HttpClient client = new HttpClient(); static void Main(string[] args) { EnqueueDocument().Wait(); } private static async Task EnqueueDocument() { try { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YourAuthTokenHere"); var queryParams = new System.Collections.Specialized.NameValueCollection { { "filename", "example.pdf" }, { "url", "http://example.com/docs/example.pdf" } }; var query = new System.Net.Http.FormUrlEncodedContent(queryParams); var requestUri = new UriBuilder("https://api.parseinvoices.com/v1/documents/queue/url") { Query = query.ReadAsStringAsync().Result }; var response = await client.PostAsync(requestUri.ToString(), null); response.EnsureSuccessStatusCode(); Console.WriteLine("Document enqueued successfully."); } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } }
In this code, we define a simple program with a single method `EnqueueDocument`.
This method first sets up the authentication header by adding the bearer token to the HttpClient's default headers.
Then, it constructs the query parameters using a `System.Collections.Specialized.NameValueCollection` object.
It converts the query parameters to a `System.Net.Http.FormUrlEncodedContent` object and appends it to the request URL using a `System.Net.UriBuilder`.
If the request fails for any reason, an HttpRequestException will be thrown and the method will catch it and print the error message to the console.
If the request is successful, the method will simply print "Document enqueued successfully" to the console.
Request Parameters:
filename
(optional): The identification of the file (filename).url
(required): The URL of the document to download and parse.