Contract.fit API
This OpenAPI describes the API exposed by the contract.fit backend.
Security
Authentication
All endpoints are protected: you need to make authenticated calls. There are 3 authentication mechanisms:
- HTTP Basic (Username + Password)
- JWT Token
- API-Key
By default you should have an account allowing you to bootstrap your tenant and create users and roles, using Basic Auth or after creating a Token - see /auth endpoints.
If you are missing credentials or permissions, please .
Authorization
The security system is RBAC based: users must be granted scoped roles, allowing them to access resources. Each role grants a defined set of permissions, which can be restricted to a given inbox or document - see /roles endpoints.
Upload and Processing
Below is a short description of common use cases of the API.
Simple Upload
The easiest and simplest way to get started is to use POST /documents : it will make a synchronous upload of your file and wait for the result.
This is a simplified version of POST /documents/{inbox_id} with less arguments and settings; it may not be suitable for real workload as it offers less capabilities.
Upload to Inbox
The favored endpoint to upload files is POST /documents/{inbox_id}: it is also highly recommended to make async call using sync=false.
Sync / Async
For convenience uploads can be synchronous: it will make the request blocks until the document is processed.
It is however discouraged to rely on sync requests, as our service is designed to process documents asynchronously. You might run into timeouts and unprocessed document depending on factors such as server load and number of pending documents.
Asynchronous calls will only schedule the processing and directly return the document ID without waiting: the document will be processed as soon as possible. You can then wait for the processed result using GET /documents/{document_id}.
Reprocessing
You can reprocess a document using POST /documents/{document_id}/reprocess : it will schedule an async processing of the document (note: it is not possible to make a sync reprocessing)
- Homepage
- https://api.apis.guru/v2/specs/contract-p.fit/1.0.json
- Provider
- contract-p.fit
- OpenAPI version
- 3.0.0
- Spec (JSON)
- https://api.apis.guru/v2/specs/contract-p.fit/1.0/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/contract-p.fit/1.0/openapi.yaml
Tools (137)
Extracted live via the executor SDK.
-
about.getReleaseNotesGET /about/release_notes
-
about.getVersionGET /about/version
-
auth.deleteApiKeyResourceCompletely remove an API Key, thus disabling it. The token won't be recoverable
Permission required: edit_backend_settings
-
auth.getApiKeyResourcePermission required: view_api_keys
-
auth.getApiKeysInboxResourcePermission required: view_api_keys
-
auth.getApiKeysResourcePermission required: view_api_keys
-
auth.patchApiKeyResourceroles can't be modified after creation: you need to create a new token if you want other roles.
Permission required: edit_backend_settings
-
auth.postApiKeysInboxResourceThe requesting user needs to have inbox level permissions
API Keys are simple randomly generated strings bound to roles that grant access to resources.
Every API Key maps to attributes defining its validity and can be revoked at any time.
API Key can be passed in the X-API-Key HTTP Header and in the querystring &api_key=
Permission required: edit_backend_settings
-
auth.postApiKeysResourceAPI Keys are simple randomly generated strings bound to roles that grant access to resources.
Every API Key maps to attributes defining its validity and can be revoked at any time.
API Key can be passed in the X-API-Key HTTP Header and in the querystring &api_key=
Permission required: edit_backend_settings
-
auth.postAuthLogin with the provided credentials (POST data) and return a JWT Token for this user.
-
auth.postEphemeralTokenResourceEphemeral tokens are short lived tokens that can be used to temporary grant access to resources.
-
auth.postGetJwtResourceThis endpoint is deprecated : use /auth/ephemeral and /auth/token instead
This endpoint requires authentication and requires the user to have the role edit_users: you can then request a JWT on behalf of another user, specified in the request username attribute.
This endpoint has 2 modes depending on the presence or absence of the roles attribute in the request data:
Regular token
When sending only a username: a regular JWT Token bound to the given user is created and returned.
Temporary token
When sending username AND a list roles of role (defined by the UID, optional the inbox to restrict access to): a temporary token is created that will behave like a regular user with the given roles until the access token expires.
Permission required: edit_users
-
auth.postResetPasswordReset the user password
-
auth.postTokenResourceBearer tokens can be used to authenticated without session or without sending credentials.
If the user making the request has sufficient privileges, he is allowed to create a token on behalf of another user. Otherwise only a token for the request current user is allowed.
Permission required: edit_users
-
connections.deleteConnectionResourceDelete the given connection.
WARNING This will completely remove the connection, this is not recoverable
Permission required: edit_integrations
-
connections.getConnectionResourceReturn the connection attributes
Permission required: edit_integrations
-
connections.getConnectionsResourceReturn the list of set up connections
Permission required: edit_integrations
-
connections.patchConnectionResourceattributes
Permission required: edit_integrations
-
connections.postConnectionsResourceCreate a new connection bound to the given scope (can be a project or inbox)
Permission required: edit_integrations
-
dataRetentionSettings.deleteDataRetentionResourcePermission required: edit_data_retention_settings
-
dataRetentionSettings.getDataRetentionResourcePermission required: read_data_retention_settings
-
dataRetentionSettings.getDataRetentionSettingsLevelIdPermission required: read_data_retention_settings
-
dataRetentionSettings.patchDataRetentionResourcePermission required: edit_data_retention_settings
-
documents.deleteDocumentDeleteResourcehow parameter: if how == "FULL", we delete the entire document, including its source files if how == "SOURCE_FILES", we only remove the (source) files and we set the archived flag. In practice this means all information in the database (json) remains available, but you can no longer download / visualise the original document.
WARNING The removal (of source files and in the database) is permanent
Permission required: review
-
documents.getDocumentDeleteResourceSimple endpoint that will fetch the given document
Permission required: review
-
documents.getDocumentLastVersionResourceGet the latest possible version for this document, optionally with constraints on the source or name
Permission required: review
-
documents.getDocumentOriginalFileResourceReturn the document original file, as attachment.
Permission required: review
-
documents.getDocumentPageImageResourceGET /documents/{document_id}/page/{page_range}
-
documents.getDocumentPageImageThumbnailResourceGET /documents/{document_id}/page_thumbnail/{page_range}
-
documents.getDocumentReverseResourceGET /documents/{document_id}/reverse/{page_range}
-
documents.getDocumentTextResourceReturn the optimal text for the document; will either be the OCR text, the native text, the raw text or a translated version.
To ease the data volume from the DB, we lazy load only the relevant text for the document.
Permission required: review
-
documents.getDocumentTransformResourceIf you have a custom output configured (this is set by contract.fit team), This allows you to get the custom output formatted document.
Permission required: review
-
documents.getDocumentWorkflowResourceWARNING experimental use only
Permission required: upload
-
documents.patchDocumentCopyResourceCopy documents in the provided list to another inbox.
If the destination inbox is the same as the original inbox, the request will be aborted, no duplicates will be created
Permission required: review
-
documents.patchDocumentMoveResourceMove documents in the provided list to another inbox.
If the destination inbox is the same as the original inbox, the request will be aborted.
Permission required: review
-
documents.postDocumentCompareVersionsResourcePOST /documents/{document_id}/compare_versions
-
documents.postDocumentCustomOutputResourceUsing the provided filter on documents, will generate a custom output.
Note: only excel output is supported at the moment.
Permission required: review
-
documents.postDocumentDataResourcePOST /documents/file_query/{data_type}
-
documents.postDocumentProcessTableAnnotationA fast and convenient annotation tool that converts a table-level annotation to cell-level feedback.
Permission required: review
-
documents.postDocumentQueryPOST /documents/query/{query_type}
-
documents.postDocumentsResourceThis endpoint uploads a new file to the given inbox and will process the file.
Upload mode: sync
When sync=true (default), the call will block and wait for the processing to complete.
If you have a custom output configured (this is set by contract.fit team), passing mimetype application/vnd.cf.custom will allow you to get the custom output formatted result
Since it might yield inconsistent results if a timeout is raised while waiting, it is recommended to use the async mode.
Upload mode: async
When sync=false, the call will schedule the processing and return without waiting for completion. It will return the document ID, so that the processed document can be retrieved at a later date.
Permission required: upload
-
documents.postDocumentStatusDataResourceUpdate the given document status data with the request user and date.
Each document defines some status:
- lock
- escalate
- reject
- delete
- archive
- submitted
These fields have 3 attributes:
- status true / false
- since: datetime (UTC)
- by: user ID
By calling this endpoint you can update the given status data with the request user (the one authenticated) and the current datetime. Note : You cannot pass a user in the request nor a datetime
Permission required: review
-
documents.postDocumentSubmitEvalResourceSend a feedback for the given document and optionally evaluate.
When a document is to be reviewed, this endpoint is used to send the user feedback.
Permission required: submit
-
documents.postEnrichmentResourcePOST /documents/enrich
-
documents.postReprocessDocumentResourceThis endpoint schedules (async) reprocessing for the given document; it will call the async processing with the given desired version name, similar to the async document upload but skipping OCR. It works asynchronously, so results need to be consulted by a separate call (or webhook)
Permission required: upload
-
documents.postSimpleDocumentsResourceThis endpoint is a simplified version of the upload document to inbox one - synchronous mode.
The upload file will be upload to the given inbox if provided, else fallback to the invoice inbox. The file will be processed synchronously, ie the request will blocks until the document was processed or until it timeout; in this case the document might not be correctly processed.
For a more reliable processing use the /documents/{inbox_id} endpoint in async mode
Permission required: upload
-
formats.deleteFormatResourceWARNING This will completely remove the documents, this is not recoverable
Permission required: edit_format_settings
-
formats.getFormatResourceReturn the given format attributes
Deprecated: display_name Deprecated: default_format
Permission required: edit_format_settings / review
-
formats.getFormatsDocTypesResourcePermission required: edit_format_settings
-
formats.getFormatsResourceReturn the formats
Deprecated: display_name Deprecated: default_format
-
formats.getFormatTagFieldsResourceGet the tag fields values bound to the given scope.
Scope can be an inbox or a project
Permission required: edit_format_settings / review
-
formats.patchFormatResourcesettings with the given attributes
Deprecated: display_name Deprecated: default_format
Permission required: edit_format_settings
-
formats.postFormatsResourceCreate an new format
Deprecated: display_name Deprecated: default_format
Permission required: edit_format_settings
-
inboxes.deleteInboxDocumentResourcein the given inbox.
how parameter: if how == "FULL", we delete the entire document, including its source files if how == "SOURCE_FILES", we only remove the (source) files and we set the archived flag. In practice this means all information in the database (json) remains available, but you can no longer download / visualise the original document.
what parameter: if what == "DONE", we will only delete files which have status_data.feedback == True if what == "ALL" we will delete all files
Start_date and end_date: when specified we will only delete files which are received after (respectively before) the timestamp
WARNING This will completely remove the documents, this is not recoverable
-
inboxes.deleteInboxResourceDelete the given inbox.
WARNING This will completely remove the inbox, this is not recoverable
-
inboxes.getInboxDocumentResourcePermission required: view_list
-
inboxes.getInboxDocumentVersionsResourceGET /inboxes/{inbox_id}/document_versions
-
inboxes.getInboxesResourceSimply return the list of inboxes
-
inboxes.getInboxPaginatedResourcePermission required: view_list
-
inboxes.getInboxResourceGet the given inbox attributes
Permission required: view_list
-
inboxes.patchInboxResourceUpdate the given inbox with the provided arguments
Permission required: view_list
-
inboxes.postInboxesResourceCreate a new inbox in the given project
Permission required: create_inbox
-
inboxes.postInboxReprocessResourceThis endpoint schedule reprocessing for documents in the given inbox; this will call the async processing, just like async document upload
Permission required: upload
-
integrations.deleteIntegrationResourceDelete the given integration.
WARNING This will completely remove the integration, this is not recoverable
Permission required: edit_integrations
-
integrations.getEmailIntegrationActivationResourceGET /integrations/{integration_id}/activate
-
integrations.getIntegrationResourceReturn the given integration attributes
Permission required: read_integrations
-
integrations.getIntegrationResourcesReturn the list of set up integrations
Permission required: read_integrations
-
integrations.patchIntegrationResourceUpdate the given integration attributes
Permission required: edit_integrations
-
integrations.postIntegrationResourcesCreate a new integration. Each type of integration has its own initialization logic and thus may yield suitable error codes depending on the underlying issue, such as credentials or connectivity issue.
Permission required: edit_integrations
-
predictorSettings.deletePredictorSettingResourcePermission required: edit_predictor_settings
-
predictorSettings.getPredictorSettingResourcePermission required: edit_predictor_settings
-
predictorSettings.getPredictorSettingsResourcePermission required: edit_predictor_settings
-
predictorSettings.patchPredictorSettingResourcePermission required: edit_predictor_settings
-
projects.deleteProjectResourceDelete the given project.
WARNING This will completely remove the project, this is not recoverable
Permission required: edit_format_settings
-
projects.getProjectResourceGet the attributes of the given project
Deprecated: default_format
-
projects.getProjectsResourceReturn the list of projects in the organization
Deprecated: default_format
-
projects.patchProjectResourceUpdate the project attributes with the provided arguments
Deprecated: default_format
Permission required: edit_format_settings
-
projects.postProjectsResourceSimply create a new project
Deprecated: default_format
Permission required: create_inbox
-
reports.deleteReportResourceDelete the given report.
WARNING This will completely remove the report, this is not recoverable
Permission required: edit_reports
-
reports.getReportResourceReturn report attributes
Permission required: read_reports
-
reports.getReportsResourceReturn the list of reports
Permission required: read_reports
-
reports.patchReportResourceModify the report with the given arguments
Permission required: edit_reports
-
reports.postGenerateReportIdResourceNote: start_date and end_date filter on status update
Permission required: read_reports
-
reports.postGenerateReportResourceNote: start_date and end_date filter on status update
Permission required: read_reports
-
reports.postReportsResourceCreate a new report
Permission required: edit_reports
-
roles.deleteRoleResourceDelete the given role.
WARNING This will completely remove the role, this is not recoverable
Permission required: edit_users
-
roles.getRoleResourceReturn role attributes
-
roles.getRolesResourceReturn the list of roles
-
roles.patchRoleResourceModify the role with the given arguments
Permission required: edit_users
-
roles.postRolesResourceCreate a new role
Permission required: edit_users
-
ruleConfig.deleteRuleConfigResourcePermission required: edit_predictor_settings
-
ruleConfig.getRuleConfigResourcePermission required: edit_predictor_settings
-
ruleConfig.getRuleConfigsResourcePermission required: edit_predictor_settings
-
ruleConfig.patchRuleConfigResourcePermission required: edit_predictor_settings
-
ruleConfig.postDebugRuleEntityDocumentResourcePermission required: edit_predictor_settings
-
ruleConfig.postDebugRuleEntityResourcePermission required: edit_predictor_settings
-
ruleConfig.postDebugWhereToSearchReturns a list of strings per granularity. If no granularity is specified. It is considered to be the whole document
Permission required: edit_predictor_settings
-
samplingSettings.deleteSettingSamplingResourcePermission required: edit_sampling_settings
-
samplingSettings.getSettingSamplingResourcePermission required: edit_sampling_settings / review
-
samplingSettings.getSettingSamplingsResourcePermission required: edit_sampling_settings / review
-
samplingSettings.patchSettingSamplingResourcePermission required: edit_sampling_settings
-
settings.getDashboardSettingsAtomicResourceGet the dashboard settings for the given scope (project or inbox)
-
settings.getReviewSettingsAtomicResourceGet the review settings for the given scope (project or inbox)
-
settings.patchDashboardSettingsAtomicResourceUpdate the dashboard settings for the given scope (project or inbox)
Permission required: edit_dashboard_settings
-
settings.patchReviewSettingsAtomicResourceUpdate the review settings for the given scope (project or inbox)
Permission required: edit_review_settings
-
sso.deleteSsoConfigResourcesReturn the given integration attributes
Permission required: edit_integrations
-
sso.getSsoConfigResourcesGET /sso/config
-
sso.postOauthLoginResourcePOST /sso/login
-
sso.postSsoConfigResourcesPOST /sso/config
-
stats.getAccuracyResourcePermission required: view_statistics
-
stats.getAutomationBlockersStatsPermission required: view_statistics
-
stats.getEvaluatedVersionsIf filter_on_version_date is True, the document versions are filtered by timestamp, otherwise, documents are filtered by receive_time.
Permission required: view_statistics
-
stats.getProcessingStatsThis endpoint is in preview and its interface may change.
Compute statistics over the documents in the inbox. These stats include:
- mean
- min
- max
- standard deviation
- 50th percentile
- 95th percentile
- 99th percentile
Documents are grouped by their page count: this is currently the only supported group by attribute.
Documents can be further filter by any given start or end date: the filter will apply to the start processing date, and not to the done date.
Permission required: view_statistics
-
stats.getStatsResourceCompute and return statistics on the given inbox, optionally restricted to a date range and a field.
Stats will return per field:
- accuracy
- precision
- f1 score
- recall
Note Depending on the date range and fields, computation might be intensive
Permission required: view_statistics
-
stats.getStpResourcePermission required: view_statistics
-
stats.getUsageStatsResourceGET /stats/usage
-
stats.getVolumeStatsPermission required: view_statistics
-
stats.postBlueDotsResourceCompute and return the blue dots statistics, optionally restricted to date range, fields and versions
Permission required: submit
-
style.getStyleLogoResourceGet the custom logo
-
style.getStyleSheetResourceGet the custom CSS file
-
style.postStyleLogoResourcePermission required: edit_dashboard_settings
-
style.postStyleSheetResourcePermission required: edit_dashboard_settings
-
tenant.deleteTenantResourceDELETE /tenant
-
tenant.patchActivateTenantResourcePATCH /tenant/activate
-
thresholdSettings.deleteSettingThresholdResourcePermission required: edit_thresholds_settings
-
thresholdSettings.getSettingsThresholdResourcePermission required: read_thresholds_settings / review
-
thresholdSettings.getSettingThresholdResourcePermission required: read_thresholds_settings / review
-
thresholdSettings.patchSettingThresholdResourcePermission required: edit_thresholds_settings
-
users.deleteUserResourceDelete the given user.
WARNING This will completely remove the user, this is not recoverable
-
users.getMeReturn user info of the authenticated used making the call
-
users.getUserResourceReturn user attribute
Permission required: edit_users
-
users.getUsersResourceReturn the list of users
Permission required: edit_users
-
users.patchUserResourceUpdate the given user with the provided attributes
Permission required: edit_users
-
users.postChangePasswordUpdate the current authenticated user password
-
users.postUsersResourceCreate a new user with the provided attributes and roles
Permission required: edit_users
-
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools