Level Four AB

API services

These are mostly services extracted from our document and collaboration system Tinder.

Available services

Quotas and limits

We currently limit services to 500 requests per IP and day, the quota is shared between all services. If your needs exceed this or you want to know more about commercial use feel free to contact us at hello@levelfour.se.

Tag suggestion

Suggest suitable tags for an input text. Currently suggests up to five tags for Swedish texts.

Request format

Endpoint: http://api.l4.se/text/v1/tags
Limits: Size of the request body should be smaller than 512 KiB
Method: POST
Headers:
Content-Type: application/json

The body of the post should be correctly formatted JSON (with the correct content type set). The main request looks like this:

{ language: "sv", parts: [] }

The language field may be omitted for Swedish texts. The parts list should contain one or more text parts with an optional boost:

{ boost: 1.0, text: "" }

Use boost to prioritize tags for certain text parts. The default value is 1.0.

Response format

The server returns a JSON object with a list of strings named tags.

{ tags: [ "tag 1", "tag 2" ] }

Example

Request:
curl -X POST --header "Content-Type: application/json" \
--data-binary "{ \"parts\": [ { \"text\": \"Tinder är en webbtjänst som hjälper er jobba som ni vill. Vi knyter ihop era dokument, medarbetare och diskussioner i en lättanvänd och snabb samarbetsplattform.\" } ] }" \
http://api.l4.se/text/v1/tags
Response:
{"tags":["Samarbetsplattform","Webbtjänst","Dokument","Diskussion","Medarbetare"]}

Language detection

Detect the language of the given text.

Request format

Endpoint: http://api.l4.se/text/v1/language
Limits: Size of the text body should be smaller than 512 KiB
Method: POST
Headers:
Content-Type: text/plain

Send the text as the body of the request.

Response format

{ "language": "en", "kindOfCertain": false }

The response contains the detected language (if any) and if we can be fairly certain that we detected the correct language. Please note that large amounts of text is needed to be certain of the language.

Example

Request:
curl -X POST --header "Content-Type: text/plain" \
--data-binary "Bacon is one of the most awesome things ever." \
http://api.l4.se/text/v1/language
Response:
{"language":"en","kindOfCertain":false}

Text extraction

Take a binary file and extract text from it. Several types of files such as DOCX, PDF, XLS and so on are supported.

Request format

Endpoint: http://api.l4.se/text/v1/extract
Limits: Size of body should be smaller than 25 MiB
Method: POST
Headers:
Content-Type: type_if_known
X-Name: original_name_if_any

Send the binary file as the request body.

Response format

The text is returned as text/plain.

Example

Request:
curl -X POST --data-binary @filename http://api.l4.se/text/v1/extract
Response:
Text in input file

OCR scanning

Submit an image file and run an OCR scan on it. Useful primarily if you have a document consisting of scanned images.

Request format

Endpoint: http://api.l4.se/text/v1/ocr
Limits: Size of file should be smaller than 25 MiB
Method: POST
Headers:
Content-Type: image/png, image/jpeg or image/tiff depending on input
X-Language: Two letter language code (sv, en, no, etc)

Send the binary file as the request body. The larger the image file the better the text output.

Response format

The text is returned as text/plain. If an error occurs due to a corrupt or unknown image file a response with status 400 (Bad Request) will be returned. The same goes for if the language you are trying to use is not supported.

Example

Request:
curl -X POST --header "X-Language: en" --header "Content-Type: image/png" --data-binary @filename http://api.l4.se/text/v1/ocr
Response:
Text in input file.