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
Parameter | Description |
---|---|
|
Active content profile. Provided to you as part of the onboarding process |
Request body
Path | Type | Description |
---|---|---|
|
|
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 |
---|---|---|
|
|
ID of the created document |
|
|
Indication of whether the request succeeded ( |
2.2. File Endpoint
2.2.1. Request
Path Parameters
Parameter | Description |
---|---|
|
Active content profile. Provided to you as part of the onboarding process |
Request parts
Part | Description |
---|---|
|
The file containing the document to analyze |
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 |
---|---|---|
|
|
ID of the created document |
|
|
Indication of whether the request succeeded ( |
3. Fetch key concepts
A GET
fetches key concepts, given a documentId
.
3.2. Request
3.2.1. Path Parameters
Parameter | Description |
---|---|
|
Active content profile. Provided to you as part of the onboarding process |
|
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 |
---|---|---|
|
|
ID of the document |
|
|
List of key concepts |
|
|
ID of the concept |
|
|
Plain text of the concept |
|
|
Indication of whether the request succeeded ( |
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
Parameter | Description |
---|---|
|
Active content profile. Provided to you as part of the onboarding process |
4.2.2. Query string parameters
Parameter | Description |
---|---|
|
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 |
---|---|---|
|
|
ID of the document |
|
|
List of key concepts |
|
|
ID of the concept |
|
|
Plain text of the concept |
|
|
Indication of whether the request succeeded ( |
5. Fetch key sentences
A GET
fetches key sentences, given a documentId
.
5.2. Request
5.2.1. Path parameters
Parameter | Description |
---|---|
|
Active content profile. Provided to you as part of the onboarding process |
|
ID of a previously created document |
5.2.2. Query string parameters
Parameter | Description |
---|---|
|
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 |
---|---|---|
|
|
ID of the document |
|
|
List of key sentences |
|
|
ID of the sentence |
|
|
Plain text of the sentence |
|
|
Indication of whether the request succeeded ( |