Splitting API

The Splitting API offers an asynchronous API for splitting single-file document stacks into multiple, individual business related documents

1.Overview

Base URL for all requests:

https://amjf5f2pyl.execute-api.eu-central‑1.amazonaws.com/PROD/

2.POST /document

Used to upload your document stack for splitting. The response includes a job id which is used to poll for results using REST interface GET /result/

2.1.Request Header

content-type: HTTP content type

supported values: “multipart/form-data“

required: yes

customer-id: part of your credentials which you receive upon registration for the Splitting API

required: yes

x‑api-key: part of your credentials which you receive upon registration for the Splitting API

required: yes

2.2.Request Parameter

The request body includes the following list of form parameters:

document : single file containing a stack of documents; documents must be limited to a file size of 4 MB, larger documents must be uploaded using REST endpoint GET /uploadurl

supported file types: pdf and tiff (supported compressions: none, adobe_deflate, ccitt group 3 or 4, lzw)

required: yes

language : language used for character recognition (OCR)

supported values: [ ”en” | ”de” | ”en+de”]

required: no

default: “en+de”

uploadId : required for processing document files > 4 MB: upload id returned from endpoint GET /uploadurl; each upload id must only be used once

required: no

2.3.Response HTTP Status

200: Document uploaded successfully.

400: Bad request. Missing or invalid input parameter.

401: Authorization failed. Operation not allowed.

403: Authorization failed due to invalid credentials.

415: Unsupported file format.

429: Too many requests. The overall number of requests to all REST endpoints of the Splitting API must not exceed 100 requests/s for each customer.

2.4.Response Header

content-type: HTTP content type

supported values: “application /json”

2.5.Response Body

jobId: Job id used for polling the resulting entities from REST interface /result

type: String

uploadFile: Description of the uploaded file

type: Map<String, Object>

object properties:

  • name: "size"
    type: Integer
  • name: "mime"
    type: String
  • name: "name"
    type: String

2.6.Example

Request

POST /document

headers {"customer-id": <your_customer_id>, "x-api-key": <your_api_key>}
body {"document": <your_file>}

Response

{
  "jobId": "229cdae0162805414755d5ee7eed216bc975738c",
  "uploadFile": {
    "size": 30393,
    "mime": "application/pdf",
    "name": "Demo.pdf"
  }
}

3.GET /result/

Retrieve results of the splitting process using the <JOB_ID> from the REST interface /document response.

3.1.Request Header

content-type: HTTP content type

supported values: “application/json“

required: yes

customer-id: part of your credentials which you receive upon registration for the Splitting API

required: yes

x‑api-key: part of your credentials which you receive upon registration for the Splitting API

required: yes

3.2.Path Variable

JOB_ID : the job id is received from the response of the call to REST interface POST /document

3.3.Response HTTP Status

200: Splitting successful.

202: Job processing not finished yet.

400: Bad request. Missing or invalid input parameter.

401: Authorization failed. Operation not allowed.

403: Authorization failed due to invalid credentials.

422: File cannot be processed.

429: Too many requests. The overall number of requests to all REST endpoints of the Splitting API must not exceed 100 requests/s for each customer.

3.4.Response Header

content-type: HTTP content type

supported values: “application /json”

3.5.Response Body

batch_name: batch id
type: String

documents: listing of all documents and their page numbers within the uploaded batch

type: Map<String, Object>

object properties:

  • name: "firstPage"
    type: Integer
  • name: "lastPage"
    type: Integer

pages: list of all pages and their classification result and confidence

type: List<Object>

object properties:

  • name: "className"
    type: String
    supported values: [ "FIRST_DE" | "FOLLOWUP_DE" ]
  • name: "confidence"
    type: Double
    supported values: [0,1]
  • name: "pageNumber"
    type: Integer

3.6.Example

Request

GET /result/229cdae0162805414755d5ee7eed216bc975738c
headers {"customer-id": <your_customer_id>, "x-api-key": <your_api_key>}

Response

{
    "batch_name": "abc239f3a6e2d2bf315a49a108b5b5870dfaf416.pdf",
    "documents": {
        "abc239f3a6e2d2bf315a49a108b5b5870dfaf416_doc1": {
            "firstPage": 1,
            "lastPage": 2
        },
        "abc239f3a6e2d2bf315a49a108b5b5870dfaf416_doc2": {
            "firstPage": 3,
            "lastPage": 5
        }
    }
}

4.GET /uploadurl

Used to request a URL for the upload of large document files (> 4 MB). After uploading your document you must use endpoint POST /document to start document processing.

4.1.Request Header

content-type: HTTP content type

supported values: “application/json“

required: yes

customer-id: part of your credentials which you receive upon registration for the Splitting API

required: yes

x‑api-key: part of your credentials which you receive upon registration for the Splitting API

required: yes

4.2.Response HTTP Status

200: Successfully generated upload URL

401: Authorization failed. Operation not allowed.

403: Authorization failed due to invalid credentials.

4.3.Response Header

content-type: HTTP content type

supported values: “application /json”

4.4.Response Body

uploadUrl: URL for uploading your document file using HTTP REST. Each URL must only be used once.

uploadId: upload id that must be passed as parameter ‘uploadId’ in POST /document endpoint for processing your uploaded file

4.5.Example

Request

GET /uploadurl
 
headers {"customer-id": <your_customer_id>, "x-api-key": <your_api_key>}

Response

{
    "uploadUrl": <your_upload_url>,
    "uploadId": "ac9e77e0-13cd-4d81-a4f1-9ba88b52899d"
}
Suggest Edit
Copy link
Powered by Social Snap