# smartTableExtraction

Unlock the potential of data within documents with our AI-driven Table Extraction solution. Using state-of-the-art artificial intelligence models, our system effortlessly identifies and extracts tables from a wide range of documents, be it reports, invoices, or research papers.

This innovative technology not only saves you valuable time and effort but also ensures unparalleled accuracy in data extraction. Whether you're in finance, research, or any industry reliant on structured information, our Smart Table Extraction solution empowers you to harness data effectively, improving decision-making, and productivity while reducing manual data entry errors.

### Limitations

Max File Size is **10 MB**\
Max requests per second: **1**\
Processing Time: **Up to the number of characters in an image**

### Licenses

All rights reserved by Laigo

### API Call<br>

## Upload file to smartInvoice

<mark style="color:green;">`POST`</mark> `https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction`

#### Query Parameters

| Name          | Type   | Description                                                   |
| ------------- | ------ | ------------------------------------------------------------- |
| threshold     | String | Set minimum probability to be reached by model                |
| email         | String | Define receiver email address                                 |
| outputFormats | String | Define output format(s) like CSV.                             |
| languageHint  | String | Define language of the file content with ISO code (ISO-639-1) |

#### Headers

| Name                                          | Type   | Description                                                      |
| --------------------------------------------- | ------ | ---------------------------------------------------------------- |
| accessToken<mark style="color:red;">\*</mark> | String | A JWT issued to your application by the Laigo identity provider. |

#### Request Body

| Name                                   | Type   | Description            |
| -------------------------------------- | ------ | ---------------------- |
| file<mark style="color:red;">\*</mark> | String | The file for uploading |

{% tabs %}
{% tab title="201: Created Returns Job Id" %}

{% endtab %}

{% tab title="400: Bad Request Incomplete request or insufficient Laigos" %}

{% endtab %}

{% tab title="401: Unauthorized Unauthorized call" %}

{% endtab %}
{% endtabs %}

### Code snippets

{% tabs %}
{% tab title="cURL" %}

```markup
curl -X POST "https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction" \
     -H "Authorization: Bearer my-accessToken-here" \
     -F "email=my-email-here" \
     -F "outputFormats=CSV" \
     -F "languageHint=EN" \
     -F "file=@my-file-location-here"
```

{% endtab %}

{% tab title="C#" %}

```csharp
string baseUrl = "https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction";
string email = "my-email-here";
string outputFormats = "CSV";
string languageHint = "EN";
string token = "Bearer my-accessToken-here";

using (HttpClient client = new HttpClient())
{
 string url = $"{baseUrl}?email={email}&outputFormats={outputFormats}&languageHint={languageHint}";
 var request = new HttpRequestMessage(HttpMethod.Post, url);
 request.Headers.Add("Authorization", token);
 var content = new MultipartFormDataContent();
 content.Add(new StreamContent(File.OpenRead("/my-file-location-here")), "file", "/my-file-location-here");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction"
headers = {
    "Authorization": "Bearer my-accessToken-here"
}
data = {
    "email": "my-email-here",
    "outputFormats": "CSV",
    "languageHint": "EN"
}
files = {
    "file": open("my-file-location-here", "rb")
}
response = requests.post(url, headers=headers, data=data, files=files)
response.raise_for_status()
print(response.text)
```

{% endtab %}

{% tab title="HTML & JavaScript" %}

```html
//note that running this code directly from the local file system might not work due to security restrictions.
<input type="file" id="fileInput">
<button id="uploadButton">Upload</button>

<script>
  document.getElementById('uploadButton').addEventListener('click', () => {
    const url = 'https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction';
    const token = 'Bearer my-email-here';

    const email = 'my-email-here';
    const outputFormats = 'CSV';
    const languageHint = 'EN';

    const fileInput = document.getElementById('fileInput');
    const file = fileInput.files[0];

    const formData = new FormData();
    formData.append('email', email);
    formData.append('outputFormats', outputFormats);
    formData.append('languageHint', languageHint);
    formData.append('file', file);

    const xhr = new XMLHttpRequest();
    xhr.open('POST', url);
    xhr.setRequestHeader('Authorization', token);

    xhr.onload = () => {
      if (xhr.status === 200) {
        console.log(xhr.responseText);
      } else {
        console.error('Request failed:', xhr.statusText);
      }
    };

    xhr.onerror = () => {
      console.error('Request failed');
    };

    xhr.send(formData);
  });
</script>
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();

$url = "https://use.laigo.io/api/FileUpload/v1/Upload/smartTableExtraction";
$headers = array(
    "Authorization: Bearer my-accessToken-here"
);

$fields = array(
    "email" => "my-email-here",
    "outputFormats" => "CSV",
    "languageHint" => "EN",
    "file" => "@my-file-location-here"
);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo "Error: " . curl_error($curl);
}

curl_close($curl);

echo $response;
?>
```

{% endtab %}
{% endtabs %}

### Example (Step by step)

1. First you need to have a document sample that you want to use with smartTableExtraction. It can be any document type such as: invoice, receipt, letter, email etc.&#x20;
2. Inorder to use our smartTableExtractiontool you need to have an API key which can be generated from [here](https://laigo.ai/make-your-first-request/).&#x20;
3.

```
<figure><img src="/files/WBjhvUgAGQxP3IQrd8Be" alt=""><figcaption></figcaption></figure>
```

{% hint style="info" %}
If you don’t have an account, first you need to set up your account then you can generate the API key. [Create an account here.](https://laigo.ai/setup-your-account/)
{% endhint %}

3. After you have generated your API key, then you can use smartTableExtractionany popular programming language, where you can find the code snippets [here](https://laigo.ai/smartclassify/).
4. Run your code. You will receive a JSON ID as response.

### Credits (Laigo)

The calculation of processing a page:

| Page | Laigos |
| ---- | ------ |
| 1    | 1      |

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.laigo.ai/smarttools-api/smarttableextraction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
