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.…
AI & machine learning#openapi#text
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
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 contact us.
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)
Endpoints 135
documents
- POSTUpload a new document
/documents/This 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,… - POSTGenerate custom output for documents
/documents/custom_outputUsing the provided filter on documents, will generate a custom output. Note: only excel output is supported at the moment. Permission required: review - POSTpost_enrichment_resource
/documents/enrich - POSTpost_document_data_resource
/documents/file_query/:data_type - POSTpost_document_query
/documents/query/:query_type - GETGet the document
/documents/:document_idSimple endpoint that will fetch the given document Permission required: review - DELETEDelete the document
/documents/:document_id?how=predictedhow 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… - POSTpost_document_compare_versions_resource
/documents/:document_id/compare_versions - GETGet custom output formatted document
/documents/:document_id/custom_outputIf 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:… - POSTSubmit a feedback
/documents/:document_id/feedbackSend 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… - GETGet latest version
/documents/:document_id/last_version?name=string&source=string&is_evaluated=falseGet the latest possible version for this document, optionally with constraints on the source or name Permission required: review - GETGet document original file
/documents/:document_id/original_fileReturn the document original file, as attachment. Permission required: review - GETget_document_page_image_resource
/documents/:document_id/page/:page_range - GETget_document_page_image_thumbnail_resource
/documents/:document_id/page_thumbnail/:page_range - POSTProcess a table-level annotation
/documents/:document_id/process_table_annotationA fast and convenient annotation tool that converts a table-level annotation to cell-level feedback. Permission required: review - POSTSchedule document reprocessing
/documents/:document_id/reprocess?name=reprocessed&reviewer=MachineThis endpoint schedules (async) reprocessing for the given document; it will call the async processing with the given desired version name, similar to the… - GETget_document_reverse_resource
/documents/:document_id/reverse/:page_range - POSTUpdate document status
/documents/:document_id/status_dataUpdate the given document status data with the request user and date. Each document defines some status: lock escalate reject delete archive submitted These… - GETGet the document text
/documents/:document_id/textReturn 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… - GETGet the document Workflow
/documents/:document_id/workflowWARNING experimental use only Permission required: upload - POSTUpload a new doc to the inbox
/documents/:inbox_idThis 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… - PATCHCopy documents to another inbox
/documents/:inbox_id/copy_inboxCopy 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… - PATCHMove documents to another inbox
/documents/:inbox_id/move_inboxMove 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…
inboxes
- GETGet list of inboxes
/inboxesSimply return the list of inboxes - POSTCreate an inbox
/inboxesCreate a new inbox in the given project Permission required: create_inbox - GETGet Inbox attributes
/inboxes/:inbox_idGet the given inbox attributes Permission required: view_list - DELETEDelete an inbox
/inboxes/:inbox_idDelete the given inbox. WARNING This will completely remove the inbox, this is not recoverable - PATCHUpdate inbox
/inboxes/:inbox_idUpdate the given inbox with the provided arguments Permission required: view_list - GETget_inbox_document_versions_resource
/inboxes/:inbox_id/document_versions - GETGet documents in the inbox
/inboxes/:inbox_id/documentsPermission required: view_list - DELETEDelete documents
/inboxes/:inbox_id/documents?how=FULL&what=ALL&start_date=2024-01-01T00:00:00Z&end_date=2024-01-01T00:00:00Zin 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… - GETGet paginated list of documents in the inbox
/inboxes/:inbox_id/paginated?page=1&per_page=20&start_receive_date=2024-01-01T00:00:00Z&end_receive_date=2024-01-01T00:00:00Z&order_by=stringPermission required: view_list - POSTSchedule inbox reprocessing
/inboxes/:inbox_id/reprocess?name=predicted&reviewer=MachineThis endpoint schedule reprocessing for documents in the given inbox; this will call the async processing, just like async document upload Permission…
projects
- GETGet the list of projects
/projectsReturn the list of projects in the organization Deprecated: default_format - POSTCreate a project
/projectsSimply create a new project Deprecated: default_format Permission required: create_inbox - GETGet project attributes
/projects/:project_idGet the attributes of the given project Deprecated: default_format - DELETEDelete project
/projects/:project_idDelete the given project. WARNING This will completely remove the project, this is not recoverable Permission required: edit_format_settings - PATCHUpdate project
/projects/:project_idUpdate the project attributes with the provided arguments Deprecated: default_format Permission required: edit_format_settings
formats
- GETGet lists of format
/formatsReturn the formats Deprecated: display_name Deprecated: default_format - POSTCreate format
/formatsCreate an new format Deprecated: display_name Deprecated: default_format Permission required: edit_format_settings - GETGet supported document_types
/formats/document_typesPermission required: edit_format_settings - GETGet format attributes
/formats/:format_idReturn the given format attributes Deprecated: display_name Deprecated: default_format Permission required: edit_format_settings / review - DELETEDelete the format
/formats/:format_idWARNING This will completely remove the documents, this is not recoverable Permission required: edit_format_settings - PATCHUpdate the format
/formats/:format_idsettings with the given attributes Deprecated: display_name Deprecated: default_format Permission required: edit_format_settings - GETGet tags values
/formats/:scope/tag_fieldsGet the tag fields values bound to the given scope. Scope can be an inbox or a project Permission required: edit_format_settings / review
integrations
- GETGet all integrations
/integrations/Return the list of set up integrations Permission required: read_integrations - POSTCreate integration
/integrations/Create a new integration. Each type of integration has its own initialization logic and thus may yield suitable error codes depending on the underlying issue,… - GETGet integration attributes
/integrations/:integration_idReturn the given integration attributes Permission required: read_integrations - DELETEDelete an integration
/integrations/:integration_idDelete the given integration. WARNING This will completely remove the integration, this is not recoverable Permission required: edit_integrations - PATCHUpdate integration
/integrations/:integration_idUpdate the given integration attributes Permission required: edit_integrations - GETget_email_integration_activation_resource
/integrations/:integration_id/activate?secret=string
connections
- GETGet all Connections
/connectionsReturn the list of set up connections Permission required: edit_integrations - POSTCreate connection
/connectionsCreate a new connection bound to the given scope (can be a project or inbox) Permission required: edit_integrations - GETGet connection
/connections/:connection_idReturn the connection attributes Permission required: edit_integrations - DELETEDelete a connection
/connections/:connection_idDelete the given connection. WARNING This will completely remove the connection, this is not recoverable Permission required: edit_integrations - PATCHUpdate connection
/connections/:connection_idattributes Permission required: edit_integrations
auth
- POSTLogin and retrieve a JWT Token
/authLogin with the provided credentials (POST data) and return a JWT Token for this user. - GETGet all API-Key
/auth/api-keyPermission required: view_api_keys - POSTCreate a new API Key
/auth/api-keyAPI 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… - GETGet all API-Keys for this inbox
/auth/api-key/inbox/:inbox_idPermission required: view_api_keys - POSTCreate a new API Key on inbox level
/auth/api-key/inbox/:inbox_idThe requesting user needs to have inbox level permissions API Keys are simple randomly generated strings bound to roles that grant access to resources. Every… - GETGet details of an API-Key
/auth/api-key/:keyPermission required: view_api_keys - DELETEDelete an API Key
/auth/api-key/:keyCompletely remove an API Key, thus disabling it. The token won't be recoverable Permission required: edit_backend_settings - PATCHEdit an API-Key
/auth/api-key/:keyroles can't be modified after creation: you need to create a new token if you want other roles. Permission required: edit_backend_settings - POSTCreate a new ephemeral token
/auth/ephemeralEphemeral tokens are short lived tokens that can be used to temporary grant access to resources. - POSTCreate a new JWT Token
/auth/get_JWTDeprecated. This endpoint is *deprecated* : use /auth/ephemeral and /auth/token instead This endpoint requires authentication and requires the user to have… - POSTReset the user password
/auth/reset_password - POSTCreate a new token
/auth/tokenBearer tokens can be used to authenticated without session or without sending credentials. If the user making the request has sufficient privileges, he is…
sso
- GETget_sso_config_resources
/sso/config - POSTpost_sso_config_resources
/sso/config - DELETEGet integration attributes
/sso/config/:sso_config_idReturn the given integration attributes Permission required: edit_integrations - POSTpost_oauth_login_resource
/sso/login
users
- GETGet all users
/usersReturn the list of users Permission required: edit_users - POSTCreate user
/usersCreate a new user with the provided attributes and roles Permission required: edit_users - GETReturn info on the current user
/users/meReturn user info of the authenticated used making the call - POSTChange the current user password
/users/me/change_passwordUpdate the current authenticated user password - GETGet user
/users/:user_idReturn user attribute Permission required: edit_users - DELETEDelete a user
/users/:user_idDelete the given user. WARNING This will completely remove the user, this is not recoverable - PATCHUpdate user
/users/:user_idUpdate the given user with the provided attributes Permission required: edit_users
roles
- GETGet all roles
/rolesReturn the list of roles - POSTCreate role
/rolesCreate a new role Permission required: edit_users - GETGet role
/roles/:role_idReturn role attributes - DELETEDelete a role
/roles/:role_idDelete the given role. WARNING This will completely remove the role, this is not recoverable Permission required: edit_users - PATCHUpdate role
/roles/:role_idModify the role with the given arguments Permission required: edit_users
settings
- GETGet scoped dashboard setting
/settings/dashboard?scope=string&full=falseGet the dashboard settings for the given scope (project or inbox) - PATCHUpdate scoped dashboard setting
/settings/dashboardUpdate the dashboard settings for the given scope (project or inbox) Permission required: edit_dashboard_settings - GETGet scoped review setting
/settings/review?scope=string&full=falseGet the review settings for the given scope (project or inbox) - PATCHUpdate scoped review setting
/settings/reviewUpdate the review settings for the given scope (project or inbox) Permission required: edit_review_settings
threshold_settings
- GETGet all thresholds settings
/threshold_settingsPermission required: read_thresholds_settings / review - GETGet the scoped thresholds settings
/threshold_settings/:scope?default=falsePermission required: read_thresholds_settings / review - DELETEDelete the thresholds settings
/threshold_settings/:scopePermission required: edit_thresholds_settings - PATCHUpdate the scoped thresholds settings
/threshold_settings/:scopePermission required: edit_thresholds_settings
style
- GETGet the custom CSS file
/style/custom.css - POSTUpload the custom logo
/style/custom.cssPermission required: edit_dashboard_settings - GETGet the custom logo
/style/logo.png - POSTUpload the custom logo
/style/logo.pngPermission required: edit_dashboard_settings
stats
- GETget_usage_stats_resource
/stats/usage?inbox_id=string&start_date=2023-01-31T13:36:39&end_date=2023-03-02T13:36:39&excel_output=false - GETGet inbox statistics
/stats/:inbox_id?field_name=string&start_date=&end_date=&version_name=stringCompute 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… - GETGet summary or details of automation blockers
/stats/:inbox_id/automation_blockers?start_date=2023-02-02T13:36:39.252495&end_date=2023-03-02T13:36:39.252527&version_name=predicted&include_detail=falsePermission required: view_statistics - POSTGet the Blue Dots statistics for the inbox
/stats/:inbox_id/blue_dotsCompute and return the blue dots statistics, optionally restricted to date range, fields and versions Permission required: submit - GETGet the documents with evaluated versions
/stats/:inbox_id/evaluated_versions?start_date=2023-02-02T13:36:39.251355&end_date=2023-03-02T13:36:39.251385&filter_versions=false&last_one_only=true&version_name=stringIf filter_on_version_date is True, the document versions are filtered by timestamp, otherwise, documents are filtered by receive_time. Permission required:… - GETGet processing runtime stats
/stats/:inbox_id/processing?start_date=2023-02-02T13:36:39.251761&end_date=2023-03-02T13:36:39.251794&group_by=pagesThis endpoint is in _preview_ and its interface may change. Compute statistics over the documents in the inbox. These stats include: mean min max standard… - GET**Permission required:** view_statistics
/stats/:inbox_id/volume?start_date=2023-02-02T13:36:39.252098&end_date=2023-03-02T13:36:39.252127&status=to_review&user=string - GETGet the Accuracy counts on documents, sections and fields in the given inbox
/stats/:scope/accuracy?start_date=2023-02-02T13:36:39.250494&end_date=2023-03-02T13:36:39.250527&stp_files_only=false&stp_fields_only=false&version_name=string&filter_by=stringPermission required: view_statistics - GETGet the STP counts on documents, sections and fields in the given inbox
/stats/:scope/stp?start_date=2023-02-02T13:36:39.250021&end_date=2023-03-02T13:36:39.250091&version_name=predicted&filter_by=stringPermission required: view_statistics
sampling_settings
- GETGet all sampling settings
/sampling_settingsPermission required: edit_sampling_settings / review - GETGet scoped sampling settings
/sampling_settings/:scopePermission required: edit_sampling_settings / review - DELETEDelete scoped sampling settings
/sampling_settings/:scopePermission required: edit_sampling_settings - PATCHUpdate scoped sampling settings
/sampling_settings/:scopePermission required: edit_sampling_settings
predictor_settings
- GETGet all predictor settings
/predictor_settingsPermission required: edit_predictor_settings - GETGet scoped predictor settings
/predictor_settings/:scopePermission required: edit_predictor_settings - DELETEDelete scoped predictor settings
/predictor_settings/:scopePermission required: edit_predictor_settings - PATCHUpdate scoped predictor settings
/predictor_settings/:scopePermission required: edit_predictor_settings
rule_config
- GETGet all rule configs
/rule_configPermission required: edit_predictor_settings - POSTGet the regexes that are generated by the rule
/rule_config/rule_entity/Permission required: edit_predictor_settings - POSTEvaluate a rule on a document
/rule_config/rule_entity/:document_idPermission required: edit_predictor_settings - POSTGet the text a where_to_search specification will generate
/rule_config/where_to_search/:document_idReturns a list of strings per granularity. If no granularity is specified. It is considered to be the whole document Permission required:… - GETGet scoped rule config
/rule_config/:scopePermission required: edit_predictor_settings - DELETEDelete scoped rule config
/rule_config/:scopePermission required: edit_predictor_settings - PATCHUpdate scoped rule config
/rule_config/:scopePermission required: edit_predictor_settings
data_retention_settings
- GETGet all data retention settings
/data_retention_settingsPermission required: read_data_retention_settings - GETGet scoped data retention settings
/data_retention_settings/:level/:idPermission required: read_data_retention_settings - DELETEDelete scoped sampling settings
/data_retention_settings/:level/:idPermission required: edit_data_retention_settings - PATCHUpdate scoped data retention settings
/data_retention_settings/:level/:idPermission required: edit_data_retention_settings
reports
- GETGet all reports
/reportsReturn the list of reports Permission required: read_reports - POSTCreate report
/reportsCreate a new report Permission required: edit_reports - POSTGenerate report based on input
/reports/generateNote: start_date and end_date filter on status update Permission required: read_reports - GETGet report
/reports/:report_idReturn report attributes Permission required: read_reports - DELETEDelete a report
/reports/:report_idDelete the given report. WARNING This will completely remove the report, this is not recoverable Permission required: edit_reports - PATCHUpdate report
/reports/:report_idModify the report with the given arguments Permission required: edit_reports - POSTGenerate report based on report id
/reports/:report_id/generate?delivery_method=download&email=string&start_date=2024-01-01T00:00:00Z&end_date=2024-01-01T00:00:00ZNote: start_date and end_date filter on status update Permission required: read_reports
about
- GETget_release_notes
/about/release_notes - GETget_version
/about/version
tenant
- DELETEdelete_tenant_resource
/tenant - PATCHpatch_activate_tenant_resource
/tenant/activate
API details
- Authentication
- HTTP Basic authentication (username and password)
An API key in the Authorization header - Operations
- 135 operations on 90 pathsGET 60POST 38PATCH 19DELETE 18
1 marked deprecated - Main resources
- documents 23auth 12inboxes 10stats 9formats 7reports 7rule_config 7users 7integrations 6connections 5
- Response formats
application/json- Description format
- OpenAPI 3.0.0, API version
1.0 - Links
- OpenAPI document
- Listed from
- APIs.guru OpenAPI Directory (CC0-1.0)
Source updated
How to test the Contract.fit API in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the Contract.fit API collection, without the publisher's secrets.
- Add your credentialsThis API uses HTTP Basic authentication (username and password). Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Upload a new document” (POST /documents/), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the 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.… It is listed under AI & machine learning and has 135 endpoints.
Who publishes the Contract.fit API?
It is listed from Contract P's public API description (an OpenAPI document), not published by Contract P on Swastik Codes. Anyone who controls contract-p.fit can claim the profile by adding a DNS TXT record.
How do I authenticate with the Contract.fit API?
It accepts 2 methods: HTTP Basic authentication (username and password); an API key in the Authorization header.
How many endpoints does the Contract.fit API have?
135 operations on 90 paths (60 GET, 38 POST, 19 PATCH, 18 DELETE). The largest groups are documents, auth, inboxes, stats.
Is forking the Contract.fit API free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.