> ## Documentation Index
> Fetch the complete documentation index at: https://developers.resistant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch quality result [ap-3]



## OpenAPI

````yaml /spec-ap-3.json get /v2/submission/{submission_id}/quality
openapi: 3.0.1
info:
  title: Resistant Documents API
  version: 2.0.0b
  description: >-

    Resistant Documents provides this API to programmatically interact with its
    document analysis engine.

    Interaction with the API can be divided into three phases:


    1. Creating document submission

    2. Uploading a file for for analysis to an address returned from step 1.

    3. Fetching analysis results


    In the first step, the submission is created by posting to the 
    `/v2/submission` endpoint. The response contains a `submission_id` uniquely
    identifying the document to be analyzed throughout the entire interaction,
    and is used to fetch analysis results later.


    Submission response also returns `upload_url` containing a pre-signed URL.
    This URL should be used to upload the actual document to be analyzed in the
    second step. Please note the document has to be uploaded using HTTP `PUT`
    method with `Content-Type` HTTP header set to `application/octet-stream`.


    In the last step, client should repeatedly poll using the
    `/v2/submission/{submission_id}/fraud` endpoint for analysis results. The
    best practice is to use polling with an [exponential
    back-off](https://en.wikipedia.org/wiki/Exponential_backoff) to reduce load
    on the API.


    # Authentication


    <SecurityDefinitions />
servers:
  - url: https://api.ap-3.documents.resistant.ai
security: []
paths:
  /v2/submission/{submission_id}/quality:
    get:
      summary: Fetch quality result [ap-3]
      operationId: getQuality
      parameters:
        - in: path
          name: submission_id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            Asynchronous processing finished (either with a success or an
            error). Result of the processing is described by specific response
            object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QualityResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - OAuth2:
            - submissions.read
components:
  schemas:
    QualityResponse:
      title: Quality engine response
      discriminator:
        propertyName: status
        mapping:
          SUCCESS:
            $ref: '#/components/schemas/QualitySuccessResponse'
          FAILED:
            $ref: '#/components/schemas/PipelineFailedResponse'
          INVALID_INPUT:
            $ref: '#/components/schemas/PipelineInvalidInputResponse'
          SKIPPED:
            $ref: '#/components/schemas/PipelineSkippedResponse'
      anyOf:
        - $ref: '#/components/schemas/QualitySuccessResponse'
        - $ref: '#/components/schemas/PipelineFailedResponse'
        - $ref: '#/components/schemas/PipelineInvalidInputResponse'
        - $ref: '#/components/schemas/PipelineSkippedResponse'
    QualitySuccessResponse:
      title: Quality success response
      type: object
      properties:
        status:
          title: Status
          enum:
            - SUCCESS
          type: string
        analysis_time:
          title: Analysis time
          description: Timestamp of analysis
          type: string
        file_type:
          $ref: '#/components/schemas/FileType'
          title: File type
          description: General type of the input file
        mime_type:
          title: Mime type
          description: >-
            Mime type of the input file, e.g. `application/pdf`, `image/jpeg`,
            etc.
          minLength: 0
          maxLength: 256
          type: string
        deployment_version:
          title: Deployment version
          description: Version of quality engine used for analysis
          minLength: 0
          maxLength: 256
          type: string
        query_id:
          title: Query ID
          description: >-
            Optional customer-defined identifier for correlating this submission
            with internal systems. Must not contain PII.
          minLength: 0
          maxLength: 2048
          type: string
          nullable: true
        sha256:
          title: File sha256
          description: Sha256 of the input file
          minLength: 64
          maxLength: 64
          type: string
        score:
          $ref: '#/components/schemas/QualityScore'
          title: Overall quality score
          description: >-
            Overall quality score for the analyzed document. LOW_QUALITY
            indicates quality issues were detected. HIGH_QUALITY indicates no
            quality issues were found.
        sample_metadata:
          $ref: '#/components/schemas/SampleMetadata'
          title: File metadata
          description: >-
            Metadata extracted from the analyzed file, such as creation date and
            software used to create the file.
        indicators:
          title: Quality indicators
          description: Detailed information about detected quality issues.
          type: array
          items:
            $ref: '#/components/schemas/QualityIndicator'
      required:
        - status
        - analysis_time
        - file_type
        - mime_type
        - deployment_version
        - query_id
        - sha256
        - score
        - sample_metadata
        - indicators
    PipelineFailedResponse:
      title: Pipeline failed
      type: object
      properties:
        status:
          title: Status
          enum:
            - FAILED
          type: string
        message:
          title: Error message
          minLength: 0
          maxLength: 256
          type: string
        deployment_version:
          title: Deployment version
          description: Version of analysis engine used for analysis
          minLength: 0
          maxLength: 256
          type: string
        analysis_time:
          title: Analysis time
          description: Timestamp of analysis
          type: string
        file_type:
          $ref: '#/components/schemas/FileType'
          title: File type
          description: General type of the input file
          type: string
          nullable: true
        mime_type:
          title: Mime type
          description: >-
            Mime type of the input file, e.g. `application/pdf`, `image/jpeg`,
            etc.
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        query_id:
          title: Query ID
          description: >-
            Optional customer-defined identifier for correlating this submission
            with internal systems. Must not contain PII.
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
      required:
        - status
        - message
        - deployment_version
        - analysis_time
    PipelineInvalidInputResponse:
      title: Unprocessable input entity
      type: object
      properties:
        status:
          title: Status
          enum:
            - INVALID_INPUT
          type: string
        message:
          title: Error message
          minLength: 0
          maxLength: 256
          type: string
        deployment_version:
          title: Deployment version
          description: Version of analysis engine used for analysis
          minLength: 0
          maxLength: 256
          type: string
        analysis_time:
          title: Analysis time
          description: Timestamp of analysis
          type: string
        file_type:
          $ref: '#/components/schemas/FileType'
          description: General type of the input file
          title: File Type
        mime_type:
          title: Mime type
          description: >-
            Mime type of the input file, e.g. `application/pdf`, `image/jpeg`,
            etc.
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        query_id:
          title: Query ID
          description: >-
            Optional customer-defined identifier for correlating this submission
            with internal systems. Must not contain PII.
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
      required:
        - status
        - message
        - deployment_version
        - analysis_time
    PipelineSkippedResponse:
      title: Pipeline was skipped
      type: object
      properties:
        status:
          title: Status
          default: SKIPPED
          enum:
            - SKIPPED
          type: string
        message:
          title: Pipeline skipped
          minLength: 0
          maxLength: 256
          type: string
        deployment_version:
          title: Deployment version
          description: Version of analysis engine used for analysis
          minLength: 0
          maxLength: 256
          type: string
        analysis_time:
          title: Analysis time
          description: Timestamp of analysis
          type: string
        query_id:
          title: Query ID
          description: >-
            Optional customer-defined identifier for correlating this submission
            with internal systems. Must not contain PII.
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
      required:
        - message
        - deployment_version
        - analysis_time
    Error:
      title: Error
      type: object
      properties:
        message:
          title: Error message
          description: Detailed error message
          minLength: 0
          maxLength: 512
          type: string
      required:
        - message
    FileType:
      title: FileType
      description: Type of analyzed file
      enum:
        - unsupported
        - pdf
        - image
      type: string
    QualityScore:
      title: QualityScore
      description: An enumeration.
      enum:
        - HIGH_QUALITY
        - LOW_QUALITY
        - NOT_RELEVANT_DOCUMENT
      type: string
    SampleMetadata:
      title: SampleMetadata
      description: Metadata of an analyzed file.
      type: object
      properties:
        producer:
          title: Document producer
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        creator:
          title: Document creator
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        creation_date:
          title: Creation date
          type: string
          nullable: true
        mod_date:
          title: Modification date
          type: string
          nullable: true
        author:
          title: Document author
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        title:
          title: Document title
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        keywords:
          title: Keywords
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
        subject:
          title: Subject
          minLength: 0
          maxLength: 256
          type: string
          nullable: true
    QualityIndicator:
      title: Quality indicator
      type: object
      properties:
        indicator_id:
          title: Indicator ID
          description: Unique identifier for the indicator
          minLength: 0
          maxLength: 256
          type: string
        type:
          $ref: '#/components/schemas/IndicatorType'
          title: Indicator type
          description: Type of indicator.
        category:
          title: Indicator category
          description: Category of indicator (e.g. `modifications`, `text_hiding`, etc.)
          minLength: 0
          maxLength: 256
          type: string
        title:
          title: Indicator title
          minLength: 0
          maxLength: 256
          type: string
        description:
          title: Indicator description
          description: Detailed description of the indicator.
          minLength: 0
          maxLength: 2048
          type: string
        metadata:
          $ref: '#/components/schemas/IndicatorMetadata'
          title: Indicator metadata
          type: object
          nullable: true
        origin:
          title: Origin
          enum:
            - quality
          type: string
      required:
        - indicator_id
        - type
        - category
        - title
        - description
        - origin
    IndicatorType:
      title: IndicatorType
      description: Type of a quality indicator.
      enum:
        - RISK
        - TRUST
        - INFO
      type: string
    IndicatorMetadata:
      title: Indicator metadata
      description: >-
        Additional metadata associated with the indicator. Content may evolve
        and change without prior notice. Intended primarily for UI visualization
        and tracking purposes.
      discriminator:
        propertyName: type
        mapping:
          DataOnly:
            $ref: '#/components/schemas/DataOnlyIndicatorMetadata'
          ElementsCollection:
            $ref: '#/components/schemas/ElementsCollectionIndicatorMetadata'
          CombiningIndicatorMetadata:
            $ref: '#/components/schemas/CombiningIndicatorMetadata'
      anyOf:
        - $ref: '#/components/schemas/DataOnlyIndicatorMetadata'
        - $ref: '#/components/schemas/ElementsCollectionIndicatorMetadata'
        - $ref: '#/components/schemas/CombiningIndicatorMetadata'
    DataOnlyIndicatorMetadata:
      title: DataOnlyIndicatorMetadata
      type: object
      properties:
        type:
          title: Type
          enum:
            - DataOnly
          type: string
        column_names:
          title: Column names
          description: Names of individual columns in data table
          type: array
          items:
            type: string
        data:
          title: Data
          description: >-
            Detailed information related to given indicator, e.g. document
            metadata, details about discrepancies in parsed content, etc.
          type: array
          items:
            type: array
            items:
              anyOf:
                - type: string
                - type: integer
                - type: number
                - type: boolean
                - type: array
                  items:
                    type: string
                  uniqueItems: true
              nullable: true
        title:
          title: Title
          description: Title of the data table
          type: string
          nullable: true
      required:
        - type
        - column_names
        - data
    ElementsCollectionIndicatorMetadata:
      title: ElementsCollectionIndicatorMetadata
      type: object
      properties:
        type:
          title: Type
          enum:
            - ElementsCollection
          type: string
        data:
          title: Metadata elements
          description: >-
            Metadata elements that represents individual detections, e.g.
            modified characters, area with flash reflection, etc.
          type: array
          items:
            $ref: '#/components/schemas/IndicatorMetadataElement'
        columns_definition:
          title: Columns definition
          description: Definition of columns in data table.
          type: array
          items:
            $ref: '#/components/schemas/ColumnDefinition'
        title:
          title: Title
          description: Title of the data table
          type: string
          nullable: true
      required:
        - type
    CombiningIndicatorMetadata:
      title: CombiningIndicatorMetadata
      type: object
      properties:
        type:
          title: Type
          enum:
            - Combining
          type: string
        data:
          title: Metadata elements
          description: >-
            Metadata elements that represents individual detections, e.g.
            modified characters, area with flash reflection, etc. and detailed
            information related to given indicator, e.g. document metadata,
            details about discrepancies in parsed content, etc.
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ElementsCollectionIndicatorMetadata'
              - $ref: '#/components/schemas/DataOnlyIndicatorMetadata'
      required:
        - type
    IndicatorMetadataElement:
      title: IndicatorMetadataElement
      discriminator:
        propertyName: type
        mapping:
          BBoxOnly:
            $ref: '#/components/schemas/BBoxOnlyMetadataElement'
          BBoxGroups:
            $ref: '#/components/schemas/BBoxGroupsMetadataElement'
          BBoxWithOldAndNewText:
            $ref: '#/components/schemas/NewAndOldTextMetadataElement'
          BBoxWithText:
            $ref: '#/components/schemas/TextMetadataElement'
          BBoxIncrementalUpdate:
            $ref: '#/components/schemas/IncrementalUpdateIndicatorMetadataElement'
      anyOf:
        - $ref: '#/components/schemas/BBoxOnlyMetadataElement'
        - $ref: '#/components/schemas/BBoxGroupsMetadataElement'
        - $ref: '#/components/schemas/NewAndOldTextMetadataElement'
        - $ref: '#/components/schemas/TextMetadataElement'
        - $ref: '#/components/schemas/IncrementalUpdateIndicatorMetadataElement'
    ColumnDefinition:
      title: ColumnDefinition
      type: object
      properties:
        column_name:
          title: Column name
          description: Name of column in data table
          type: string
        field_name:
          title: Field name
          description: Field name in IndicatorMetadataElement object
          type: string
      required:
        - column_name
        - field_name
    BBoxOnlyMetadataElement:
      title: Metadata element with single bounding box
      type: object
      properties:
        type:
          title: Type
          enum:
            - BBoxOnly
          type: string
        page_id:
          title: Page id
          description: >-
            Number of the page corresponding to the modification. Note that
            first page has page_id = 0. In case of images, the page_id is always
            0.
          type: integer
        bbox:
          $ref: '#/components/schemas/BoundingBox'
          title: Bounding box
          description: Bounding box corresponding to given modification
      required:
        - type
        - page_id
        - bbox
    BBoxGroupsMetadataElement:
      title: Metadata element with multiple bounding boxes
      type: object
      properties:
        type:
          title: Type
          enum:
            - BBoxGroups
          type: string
        page_id:
          title: Page id
          description: >-
            Number of the page corresponding to the modification. Note that
            first page has page_id = 0. In case of images, the page_id is always
            0.
          type: integer
        bbox:
          title: Bounding boxes
          description: >-
            Group of bounding boxes corresponding to given modification, e.g.
            copy-move detection where single character is copied to multiple
            places
          type: array
          items:
            $ref: '#/components/schemas/BoundingBox'
      required:
        - type
        - page_id
        - bbox
    NewAndOldTextMetadataElement:
      title: Metadata element with bounding box, original text and modified text
      type: object
      properties:
        type:
          title: Type
          enum:
            - BBoxWithOldAndNewText
          type: string
        page_id:
          title: Page id
          description: >-
            Number of the page corresponding to the modification. Note that
            first page has page_id = 0. In case of images, the page_id is always
            0.
          type: integer
        bbox:
          $ref: '#/components/schemas/BoundingBox'
          title: Bounding box
          description: Bounding box corresponding to given modification
        original_text:
          title: Original text
          description: Text that was originally present in the document.
          type: string
          nullable: true
        new_text:
          title: New text
          description: Text that replaced or modified the original text.
          type: string
          nullable: true
      required:
        - type
        - page_id
        - bbox
        - original_text
        - new_text
    TextMetadataElement:
      title: Metadata element with bounding box and additional text data
      type: object
      properties:
        type:
          title: Type
          enum:
            - BBoxWithText
          type: string
        page_id:
          title: Page id
          description: >-
            Number of the page corresponding to the modification. Note that
            first page has page_id = 0. In case of images, the page_id is always
            0.
          type: integer
        bbox:
          $ref: '#/components/schemas/BoundingBox'
          title: Bounding box
          description: Bounding box corresponding to given modification
        text:
          title: Text
          type: string
          nullable: true
      required:
        - type
        - page_id
        - bbox
        - text
    IncrementalUpdateIndicatorMetadataElement:
      title: Metadata element with bounding box, original text and modified text
      type: object
      properties:
        type:
          title: Type
          enum:
            - BBoxIncrementalUpdate
          type: string
        page_id:
          title: Page id
          description: >-
            Number of the page corresponding to the modification. Note that
            first page has page_id = 0. In case of images, the page_id is always
            0.
          type: integer
        bbox:
          $ref: '#/components/schemas/BoundingBox'
          title: Bounding box
          description: Bounding box corresponding to given modification
        original_text:
          title: Original text
          description: Text that was originally present in the document.
          type: string
          nullable: true
        new_text:
          title: New text
          description: Text that replaced or modified the original text.
          type: string
          nullable: true
        update_type:
          $ref: '#/components/schemas/IncrementalUpdateType'
          title: Update type
          description: Type of incremental update change
      required:
        - type
        - page_id
        - bbox
        - original_text
        - new_text
        - update_type
    BoundingBox:
      title: Bounding box of given modification
      type: object
      properties:
        x:
          title: Bounding box X coordinate
          description: >-
            Horizontal position of the lower left corner of the detected
            modification.
          type: number
        'y':
          title: Bounding box Y coordinate.
          description: >-
            Vertical position of the lower left corner of the detected
            modification.
          type: number
        width:
          title: Bounding box width.
          description: Width of the detected modification.
          type: number
        height:
          title: Bounding box height.
          description: Height of the detected modification.
          type: number
      required:
        - x
        - 'y'
        - width
        - height
    IncrementalUpdateType:
      title: IncrementalUpdateType
      description: An enumeration.
      enum:
        - add
        - edit
        - remove
      type: string
  responses:
    BadRequest:
      description: Bad request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing valid authentication credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Access to the requested resource is forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: Unsupported media type.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Request quota was exceeded
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://eu.id.resistant.ai/oauth2/ausp40dse1Q0rzDq6417/v1/token
          scopes:
            submissions.read: Read analysis results for a submission
            submissions.write: Create a new submission

````