Waveline Extract
  • Waveline Extract
    • Introduction
    • Getting Started
  • Endpoints
    • /extract-document
    • /guess-shape
    • /raw-extract
    • /jobs
    • /jobs/{id}
    • /me
  • Types
    • Shape
    • DataShapeElement
  • Examples
    • Invoice Extraction
    • Order Table Extraction
    • Email Extraction
    • CV Extraction
    • Raw Extraction
  • Additional Material
    • FAQ
    • Limitations
  • Pricing
    • Pages
Powered by GitBook
On this page
  • 1. Create a new job (extract-document endpoint)
  • 2. Get the result/status of this job (job endpoint)
  1. Waveline Extract

Getting Started

PreviousIntroductionNext/extract-document

Last updated 1 year ago

Check out our for executable code examplesè

1. Create a new job (endpoint)

Before sending our request, we need to prepare a few steps:

  • We encoded the invoice PDF to base64 to pass it to our endpoint.

  • We decided on a that describes what we want to extract.

  • We created an here.

Command:

curl -X POST "https://waveline.ai/api/v1/extract-document" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer $WAVELINE_API_KEY" \
     -d '{
          "fileName": "invoice.pdf",
          "contentType": "application/pdf",
          "base64Content": "RGVhciBSZXNvcnQgQXJvbWEsCgpJ...",
          "shape": [
            {
              "name": "total",
              "type": "number",
              "description": "Total amount due of the invoice",
              "isArray": false
            }
          ]
        }' 

Output:

{
    "id": "a5ecc735-c48e-43ea-a739-d42bfb19edb3",
    "status": "CREATED",
    "type": "extract",
    "result": null,
    "urls": {
        "get": "https://waveline.ai/api/v1/jobs/a5ecc735-c48e-43ea-a739-d42bfb19edb3"
    }
}

In the returned response, we can see the id of the created job. We can now see if the job is still running or already finished by querying the job endpoint with that id. To make things convenient, we already provide this URL in urls["get"].

We can easily query the jobs current state using another request:

curl "https://waveline.ai/api/v1/jobs/a5ecc735-c48e-43ea-a739-d42bfb19edb3" \
     -H "Authorization: Bearer $WAVELINE_API_KEY"
{
    "id": "a5ecc735-c48e-43ea-a739-d42bfb19edb3",
    "status": "FINISHED",
    "type": "extract",
    "result": {
        "total": 330.75,
     },
    "urls": {
        "get": "https://waveline.ai/api/v1/jobs/a5ecc735-c48e-43ea-a739-d42bfb19edb3"
    }
}

In the status field, we see that the job has finished, which means the result is also present in the result field.

2. Get the result/status of this job ( endpoint)

GettingStarted Notebook
extract-document
Shape
API key
job