πŸ—οΈAPI

Authorization

DocsParse authorization works through header (x-api-token). To find API Token, go to your Workflow -> Integrations -> API (Click "Generate token" if you don't have it)

API Endpoints


Upload new document (File)

POST https://api.docsparse.com/workflow-docs/upload

Uploading a new document file.

This will start file processing automatically after file is uploaded.

Headers

NameValue

Content-Type

multipart/form-data

x-api-token

<token>

Body

NameTypeDescription

file

File

File to upload (pdf,jpg,png)

workflowId

string

Workflow Identifier

filename

string

File name (optional, unless filename is not present in the file object). Example: invoice.pdf

Response

{
  "result": {
    "id": "1857a753-2196-46d3-88c6-d9b6b84b1d88",
    "created_at": "2024-07-31T16:18:20.675831+00:00",
    "workflow": "ad03c9fd-a7ff-4303-99d3-5a952b819819",
    "status": "Waiting",
    "parsed_at": null,
    "filename": "Stockholm-Resume-Template-Simple.pdf",
    "source": "file_upload",
    "metadata": {
      "size": 43430,
      "mimeType": "application/pdf",
      "originalName": "Stockholm-Resume-Template-Simple.pdf"
    }
  }
}

Upload new document (Public URL)

POST https://api.docsparse.com/workflow-docs/url-upload

Upload document with URL.

This will start file processing automatically after file is uploaded.

Document URL should be public

Headers

NameValue

Content-Type

application/json

x-api-token

<token>

Body

NameTypeDescription

fileUrl

string

Public File URL

workflowId

string

Workflow Identifier

Response

{
  "result": {
    "id": "1857a753-2196-46d3-88c6-d9b6b84b1d88",
    "created_at": "2024-07-31T16:18:20.675831+00:00",
    "workflow": "ad03c9fd-a7ff-4303-99d3-5a952b819819",
    "status": "Waiting",
    "parsed_at": null,
    "filename": "Stockholm-Resume-Template-Simple.pdf",
    "source": "file_upload",
    "metadata": {
      "size": 43430,
      "mimeType": "application/pdf",
      "originalName": "Stockholm-Resume-Template-Simple.pdf"
    }
  }
}

Process Document (Sync)

POST https://api.docsparse.com/workflow-docs/[documentId]/process

Process Document Synchronously (Need to wait a response)

Headers

NameValue

Content-Type

application/json

x-api-token

<token>

URL Parameters

NameTypeDescription

documentId

string

Document Identifier

Body

NameTypeDescription

useCache

boolean

use 'true' to speed up

Response

{
  "body": {
    "result": {
      "id": "1857a753-2196-46d3-88c6-d9b6b84b1d88",
      "created_at": "2024-07-31T16:18:20.675831+00:00",
      "workflow": "ad03c9fd-a7ff-4303-99d3-5a952b819819",
      "status": "Parsed",
      "parsed_at": "2024-07-31T16:30:04.226+00:00",
      "json": {
        "extractedProperties": [
          {
            "data": {
              "name": "Email",
              "type": "string",
              "value": "email@email.com"
            },
            "type": "property"
          }
        ]
      },
      "filename": "Stockholm-Resume-Template-Simple.pdf",
      "source": "file_upload",
      "metadata": {
        "size": 43430,
        "mimeType": "application/pdf",
        "originalName": "Stockholm-Resume-Template-Simple.pdf"
      }
    }
  },
  "error": {
    "status_code": 201,
    "status_message": "Created",
    "body": "\"{\\\"result\\\":{\\\"id\\\":\\\"1857a753-2196-46d3-88c6-d9b6b84b1d88\\\",\\\"created_at\\\":\\\"2024-07-31T16:18:20.675831+00:00\\\",\\\"path\\\":\\\"workflows/ad03c9fd-a7ff-4303-99d3-5a952b819819/1722442699272-stockholm-resume-template-simple.pdf\\\",\\\"workflow\\\":\\\"ad03c9fd-a7ff-4303-99d3-5a952b819819\\\",\\\"status\\\":\\\"Parsed\\\",\\\"parsed_at\\\":\\\"2024-07-31T16:30:04.226+00:00\\\",\\\"json\\\":{\\\"extractedProperties\\\":[{\\\"data\\\":{\\\"name\\\":\\\"Email\\\",\\\"type\\\":\\\"string\\\",\\\"value\\\":\\\"email@email.com\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"Name\\\",\\\"type\\\":\\\"string\\\",\\\"value\\\":\\\"Jason Miller\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"Phone\\\",\\\"type\\\":\\\"string\\\",\\\"value\\\":\\\"3868683442\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"has_driving_licence\\\",\\\"type\\\":\\\"string\\\",\\\"value\\\":\\\"true\\\"},\\\"type\\\":\\\"property\\\"}]},\\\"filename\\\":\\\"Stockholm-Resume-Template-Simple.pdf\\\",\\\"source\\\":\\\"file_upload\\\",\\\"metadata\\\":{\\\"size\\\":43430,\\\"mimeType\\\":\\\"application/pdf\\\",\\\"originalName\\\":\\\"Stockholm-Resume-Template-Simple.pdf\\\"},\\\"schema\\\":{\\\"extractionProperties\\\":[{\\\"data\\\":{\\\"name\\\":\\\"Email\\\",\\\"type\\\":\\\"string\\\",\\\"description\\\":\\\"Email value in the document\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"Name\\\",\\\"type\\\":\\\"string\\\",\\\"description\\\":\\\"Name value in the document\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"Phone\\\",\\\"type\\\":\\\"string\\\",\\\"description\\\":\\\"Phone value in the document\\\"},\\\"type\\\":\\\"property\\\"},{\\\"data\\\":{\\\"name\\\":\\\"has_driving_licence\\\",\\\"type\\\":\\\"string\\\",\\\"description\\\":\\\"Candidate has driving licence / driving skill. Return just \\\\\\\"true\\\\\\\" / \\\\\\\"false\\\\\\\". If no mention about driving return just \\\\\\\"false\\\\\\\"\\\"},\\\"type\\\":\\\"property\\\"}]}}}\""
  },
  "returned_an_error": false
}

Process Document (Async)

POST https://api.docsparse.com/workflow-docs/submit

Process Document Asynchronously (Need to use a webhook)

Headers

NameValue

Content-Type

application/json

x-api-token

<token>

Body

NameTypeDescription

workflowDocumentId

string

Document Identifier

useCache

boolean

use 'true' to speed up

Response

{
  "body": {
    "message": "Task created successfully"
  }
}

List Workflow Documents

GET https://api.docsparse.com/workflows/{workflowId}/workflow-docs

List workflow documents sorted by uploading date in descending order

Headers

NameValue

Content-Type

application/json

x-api-token

<token>

Query Parameters

NameTypeDescription

status

string

Document Status. To get processed documents use parsed

Response

[
    {
      "id": "1857a753-2196-46d3-88c6-d9b6b84b1d88",
      "created_at": "2024-07-31T16:18:20.675831+00:00",
      "workflow": "ad03c9fd-a7ff-4303-99d3-5a952b819819",
      "status": "Parsed",
      "parsed_at": "2024-07-31T16:30:04.226+00:00",
      "json": {
        "extractedProperties": [
          {
            "data": {
              "name": "Email",
              "type": "string",
              "value": "email@email.com"
            },
            "type": "property"
          }
        ]
      },
      "filename": "Stockholm-Resume-Template-Simple.pdf",
      "source": "file_upload",
      "metadata": {
        "size": 43430,
        "mimeType": "application/pdf",
        "originalName": "Stockholm-Resume-Template-Simple.pdf"
      }
    }
]

Last updated