Endpoints for management of files
Hypatos REST API (2.68.0)
The Hypatos API is organized around REST. The majority of the endpoints provide CRUD functionality for resources. The API is also exposing Intent Resources which mimic user intents or actions.
The Hypatos API uses OAuth 2.0 Client Credential Grant to authenticate requests. Before making any requests to any endpoint a client must authenticate with the authorization server and requests an access token from the token endpoint.
POST /auth/token HTTP/1.1
Host: api.cloud.hypatos.ai
Content-Type: application/x-www-form-urlencoded
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
grant_type=client_credentialsAuthorization header contains client_id:client_secret encoded as explained in RFC Client Password section.
If the authorization server authenticated the client successfully, an access token is issued. Here is an example successful response:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache
{
"access_token": "mF_9.B5f-4.1JqM",
"expires_in": 86400,
"scope": "enrichment.write files.read",
"token_type": "Bearer",
}This token can be used to authenticate the requests to API endpoints by sending a Bearer token in the Authorization HTTP header. The following example demonstrates how to use the access token to retrieve a list of documents.
GET /v2/documents HTTP/1.1
Host: api.cloud.hypatos.ai
Authorization: Bearer mF_9.B5f-4.1JqMChanges to this API are released regularly. We use Semantic Versioning 2.0.0 scheme for versioning so that the clients can identify any backward-incompatible changes easily. Briefly summarized one can say, if the MAJOR version of the new API version didn't change you can expect the new version to be backward-compatible.
In order to maximise the stability of our API, we institue rate limits for all of API endpoints. Clients who send too many requests over a given period of time will see error responses that show up as status code 429 Too Many Requests.
When you see error responses with status code 429, it means you exhausted your current quota and need to withhold from sending further requests until the quota is reset. We encourage you not to wait until you get a 429 error but to monitor your quota in each request. In each response you receive from the API, you will find HTTP headers providing the details about your current quota. Here is the list of the HTTP headers:
x-ratelimit-limit: Indicates the quota associated to the client in the current time-window followed by the description of the quota policy.x-ratelimit-remaining: Indicates the number of remaining requests in the current time-windowx-ratelimit-reset: Indicates the number of seconds until quota reset of the current time-window
Please note that IETF is currently in the process of publishing a standard for these headers. Please explore the draft for more details.
A basic technique to gracefully handle rate limits is watch for your quota permanently and increase the time between your request as the quota is decreasing. To recover from a 429 error you need a retry mechanism following an exponential backoff schedule.
Request
Request processing of a batch of files that were previously uploaded. The fileIds in the request body represent the identifiers of the files returned by the upload endpoint.
This is an asynchronous operation. A successful response confirms that the request has been accepted; the actual case creation is carried out in the background by AI Agents that analyze the file batch to determine which files belong to which case and what role each file plays. Use the returned fileBatchId to track the resulting cases via GET /cases.
The projectId in the request body is the identifier of the project in which the cases will be created.
The optional externalId and externalData fields will be associated with both the file batch and propagated to each case created from it.
Payload for processing the given file batch
List of file identifiers to be processed as a batch into cases.
Identifier of the project in which the cases will be created.
External identifier of the file batch. Can be used to link the batch with an identifier in your system. Will be propagated to all cases created from this batch.
- API EUhttps://api.cloud.hypatos.ai/v2/cases/process-file-batch
- API UShttps://api.cloud.hypatos.com/v2/cases/process-file-batch
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases/process-file-batch
- curl
- Java
- Python
- Node.js
- JavaScript
- basic
- withExternalData
curl -i -X POST \
https://api.cloud.hypatos.ai/v2/cases/process-file-batch \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"fileIds": [
"bf105800-594d-48df-a5df-4d9d0554708d",
"3efd83f6-5009-4f9f-bc0c-4891c9a44e06"
],
"projectId": "69bbd0fbf8dbeab5f8db7675"
}'File batch processing request accepted. Cases will be created asynchronously.
Identifier of the file batch. Can be used to retrieve the cases created from this batch via GET /cases once processing is complete.
List of file identifiers that are part of this batch.
{ "fileBatchId": "0e99a5b2-9010-4e86-a906-19c45e903fe8", "fileIds": [ "2a77b5c8-30de-4e35-b078-3bba981cf80c", "2c6fe52d-26c0-4a7a-80a9-97d497b1a078" ], "projectId": "69bbd1d72f6eb584a70e79f0" }
Request
Manually create a case from a list of previously uploaded files. Each file in the request must be accompanied by a type indicating the role the file plays in the case (e.g. main document, attachment).
This is the manual case creation path, intended for API clients that determine case composition directly, as opposed to the AI-driven case creation triggered by POST /cases/process-file-batch.
This is an asynchronous operation. A successful response confirms that the request has been accepted and returns the identifier of the case being created. The case will be processed in the background.
The projectId in the request body is the identifier of the project in which the case will be created.
Payload for creating a case
List of files to include in the case, each with their assigned role.
Identifier of the file as returned by the upload endpoint.
The role the file plays in the case (e.g. mainDocument, attachment). Must only contain letters from the Latin alphabet with no whitespace or special characters.
Identifier of the project in which the case will be created.
External identifier of the case. Can be used to link the case with an identifier in your system.
- API EUhttps://api.cloud.hypatos.ai/v2/cases/create
- API UShttps://api.cloud.hypatos.com/v2/cases/create
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases/create
- curl
- Java
- Python
- Node.js
- JavaScript
- basic
- withExternalData
curl -i -X POST \
https://api.cloud.hypatos.ai/v2/cases/create \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"files": [
{
"id": "92b5be52-ce1e-4c74-b1ba-b6897c5d447a",
"type": "salesOrder",
"mainFile": true
},
{
"id": "76bf4146-3ab2-4a8b-8c93-081f1de780b7",
"type": "attachment",
"mainFile": false
}
],
"projectId": "69bbd13093eba3eee76f3918"
}'{ "caseId": "8512a5dd-91b9-4363-a869-db17394a955d", "projectId": "69bbd20e5c155a70e763bc8d" }
Used to retrieve cases belonging to specific projects only. Multiple project identifiers can be provided. By default, cases from all accessible projects are returned.
Limit the amount of items returned in the response. If the value exceeds the maximum, then the maximum value will be used.
The field to sort reponse items by.
Used to retrieve cases that are in specific states only. Multiple states can be used for this filtering. By default, cases in all states are returned.
- API EUhttps://api.cloud.hypatos.ai/v2/cases
- API UShttps://api.cloud.hypatos.com/v2/cases
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases
- curl
- Java
- Python
- Node.js
- JavaScript
curl -i -X GET \
'https://api.cloud.hypatos.ai/v2/cases?projectIds=string&offset=0&limit=20&sort=createdAt&state=done&fileBatchId=string' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'List of cases
Indicates whether the case was transferred successfully to the target system. Will be null if the transfer status is not yet known (e.g. because the case is still being processed or the transfer information has not been provided yet).
May contain additional information about the transfer, especially in the case of a failed transfer.
List of files that are part of the case, each with their assigned role and main document flag.
Identifier of the file as returned by the upload endpoint.
The role the file plays in the case (e.g. mainDocument, attachment). Must only contain letters from the Latin alphabet with no whitespace or special characters.
Entities extracted from the case by the AI Agents.
Identifier of the file batch this case was created from. Only present for cases created via POST /cases/process-file-batch.
Identifier of the file used as the case preview, if any.
The limit used for this page of results. This will be the same as the limit query parameter unless it exceeds the maximum allowed value.
The offset used for this page of results. This will be the same as the offset query parameter.
{ "data": [ { … } ], "limit": 20, "offset": 0, "totalCount": 1000 }
- API EUhttps://api.cloud.hypatos.ai/v2/cases/{id}
- API UShttps://api.cloud.hypatos.com/v2/cases/{id}
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases/{id}
- curl
- Java
- Python
- Node.js
- JavaScript
curl -i -X GET \
https://api.cloud.hypatos.ai/v2/cases/d43447fc-4e23-42e2-86cc-b35e16fa5e6f \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'Case retrieved.
Indicates whether the case was transferred successfully to the target system. Will be null if the transfer status is not yet known (e.g. because the case is still being processed or the transfer information has not been provided yet).
May contain additional information about the transfer, especially in the case of a failed transfer.
List of files that are part of the case, each with their assigned role and main document flag.
Identifier of the file as returned by the upload endpoint.
The role the file plays in the case (e.g. mainDocument, attachment). Must only contain letters from the Latin alphabet with no whitespace or special characters.
Entities extracted from the case by the AI Agents.
Identifier of the file batch this case was created from. Only present for cases created via POST /cases/process-file-batch.
Identifier of the file used as the case preview, if any.
{ "id": "69c5a545-7b2f-4f4a-833b-45feff1056c7", "createdAt": "2020-01-01T15:00:00Z", "createdBy": "string", "completedAt": "2020-01-01T15:00:00Z", "completedBy": "string", "updatedAt": "2020-01-01T15:00:00Z", "updatedBy": "string", "transferSuccessful": true, "transferMessage": "Upload failed due to ERP being down", "files": [ { … } ], "entities": { "currency": "EUR", "items": [ … ], "number": "2018-DE-0011122351", "qty": 2 }, "externalId": "case-0001", "externalData": { "internalSystemId": "sap-01" }, "projectId": "69bbd22c92f3c3ee4a097784", "fileBatchId": "a1b0020b-8ef9-4801-aeef-979224af0bab", "previewFileId": "197c997c-4bab-41e7-b33d-bad287046914", "state": "done", "url": "https://example.com/cases/6040dc9680b782b365ea77d5" }
- API EUhttps://api.cloud.hypatos.ai/v2/cases/{id}/transfer
- API UShttps://api.cloud.hypatos.com/v2/cases/{id}/transfer
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases/{id}/transfer
- curl
- Java
- Python
- Node.js
- JavaScript
- success
- failure
curl -i -X POST \
'https://api.cloud.hypatos.ai/v2/cases/{id}/transfer' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"successful": true
}'Request
Download the files that are part of a case. The response format is determined by the Accept header:
multipart/mixed— returns all files as a multipart response, where each part contains the binary content of a file with its ownContent-TypeandContent-Dispositionheaders. This allows the client to iterate over the parts and attach each file individually to a workflow without any unzipping.application/zip— returns all files packaged as a ZIP archive. Each file is stored under its original filename as provided during upload. Use this if your HTTP client does not support multipart response parsing.
The files returned can be filtered by their mainFile flag or by their type using the query parameters below. If no filters are provided, all files of the case are returned.
- API EUhttps://api.cloud.hypatos.ai/v2/cases/{id}/files
- API UShttps://api.cloud.hypatos.com/v2/cases/{id}/files
- Mock serverhttps://hypatos.redocly.app/_mock/openapi/cases/{id}/files
- curl
- Java
- Python
- Node.js
- JavaScript
curl -i -X GET \
'https://api.cloud.hypatos.ai/v2/cases/{id}/files?mainFile=true&type=string' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>'Files of the case.
- multipart/mixed
- application/zip
A multipart response where each part corresponds to one file of the case. Each part contains the binary content of the file and the following headers:
Content-Type: the media type of the file (e.g.application/pdf,image/jpeg)Content-Disposition: contains the filename of the fileX-Hy-File-Id: the identifier of the fileX-Hy-File-Type: the type of the file as defined in the caseX-Hy-File-Main:trueif this is the main file of the case,falseotherwise
- multipart/mixed
- application/zip
--boundary-separator
Content-Type: application/json
{}
--boundary-separator
Content-Type: application/json
{}
--boundary-separator
Content-Type: application/json
{}
--boundary-separator--