1. Overview

The Document API provides access to processing and analyzing documents.

Note that injected documents will expire 30 days after creation. Trying to access expired or unknown documents will result in a HTTP 410 - Gone.

1.1. Contact information

Need help, or want to know how to access our APIs? Reach out to hello@unsilo.ai

1.2. Content types

All requests and responses are of type application/json in UTF-8 encoding.

2. Submit Document for analysis

A POST creates a new document and returns the documentId useful for further requests.

2.1. Text Endpoint

2.1.1. Request

Path Parameters
Table 1. /api/documents/v1/{contentProfile}/documents
Parameter Description

contentProfile

Active content profile. Provided to you as part of the onboarding process

Request body
Path Type Description

text

String

The full text of the document to analyze

Example Request
$ curl 'https://services.unsilo.com/api/documents/v1/your_provided_content_profile/documents' -i -u 'username:password' -X POST \
    -H 'Content-Type: application/json' \
    -d '{"text":"Star Wars is a science fiction saga that takes place in \"a distant, remote galaxy a long time ago\". The first film in the series came in 1977, and since then, the films have evolved into a definite franchise that includes nine movies, several computer games, books, fanfiction novels, more fan movies and more. The universe and story was founded by George Lucas, and is among others characterized by a very large fictional universe with several parallel actions and a rich background for history. The movies have a very big fan base around the world."}'

2.1.2. Response

Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "documentId" : "realtime-961b4502-6592-4409-bdbd-f6302b760630",
  "apiResponseStatus" : "SUCCESS"
}
Response fields
Path Type Description

documentId

String

ID of the created document

apiResponseStatus

String

Indication of whether the request succeeded (SUCCESS) or failed (FAILED)

2.2. File Endpoint

2.2.1. Request

Path Parameters
Table 2. /api/documents/v1/{contentProfile}/documents/file
Parameter Description

contentProfile

Active content profile. Provided to you as part of the onboarding process

Request parts
Part Description

file

The file containing the document to analyze

Max file size: 70MB

Supported MIME types:
- application/x-pdf (.pdf)
- application/pdf (.pdf)
- application/msword (.doc)
- application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx)
- text/plain (.txt)

Example Request
$ curl 'https://services.unsilo.com/api/documents/v1/your_provided_content_profile/documents/file' -i -u 'username:password' -X POST \
    -H 'Content-Type: multipart/form-data' \
    -F 'file=@your_file.txt;type=text/plain'

2.2.2. Response

Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "documentId" : "realtime-69d60f69-3ea0-4a7b-9fec-71ed0ac24639",
  "apiResponseStatus" : "SUCCESS"
}
Response fields
Path Type Description

documentId

String

ID of the created document

apiResponseStatus

String

Indication of whether the request succeeded (SUCCESS) or failed (FAILED)

3. Fetch key concepts

A GET fetches key concepts, given a documentId.

3.2. Request

3.2.1. Path Parameters

Table 3. /api/documents/v1/{contentProfile}/documents/{documentId}/concepts
Parameter Description

contentProfile

Active content profile. Provided to you as part of the onboarding process

documentId

ID of a previously created document

3.2.2. Example Request

$ curl 'https://services.unsilo.com/api/documents/v1/your_provided_content_profile/documents/realtime-961b4502-6592-4409-bdbd-f6302b760630/concepts' -i -u 'username:password' -X GET

3.3. Response

3.3.1. Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "documentId" : "realtime-961b4502-6592-4409-bdbd-f6302b760630",
  "concepts" : [ {
    "id" : "starwar",
    "text" : "Star Wars"
  }, {
    "id" : "fictscy",
    "text" : "Science Fiction"
  }, {
    "id" : "some_concept_id",
    "text" : "Some concept"
  } ],
  "apiResponseStatus" : "SUCCESS"
}

3.3.2. Response fields

Path Type Description

documentId

String

ID of the document

concepts[]

Array

List of key concepts

concepts[].id

String

ID of the concept

concepts[].text

String

Plain text of the concept

apiResponseStatus

String

Indication of whether the request succeeded (SUCCESS) or failed (FAILED)

4. Fetch keywords

A GET fetches keywords, given a documentId. Keywords are more general concepts than key concepts

4.2. Request

4.2.1. Path Parameters

Table 4. /api/documents/v1/{contentProfile}/documents/keywords
Parameter Description

contentProfile

Active content profile. Provided to you as part of the onboarding process

4.2.2. Query string parameters

Parameter Description

documentId

ID of a previously created document

4.2.3. Example Request

$ curl 'https://services.unsilo.com/api/documents/v1/your_provided_content_profile/documents/keywords?documentId=realtime-961b4502-6592-4409-bdbd-f6302b760630' -i -u 'username:password' -X GET

4.3. Response

4.3.1. Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "documentId" : "realtime-961b4502-6592-4409-bdbd-f6302b760630",
  "concepts" : [ {
    "id" : "starwar",
    "text" : "Star Wars"
  }, {
    "id" : "fictscy",
    "text" : "Science Fiction"
  }, {
    "id" : "some_concept_id",
    "text" : "Some concept"
  } ],
  "apiResponseStatus" : "SUCCESS"
}

4.3.2. Response fields

Path Type Description

documentId

String

ID of the document

concepts[]

Array

List of key concepts

concepts[].id

String

ID of the concept

concepts[].text

String

Plain text of the concept

apiResponseStatus

String

Indication of whether the request succeeded (SUCCESS) or failed (FAILED)

5. Fetch key sentences

A GET fetches key sentences, given a documentId.

5.2. Request

5.2.1. Path parameters

Table 5. /api/documents/v1/{contentProfile}/documents/{documentId}/sentences
Parameter Description

contentProfile

Active content profile. Provided to you as part of the onboarding process

documentId

ID of a previously created document

5.2.2. Query string parameters

Parameter Description

limit

Maximum number of sentences fetched. Defaults to 5.

5.2.3. Example Request

$ curl 'https://services.unsilo.com/api/documents/v1/your_provided_content_profile/documents/realtime-961b4502-6592-4409-bdbd-f6302b760630/sentences?limit=5' -i -u 'username:password' -X GET

5.3. Response

5.3.1. Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "documentId" : "realtime-961b4502-6592-4409-bdbd-f6302b760630",
  "sentences" : [ {
    "id" : 174,
    "text" : "Star Wars is a science fiction saga that takes place in a distant, remote galaxy a long time ago."
  }, {
    "id" : 3,
    "text" : "The movies have a very big fan base around the world."
  } ],
  "apiResponseStatus" : "SUCCESS"
}

5.3.2. Response fields

Path Type Description

documentId

String

ID of the document

sentences[]

Array

List of key sentences

sentences[].id

Number

ID of the sentence

sentences[].text

String

Plain text of the sentence

apiResponseStatus

String

Indication of whether the request succeeded (SUCCESS) or failed (FAILED)