openapi: 3.1.0 info: title: Zuva DocAI description: Embed Contracts AI into your product workflows using Zuva DocAI. termsOfService: https://zuva.ai/terms/terms-of-service/ contact: name: Support url: https://www.zuva.ai email: support@zuva.ai license: name: Zuva Terms of Service url: https://zuva.ai/terms/terms-of-service/ version: '2.0' servers: - url: https://us.app.zuva.ai/api/v2 description: United States - url: https://eu.app.zuva.ai/api/v2 description: Europe security: - bearerAuth: [] tags: - name: Files description: Upload and manage your files. - name: Field Extraction description: Identify and extract common legal clauses, provisions and data points from unstructured documents and contracts, including ones written in non-standard language. - name: Multi-Level Classification (MLC) description: Find out what type of contracts and contract-related documents you have. The new Multi-Level Classification service provides an order-of-magnitude increase in the number of classification models compared to the classic Document Classification service. - name: Normalization description: (In Alpha) Normalize a string containing currencies, dates or durations. - name: OCR description: Obtain the text, images and layouts of your documents using Optical Character Recognition. - name: Fields description: Discover and manage your fields. - name: Training description: Train fields on your extractions. paths: /extraction: post: tags: - Field Extraction summary: Create extraction requests description: |- Creates a new request for extraction of the specified fields from each of the specified files, returning one request for each file. A maximum of 100 field IDs and 100 file IDs can be included in each request. operationId: CreateExtractionRequest requestBody: description: The file IDs to create extraction requests for and field IDs to extract. content: application/json: schema: $ref: '#/components/schemas/CreateExtractionRequestsBody' required: true responses: '202': description: See response body for status of each request. content: application/json: schema: $ref: '#/components/schemas/ExtractionRequestsAccepted' examples: Success: summary: Extraction request successfully created value: file_ids: - file_id: c5e407f1qk1er7odm6tg field_ids: - c83868ae-269a-4a1b-b2af-c53e5f91efca request_id: c5e463f1qk154j5e3sjg status: queued '400': description: Malformed request, missing/invalid `file_ids` or `field_ids` attribute. content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /extraction/{request_id}: get: tags: - Field Extraction summary: Get extraction request description: Retrieves the status of an extraction request. operationId: GetExtractionRequestStatus parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The status of the extraction request content: application/json: schema: $ref: '#/components/schemas/ExtractionRequestStatus' examples: Complete: summary: Extraction request completed successfully value: file_id: c5e407f1qk1er7odm6tg request_id: c5e463f1qk154j5e3sjg status: complete '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' /extraction/{request_id}/results/text: get: tags: - Field Extraction summary: Get extraction results description: |- Retrieves the results of an extraction request. The response includes a result object for each field, which may include zero or more extractions of that field from the document. operationId: GetExtractionResults parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The text result of an extraction content: application/json: schema: $ref: '#/components/schemas/ExtractionTextResultResponse' '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': description: Results not ready yet content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' /extractions: get: tags: - Field Extraction summary: Get extraction requests description: |- Retrieves the status of one or more extraction requests. Each request ID should be provided as a query parameter, e.g. `/extractions?request_id=abcde&request_id=fghijk` If any or all request ids are invalid or not found, the overall response will be `200 Success`, and the response body will contain the individual error messages for each request id. A maximum of 1000 request IDs can be included in a single query. operationId: GetExtractionRequestStatuses parameters: - name: request_id in: query description: Extraction request IDs required: true style: form explode: true schema: type: array items: type: string example: - id_1 - id_2 responses: '200': description: The status of multiple extraction requests content: application/json: schema: $ref: '#/components/schemas/ExtractionStatuses' '400': description: Invalid request content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' /fields: get: tags: - Fields summary: Get field list description: |- Lists all fields available to the user. Metadata for non-custom fields will include all properties, but the scores (precision, recall etc.) will be zero. operationId: ListFields responses: '200': description: List of fields with metadata. content: application/json: schema: $ref: '#/components/schemas/FieldListResponse' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' post: tags: - Fields summary: Create a new field description: |- Creates a new field and returns its field ID. The optional `from_field_id` parameter can be provided in order to copy an existing field as a starting point for further training. operationId: CreateField requestBody: description: The metadata for the new field content: application/json: schema: $ref: '#/components/schemas/PostFieldRequest' required: true responses: '201': description: ID of newly created field content: application/json: schema: $ref: '#/components/schemas/NewFieldResponse' '400': description: Specified `from_field_id` does not exist content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /fields/{field_id}/accuracy: get: tags: - Fields summary: Get field accuracy description: Gets the scores for a custom field, including precision, recall and f-score. operationId: GetFieldAccuracy parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string responses: '200': description: The field's accuracy content: application/json: schema: $ref: '#/components/schemas/FieldAccuracyResponse' '400': $ref: '#/components/responses/InvalidFieldId' '404': $ref: '#/components/responses/FieldNotFound' '409': description: The field has not finished training yet content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' /fields/{field_id}/metadata: get: tags: - Fields summary: Get field metadata description: Gets field metadata and returns `field_id`, `name`, `description`, `read_only`, `is_trained`, `file_ids` operationId: GetFieldMetadata parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string responses: '200': description: The field's metadata content: application/json: schema: $ref: '#/components/schemas/FieldMetadataResponse' '400': $ref: '#/components/responses/InvalidFieldId' '404': $ref: '#/components/responses/FieldNotFound' '500': $ref: '#/components/responses/InternalServerError' put: tags: - Fields summary: Update field metadata description: Update the name and description of a custom field. operationId: UpdateFieldMetadata parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string requestBody: description: The updated metadata for the field content: application/json: schema: $ref: '#/components/schemas/PutFieldMetadataRequest' required: true responses: '204': description: The metadata for the field was successfully updated '400': $ref: '#/components/responses/InvalidFieldId' '404': $ref: '#/components/responses/FieldNotFound' '405': description: Cannot update a read-only field content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /fields/{field_id}/train: post: tags: - Training summary: Create training request description: |- Starts training on a field and returns the request id. The `start` and `end` locations refer to the positions of the first and last characters of an example text span that the model should learn to extract. The character positions must be given in terms of Zuva's OCR representation of the document, which can be obtained from the [GET OCR layouts](#get-ocr-layouts) endpoint. operationId: CreateTrainingRequest parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string requestBody: description: The data to train the new field on. content: application/json: schema: type: array items: $ref: '#/components/schemas/FieldTrainingRequest' examples: TrainingExample: summary: Training data value: - file_id: c5e407f1qk1er7odm6tg locations: - start: 123 end: 456 required: true responses: '202': description: The status of the training request content: application/json: schema: $ref: '#/components/schemas/TrainingRequestStatus' examples: Success: summary: Training request successfully enqueued value: field_id: 12345678-1234-1234-1234-123456789012 request_id: c5e463f1qk154j5e3sjg status: queued '400': description: Invalid request body content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/FieldNotFound' '409': description: 'Conflict: training request ongoing' content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /fields/{field_id}/train/{request_id}: get: tags: - Training summary: Get training request description: Retrieves the status of a field training request. operationId: GetTrainingRequestStatus parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The status of the training request content: application/json: schema: $ref: '#/components/schemas/TrainingRequestStatus' examples: Complete: summary: Training request completed successfully value: field_id: 12345678-1234-1234-1234-123456789012 request_id: c5e463f1qk154j5e3sjg status: complete '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' /fields/{field_id}/validation-details: get: tags: - Fields summary: Get field validation details description: |- Returns the details (file ID, type, location) of each extraction used for validation during training of the field. Possible values of `type` are: * `tp`: True Positive - an annotation added by the user that the AI agrees with. * `fn`: False Negative - an annotation added by the user that the AI disagrees with. * `fp`: False Positive - an annotation that the user did not add, but that the AI suggests they add to training. * `na`: Not Applicable - an annotation that was not used for validation, either because it was part of the initial training batch, or because the file was a duplicate of a file that was already trained on. If the example `type` is `tp` or `fp`, the `location` refers to the text found by the ML. If the example `type` is `fn` or `na`, the `location` refers to the original user highlight that was missed. operationId: GetFieldValidationDetails parameters: - name: field_id in: path description: Field ID example: 12345678-1234-1234-1234-123456789012 required: true style: simple explode: false schema: type: string responses: '200': description: The field's validation details content: application/json: schema: $ref: '#/components/schemas/FieldValidationDetailsResponse' '400': $ref: '#/components/responses/InvalidFieldId' '404': $ref: '#/components/responses/FieldNotFound' '409': description: A training request is in progress for this field content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' /files: post: tags: - Files summary: Submit a file description: |- Upload a file to DocAI. For best results, uploaded files should be whole documents (rather than pages, paragraphs or fragments). The content type does not need to be specified, with the exception of eOCR files, which must use the content type `application/eocr`. If not provided, the content type will be automatically detected and returned in the `attributes` of the response. Plain text content must be UTF-8 encoded. For Microsoft Word documents (.doc and .docx extensions), the header value X-Attr-OCR=msword can be used to bypass OCR and instead read the characters and layout directly from the original file. Files are deleted from the system after 7 days by default, configurable to a maximum of 14 days. Your file's expiration date can be found in the response of this API call operationId: SubmitFile requestBody: description: The file content content: application/octet-stream: schema: type: string format: binary examples: Binary: summary: Raw file content value: text/plain: schema: type: string examples: Binary: summary: Raw text file content value: UTF-8 string application/eocr: schema: type: string format: binary examples: Binary: summary: EOCR file content value: application/msword: schema: type: string format: binary examples: Binary: summary: Word doc file content value: application/vnd.openxmlformats-officedocument.wordprocessingml.document: schema: type: string format: binary examples: Binary: summary: Word docx file content value: required: true parameters: - name: X-Attr-OCR in: header description: The type of OCR operation to perform on the file example: ocr required: false schema: $ref: '#/components/schemas/OcrTypeEnum' - name: X-Attr-MSWord-GenerateImages in: header description: Indicates whether to generate page images for MS Word documents when performing OCR example: true required: false schema: type: string default: false responses: '201': description: The file was uploaded successfully content: application/json: schema: $ref: '#/components/schemas/FileCreatedResponse' '400': description: A required header was not specified, or contained an invalid value content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body x-code-samples: - lang: shell label: cURL source: |- curl -X POST https://us.app.zuva.ai/api/v2/files \ -H 'Content-Type: application/octet-stream' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ --data-binary '@/path/to/file.pdf' delete: tags: - Files summary: Delete files description: |- Permanently delete all of the specified files. Each file ID should be provided as a query parameter, e.g. `/files?file_id=abcde&file_id=fghijk` If any or all file IDs are invalid or not found, the overall response will be `200 Success`, and the response body will contain the individual error messages for each file ID. A maximum of 1000 file IDs can be included in a single query. operationId: DeleteFiles parameters: - name: file_id in: query description: File ID required: true style: form explode: true schema: type: array items: type: string example: - id_1 - id_2 responses: '200': description: The status of each deletion request. content: application/json: schema: $ref: '#/components/schemas/DeleteFileStatusArray' '400': description: Invalid request content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' /files/{file_id}: delete: tags: - Files summary: Delete file description: Delete an existing file. Only the owner of the file may delete it. operationId: DeleteFile parameters: - name: file_id in: path description: File ID example: c5e407f1qk1er7odm6tg required: true style: simple explode: false schema: type: string responses: '204': description: The file was deleted successfully. '400': $ref: '#/components/responses/InvalidFileId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/FileNotFound' '410': description: File expired content: application/json: schema: $ref: '#/components/schemas/HttpError' '500': $ref: '#/components/responses/InternalServerError' /files/{file_id}/expiration: put: tags: - Files summary: Update file expiry description: Update the expiry on a file. The expiration time can be provided as an absolute timestamp in RFC3339 format (e.g. `2022-12-23T12:34:56Z`), or as an interval relative to the time the request is made (e.g `12h` or `10d`). operationId: UpdateFileExpiry parameters: - description: File ID in: path name: file_id required: true schema: type: string example: c5e407f1qk1er7odm6tg - name: Expiration in: header description: Expiration time for the file example: 7d required: false schema: type: string responses: '200': description: The file was updated successfully. content: application/json: schema: $ref: '#/components/schemas/FileUpdatedResponse' '400': $ref: '#/components/responses/InvalidFileId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/FileNotFound' '500': $ref: '#/components/responses/InternalServerError' /mlc: post: tags: - Multi-Level Classification (MLC) summary: Create MLC requests description: Creates an MLC request for each of the specified files. operationId: CreateMLCRequests requestBody: description: The fileIDs to create MLC requests for. content: application/json: schema: $ref: '#/components/schemas/CreateMLCRequest' required: true responses: '202': description: See response body for status of each request. content: application/json: schema: $ref: '#/components/schemas/MLCRequestsAccepted' examples: Success: summary: Multi-level classification request submitted successfully value: file_ids: - file_id: c5e407f1qk1er7odm6tg request_id: c5e463f1qk154j5e3sjg status: queued '400': description: Malformed request or missing/invalid `file_ids` attribute. content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /mlc/{request_id}: get: tags: - Multi-Level Classification (MLC) summary: Get MLC request description: |- Retrieves the status of a multi-level classification request and, if the status is `complete`, its results. operationId: GetMLCRequestStatus parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The status and results of the document classification request. content: application/json: schema: $ref: '#/components/schemas/MLCStatus' examples: Complete: summary: Multi-level classifier request completed successfully value: file_id: c5e407f1qk1er7odm6tg request_id: c5e463f1qk154j5e3sjg status: complete classifications: - Contract - IP Agt - License Agt language: code: en name: English is_amendment: false '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' /mlcs: get: tags: - Multi-Level Classification (MLC) summary: Get MLC requests description: |- Retrieves the status of one or more Multi-Level Classification status requests. Each request ID should be provided as a query parameter, e.g. `/mlcs?request_id=abcde&request_id=fghijk` If any or all request IDs are invalid or not found, the overall response will be `200 Success`, and the response body will contain the individual error messages for each request ID. A maximum of 1000 request IDs can be included in a single query. operationId: GetMLCRequestStatuses parameters: - name: request_id in: query description: MLC request IDs required: true style: form explode: true schema: type: array items: type: string example: - id_1 - id_2 responses: '200': description: The status of multiple MLC requests content: application/json: schema: $ref: '#/components/schemas/MLCStatuses' '400': description: Invalid request content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' /normalize/currency: post: tags: - Normalization summary: Normalize Currency description: Normalize currencies found within a string, returning an array of currency values and their denominations. operationId: NormalizeCurrency requestBody: description: The string of text to normalize. content: application/json: schema: $ref: '#/components/schemas/NormalizeCurrencyRequestBody' required: true responses: '200': description: See response body for status of request. content: application/json: schema: $ref: '#/components/schemas/NormalizeCurrencyResponseBody' '400': description: Malformed request, missing/invalid body. content: application/json: schema: $ref: '#/components/schemas/HttpError' /normalize/date: post: tags: - Normalization summary: Normalize Date description: Normalize dates found within a string, returning an array of date values (day, month, year). operationId: NormalizeDate requestBody: description: The string of text to normalize. content: application/json: schema: $ref: '#/components/schemas/NormalizeDateRequestBody' required: true responses: '200': description: See response body for status of request. content: application/json: schema: $ref: '#/components/schemas/NormalizeDateResponseBody' '400': description: Malformed request, missing/invalid body. content: application/json: schema: $ref: '#/components/schemas/HttpError' /normalize/duration: post: tags: - Normalization summary: Normalize Duration description: |- Creates a new duration normalize request for a string, returning a request ID and the normalized duration. Normalize durations found within a string, returning an array of duration values and their units. operationId: NormalizeDuration requestBody: description: The string of text to normalize. content: application/json: schema: $ref: '#/components/schemas/NormalizeDurationRequestBody' required: true responses: '200': description: See response body for status of request. content: application/json: schema: $ref: '#/components/schemas/NormalizeDurationResponseBody' '400': description: Malformed request, missing/invalid body. content: application/json: schema: $ref: '#/components/schemas/HttpError' /ocr: post: tags: - OCR summary: Create OCR requests description: |- Creates a new OCR request for each of the specified files, returning one request object for each file. operationId: CreateOcrRequests requestBody: description: The file IDs to create OCR requests for. content: application/json: schema: $ref: '#/components/schemas/CreateOcrRequestsBody' required: true responses: '202': description: See response body for status of each request. content: application/json: schema: $ref: '#/components/schemas/OcrRequestsAccepted' examples: Success: summary: OCR request successfully submitted value: file_ids: - file_id: c5e407f1qk1er7odm6tg request_id: c5e463f1qk154j5e3sjg status: queued '400': description: Malformed request, missing/invalid `fileIds` attribute. content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' x-codegen-request-body-name: body /ocr/{request_id}: get: tags: - OCR summary: Get OCR request description: Retrieves the status of an OCR request. operationId: GetOcrRequestStatus parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The status of an OCR request content: application/json: schema: $ref: '#/components/schemas/OcrRequestStatus' examples: Complete: summary: OCR request completed successfully value: file_id: c5e407f1qk1er7odm6tg request_id: c5e463f1qk154j5e3sjg status: complete page_count: 10 character_count: 10800 scan_quality: A scan_score: 100 headers: X-Attr-OCR: schema: type: string enum: - ocr - msword - text - eocr description: The type of OCR operation that was performed. '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '500': $ref: '#/components/responses/InternalServerError' /ocrs: get: tags: - OCR summary: Get OCR requests description: |- Retrieves the status of one or more OCR status requests. Each request ID should be provided as a query parameter, e.g. `/ocrs?request_id=abcde&request_id=fghijk` If any or all request IDs are invalid or not found, the overall response will be `200 Success`, and the response body will contain the individual error messages for each request ID. A maximum of 1000 request IDs can be included in a single query. operationId: GetOCRRequestStatuses parameters: - name: request_id in: query description: OCR request IDs required: true style: form explode: true schema: type: array items: type: string example: - id_1 - id_2 responses: '200': description: The status of multiple OCR requests content: application/json: schema: $ref: '#/components/schemas/OCRStatuses' '400': description: Invalid request content: application/json: schema: $ref: '#/components/schemas/HttpError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalServerError' /ocr/{request_id}/eocr: get: tags: - OCR summary: Get eOCR document description: Retrieves the document in eOCR format. operationId: GetOcrDocument parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: eOCR document was retrieved successfully. content: application/octet-stream: schema: type: string format: binary example: '204': description: No content of this type was found. '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': $ref: '#/components/responses/OcrNotReady' '500': $ref: '#/components/responses/InternalServerError' /ocr/{request_id}/images: get: tags: - OCR summary: Get OCR images description: Retrieves png images of all pages of OCR document as a zip file. operationId: GetOcrImages parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: Images were retrieved successfully. content: application/octet-stream: schema: type: string format: binary example: '204': description: No content of this type was found. '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': $ref: '#/components/responses/OcrNotReady' '500': $ref: '#/components/responses/InternalServerError' /ocr/{request_id}/images/{page_number}: get: tags: - OCR summary: Get OCR page image description: Retrieves a png image of one page of an OCR document. operationId: GetOcrImage parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string - name: page_number in: path description: Page Number example: 2 required: true style: simple explode: false schema: type: integer responses: '200': description: Image was retrieved successfully. content: image/png: schema: type: string format: binary example: '204': description: No content of this type was found. '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': $ref: '#/components/responses/OcrNotReady' '500': $ref: '#/components/responses/InternalServerError' /ocr/{request_id}/layouts: get: tags: - OCR summary: Get OCR layouts description: Gets the layout protobuf binary for an OCR document. operationId: GetOcrLayouts parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: Layouts were retrieved successfully. content: application/octet-stream: schema: type: string format: binary example: '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': $ref: '#/components/responses/OcrNotReady' '500': $ref: '#/components/responses/InternalServerError' /ocr/{request_id}/text: get: tags: - OCR summary: Get OCR text description: Retrieves the text results of an OCR request. The text is returned as a string without newlines or formatting. operationId: GetOcrText parameters: - name: request_id in: path description: Request ID example: c5e463f1qk154j5e3sjg required: true style: simple explode: false schema: type: string responses: '200': description: The OCR text result content: application/json: schema: $ref: '#/components/schemas/OcrTextResponse' '400': $ref: '#/components/responses/InvalidRequestId' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/RequestNotFound' '409': $ref: '#/components/responses/OcrNotReady' '500': $ref: '#/components/responses/InternalServerError' components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: schemas: Answer: type: object required: - option - value properties: option: type: string example: a value: type: string example: This is a multiple choice answer BoundingBox: type: object required: - bottom - left - top - right properties: bottom: type: integer example: 2652 left: type: integer example: 228 right: type: integer example: 355 top: type: integer example: 2624 BoundingBoxSummary: description: This bounding box captures the top left position of the first character and the bottom right position of the last character of the extraction. type: object required: - bottom - left - top - right properties: bottom: type: integer example: 2652 left: type: integer example: 228 right: type: integer example: 355 top: type: integer example: 2624 BoundingBoxesByPage: description: Bounding boxes for each line of the extraction that occur on a particular page. type: object required: - page - bounds properties: page: type: integer example: 1 bounds: type: array items: $ref: '#/components/schemas/BoundingBox' CharacterSpan: type: object required: - score - bboxes - pages - start - end properties: bounds: $ref: '#/components/schemas/BoundingBoxSummary' bboxes: type: array items: $ref: '#/components/schemas/BoundingBoxesByPage' end: type: integer example: 637 pages: $ref: '#/components/schemas/Span' score: type: number format: double example: 0.9999379754341181 start: type: integer example: 632 ClassificationPercentage: type: object required: - classifications - percentage properties: classifications: items: type: string type: array percentage: type: number Country: type: object required: - code - name properties: code: description: The ISO 3166-1 alpha-2 code, eg. "CA". type: string name: description: The ISO 3166 country name, eg. "Canada". type: string CreateExtractionRequestsBody: type: object required: - field_ids - file_ids properties: field_ids: type: array example: - c83868ae-269a-4a1b-b2af-c53e5f91efca items: type: string file_ids: type: array example: - c5e407f1qk1er7odm6tg items: type: string CreateMLCRequest: type: object required: - file_ids properties: file_ids: type: array description: The files to classify example: - c5e407f1qk1er7odm6tg items: type: string CreateOcrRequestsBody: type: object required: - file_ids properties: file_ids: type: array example: - c5e407f1qk1er7odm6tg items: type: string CurrencyValues: type: object required: - value - symbol - precision properties: value: type: string example: 2347 symbol: type: string example: dollars precision: type: integer example: 2 DateValues: type: object required: - day - month - year properties: day: type: integer example: 28 month: type: integer example: 11 year: type: integer example: 2022 DefinedTerm: type: object required: - term - spans properties: term: type: string example: Landlord spans: type: array items: $ref: '#/components/schemas/CharacterSpan' DeleteFileStatus: type: object required: - file_id - status properties: file_id: type: string example: 5e407f1qk1er7odm6tg status: type: string example: complete DeleteFileStatusArray: type: array items: $ref: '#/components/schemas/DeleteFileStatus' DurationValues: type: object required: - unit - value properties: unit: type: string example: months value: type: integer example: 4 ExtractionCreatedResponse: type: object required: - file_id - request_id - status - field_ids properties: file_id: type: string example: c5e407f1qk1er7odm6tg field_ids: type: array example: - c83868ae-269a-4a1b-b2af-c53e5f91efca items: type: string request_id: type: string example: c5e463f1qk154j5e3sjg status: $ref: '#/components/schemas/StatusEnum' ExtractionRequestStatus: type: object required: - file_id - request_id - status properties: error: $ref: '#/components/schemas/HttpErrorDetails' file_id: type: string example: c5e407f1qk1er7odm6tg request_id: type: string example: c5e463f1qk154j5e3sjg status: $ref: '#/components/schemas/StatusEnum' ExtractionRequestsAccepted: type: object required: - file_ids properties: file_ids: type: array items: $ref: '#/components/schemas/ExtractionCreatedResponse' ExtractionResult: type: object required: - field_id - field_name - extractions properties: answers: type: array items: $ref: '#/components/schemas/Answer' extractions: type: array items: $ref: '#/components/schemas/TextExtraction' field_id: type: string example: 668ee3b5-e15a-439f-9475-05a21755a5c1 field_name: type: string description: A `Result` contains an array of all extractions of a field from the file. ExtractionStatuses: type: object required: - errors - num_errors - num_found - statuses properties: errors: type: object additionalProperties: $ref: '#/components/schemas/HttpError' example: cc1oi51qqhquidfjhiu0: error: code: request_not_found message: The specified request ID cannot be found num_errors: type: integer example: 1 num_found: type: integer example: 1 statuses: type: object additionalProperties: $ref: '#/components/schemas/ExtractionRequestStatus' example: cc1oi51qqhquidfjmiu0: file_id: cc1ohrhqqhqthd7h5lag status: complete request_id: cc1oi51qqhquidfjmiu0 ExtractionTextResultResponse: type: object required: - file_id - request_id - results properties: file_id: type: string example: cdcpbqd9j3v1l06vsds0 request_id: type: string example: cdcpcgt9j3va54jmj4b0 results: type: array items: $ref: '#/components/schemas/ExtractionResult' FieldAccuracyResponse: type: object required: - example_count - f_score - precision - recall properties: example_count: type: integer f_score: type: number precision: type: number recall: type: number FieldListResponse: type: array items: $ref: '#/components/schemas/FieldListResponseElement' FieldListResponseElement: type: object required: - bias - description - document_count - document_types - f_score - field_id - file_ids - is_custom - is_trained - jurisdictions - languages - name - normalization_type - precision - recall - tags properties: bias: type: number description: type: string example: Description of the field. document_count: type: integer document_types: type: array items: $ref: '#/components/schemas/ClassificationPercentage' f_score: type: number field_id: type: string example: 12345678-1234-1234-1234-123456789012 file_ids: type: array example: - c5e407f1qk1er7odm6tg items: type: string is_custom: type: boolean is_trained: type: boolean jurisdictions: type: array items: $ref: '#/components/schemas/Jurisdiction' languages: type: array items: $ref: '#/components/schemas/LanguagePercentage' name: type: string example: Field Name normalization_type: type: string precision: type: number recall: type: number tags: type: array items: type: string FieldMetadataResponse: type: object required: - description - document_types - field_id - file_ids - is_trained - jurisdictions - languages - name - normalization_type - read_only - tags properties: description: type: string document_types: type: array items: $ref: '#/components/schemas/ClassificationPercentage' field_id: type: string example: 12345678-1234-1234-1234-123456789012 file_ids: type: array example: - c5e407f1qk1er7odm6tg items: type: string is_trained: type: boolean jurisdictions: type: array items: $ref: '#/components/schemas/Jurisdiction' languages: type: array items: $ref: '#/components/schemas/LanguagePercentage' name: type: string normalization_type: type: string read_only: type: boolean tags: type: array items: type: string FieldTrainingRequest: type: object required: - file_id - locations properties: file_id: type: array items: type: integer locations: type: array items: $ref: '#/components/schemas/Location' FieldValidationDetails: type: object required: - file_id - location - type properties: file_id: type: string example: c5e407f1qk1er7odm6tg location: description: The start and end character locations of the extraction. type: array example: - 26952 - 27310 items: type: integer type: $ref: '#/components/schemas/FieldValidationType' FieldValidationDetailsResponse: type: array items: $ref: '#/components/schemas/FieldValidationDetails' FieldValidationType: type: string example: tp enum: - tp - fn - fp - na FileAttributes: type: object required: - content-type - sha-256 properties: content-type: type: string description: The provided or detected MIME type of the File. example: application/pdf sha-256: type: string description: The SHA-256 hash of the file's contents example: 8b9bff906445adb9925abca7c48954155b3bfc9b548163086f001fa6b25760aa FileCreatedResponse: type: object required: - attributes - expiration - file_id - permissions - size properties: attributes: $ref: '#/components/schemas/FileAttributes' expiration: type: string description: The file expiration in RFC3339 format example: '2021-10-07T12:07:57Z' file_id: type: string description: The ID of the created file resource example: c5e407f1qk1er7odm6tg permissions: type: array description: Unused example: - '' items: type: string size: type: integer description: The file size in bytes example: 23849850 FileUpdatedResponse: properties: expiration: description: The file expiration in RFC3339 format example: '2021-10-07T12:07:57Z' type: string file_id: description: The ID of the updated file resource example: c5e407f1qk1er7odm6tg type: string type: object HttpError: type: object required: - error properties: error: $ref: '#/components/schemas/HttpErrorDetails' HttpErrorDetails: type: object required: - code - message properties: code: type: string description: A unique string identifying the error. example: http-error message: type: string description: An error message providing more details and potential steps to resolve. example: Something went wrong, please try again later. Jurisdiction: type: object required: - country - regions properties: country: $ref: '#/components/schemas/Country' regions: description: Any additional state/provincial specifications, eg. ["British Columbia", "Ontario"]. items: type: string type: array LanguagePercentage: type: object required: - language - percentage properties: language: type: string percentage: type: number Location: type: object required: - start - end properties: end: type: integer example: 456 start: type: integer example: 123 MLCLanguage: type: object required: - name - code properties: code: type: string example: en name: type: string example: English MLCRequestsAccepted: type: object required: - file_ids properties: file_ids: type: array items: $ref: '#/components/schemas/MLCStatus' MLCStatus: type: object required: - file_id - request_id - status properties: classifications: type: array items: type: string is_amendment: type: boolean example: true is_master_agreement: type: boolean example: false language: $ref: '#/components/schemas/MLCLanguage' error: $ref: '#/components/schemas/HttpErrorDetails' file_id: type: string example: c5e407f1qk1er7odm6tg request_id: type: string example: c5e463f1qk154j5e3sjg status: $ref: '#/components/schemas/StatusEnum' MLCStatuses: type: object required: - errors - num_errors - num_found - statuses properties: errors: type: object additionalProperties: $ref: '#/components/schemas/HttpError' example: cc1oi51qqhquidfjhiu0: error: code: request_not_found message: The specified request ID cannot be found num_errors: type: integer example: 1 num_found: type: integer example: 1 statuses: type: object additionalProperties: $ref: '#/components/schemas/MLCStatus' example: cc1oi51qqhquidfjmiu0: file_id: c5e407f1qk1er7odm6tg status: complete request_id: c5e463f1qk154j5e3sjg classifications: - Contract - IP Agt - License Agt NewFieldResponse: type: object properties: field_id: type: string example: 12345678-1234-1234-1234-123456789012 NormalizeCurrencyRequestBody: type: object required: - text properties: text: type: string example: - The rent is two thousand three hundred forty seven dollars NormalizeCurrencyResponseBody: type: object required: - request_id - text - sha-256 - currency properties: request_id: type: string example: c5e407f1qk1er7odm6tg text: type: string example: The rent is two thousand three hundred forty seven dollars sha-256: type: string example: 9e5073c23ea12c7eb74682089380f9a5b891e3fe2cbe04a3ec89d9d5c004de17 currency: type: array items: $ref: '#/components/schemas/CurrencyValues' NormalizeDateRequestBody: type: object required: - text properties: text: type: string example: - The lease terminates on Monday, November 28, 2022 NormalizeDateResponseBody: type: object required: - request_id - text - sha-256 - date properties: request_id: type: string example: c5e407f1qk1er7odm6tg text: type: string example: The lease terminates on Monday, November 28, 2022 sha-256: type: string example: 914bbbcb1432e0419aa46042cc09fc908c0b3ce822977ebe62d2530c4dd2386c date: type: array items: $ref: '#/components/schemas/DateValues' NormalizeDurationRequestBody: type: object required: - text properties: text: type: string example: - The contract expires 4 months after termination NormalizeDurationResponseBody: type: object required: - request_id - text - sha-256 - duration properties: request_id: type: string example: c5e407f1qk1er7odm6tg text: type: string example: The contract expires 4 months after termination sha-256: type: string example: 97d7dfd38b649cd6109d0be3f757d65f485d483cce6235294938ca02cd99ed18 duration: type: array items: $ref: '#/components/schemas/DurationValues' OCRStatuses: type: object required: - errors - num_errors - num_found - statuses properties: errors: type: object additionalProperties: $ref: '#/components/schemas/HttpError' example: cc1oi51qqhquidfjhiu0: error: code: request_not_found message: The specified request ID cannot be found num_errors: type: integer example: 1 num_found: type: integer example: 1 statuses: type: object additionalProperties: $ref: '#/components/schemas/OcrRequestStatus' example: cc1oi51qqhquidfjmiu0: file_id: c5e407f1qk1er7odm6tg status: complete request_id: c5e463f1qk154j5e3sjg OcrRequestStatus: type: object required: - file_id - request_id - status properties: error: $ref: '#/components/schemas/HttpErrorDetails' file_id: type: string example: c5e407f1qk1er7odm6tg request_id: type: string example: c5e463f1qk154j5e3sjg status: $ref: '#/components/schemas/StatusEnum' page_count: type: integer example: 10 character_count: type: integer example: 10000 scan_quality: type: string example: A scan_score: type: integer example: 100 OcrRequestsAccepted: type: object required: - file_ids properties: file_ids: type: array items: $ref: '#/components/schemas/OcrRequestStatus' OcrTextResponse: type: object required: - request_id - text properties: request_id: type: string example: c5e463f1qk154j5e3sjg text: type: string example: The text of the document OcrTypeEnum: type: string example: ocr enum: - auto - ocr - msword - text - eocr PostFieldRequest: type: object required: - name properties: description: type: string example: A description of the field name: type: string example: My New Field from_field_id: type: string example: 12345678-1234-1234-1234-123456789012 description: ID of an existing field to copy PutFieldMetadataRequest: type: object properties: description: type: string example: New description name: type: string example: New Name Span: type: object required: - start - end properties: end: type: integer example: 1 start: type: integer example: 1 SpanIssue: type: object properties: file_id: type: string example: cdcpbqd9j3v1l06vsds0 span_problems: type: array items: $ref: '#/components/schemas/SpanProblems' SpanIssues: type: array items: $ref: '#/components/schemas/SpanIssue' SpanProblems: type: object properties: index: type: integer spans: type: array items: $ref: '#/components/schemas/Spans' issue_type: type: string example: Invalid Span Spans: type: object properties: end: type: integer start: type: integer label: type: integer StatusEnum: type: string example: complete enum: - queued - processing - complete - failed TextExtraction: type: object properties: currencies: items: $ref: '#/components/schemas/CurrencyValues' type: array dates: items: $ref: '#/components/schemas/DateValues' type: array defined_term: $ref: '#/components/schemas/DefinedTerm' durations: items: $ref: '#/components/schemas/DurationValues' type: array spans: type: array items: $ref: '#/components/schemas/CharacterSpan' text: type: string example: LEASE description: A `Result` contains an array of all extractions of a field from the file. TrainingRequestStatus: type: object required: - field_id - request_id - status properties: error: $ref: '#/components/schemas/HttpError' field_id: type: string example: 12345678-1234-1234-1234-123456789012 request_id: type: string example: c5e463f1qk154j5e3sjg status: $ref: '#/components/schemas/StatusEnum' span_issues: $ref: '#/components/schemas/SpanIssues' responses: Unauthorized: description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/HttpError' Forbidden: description: Forbidden content: application/json: schema: $ref: '#/components/schemas/HttpError' InternalServerError: description: Internal Server Error content: application/json: schema: $ref: '#/components/schemas/HttpError' InvalidRequestId: description: Invalid request ID content: application/json: schema: $ref: '#/components/schemas/HttpError' RequestNotFound: description: Request not found. content: application/json: schema: $ref: '#/components/schemas/HttpError' InvalidFieldId: description: Invalid field ID content: application/json: schema: $ref: '#/components/schemas/HttpError' FieldNotFound: description: Field not found. content: application/json: schema: $ref: '#/components/schemas/HttpError' InvalidFileId: description: Invalid file ID content: application/json: schema: $ref: '#/components/schemas/HttpError' FileNotFound: description: File not found. content: application/json: schema: $ref: '#/components/schemas/HttpError' OcrNotReady: description: OCR results not ready yet content: application/json: schema: $ref: '#/components/schemas/HttpError' x-original-swagger-version: '2.0'